google_cloud_iam_admin_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate reqwest;
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/// Audit log information specific to Cloud IAM admin APIs. This message is
40/// serialized as an `Any` type in the `ServiceData` message of an
41/// `AuditLog` message.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct AuditData {
45    /// The permission_delta when when creating or updating a Role.
46    pub permission_delta: std::option::Option<crate::model::audit_data::PermissionDelta>,
47
48    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
49}
50
51impl AuditData {
52    pub fn new() -> Self {
53        std::default::Default::default()
54    }
55
56    /// Sets the value of [permission_delta][crate::model::AuditData::permission_delta].
57    pub fn set_permission_delta<T>(mut self, v: T) -> Self
58    where
59        T: std::convert::Into<crate::model::audit_data::PermissionDelta>,
60    {
61        self.permission_delta = std::option::Option::Some(v.into());
62        self
63    }
64
65    /// Sets or clears the value of [permission_delta][crate::model::AuditData::permission_delta].
66    pub fn set_or_clear_permission_delta<T>(mut self, v: std::option::Option<T>) -> Self
67    where
68        T: std::convert::Into<crate::model::audit_data::PermissionDelta>,
69    {
70        self.permission_delta = v.map(|x| x.into());
71        self
72    }
73}
74
75impl wkt::message::Message for AuditData {
76    fn typename() -> &'static str {
77        "type.googleapis.com/google.iam.admin.v1.AuditData"
78    }
79}
80
81/// Defines additional types related to [AuditData].
82pub mod audit_data {
83    #[allow(unused_imports)]
84    use super::*;
85
86    /// A PermissionDelta message to record the added_permissions and
87    /// removed_permissions inside a role.
88    #[derive(Clone, Default, PartialEq)]
89    #[non_exhaustive]
90    pub struct PermissionDelta {
91        /// Added permissions.
92        pub added_permissions: std::vec::Vec<std::string::String>,
93
94        /// Removed permissions.
95        pub removed_permissions: std::vec::Vec<std::string::String>,
96
97        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
98    }
99
100    impl PermissionDelta {
101        pub fn new() -> Self {
102            std::default::Default::default()
103        }
104
105        /// Sets the value of [added_permissions][crate::model::audit_data::PermissionDelta::added_permissions].
106        pub fn set_added_permissions<T, V>(mut self, v: T) -> Self
107        where
108            T: std::iter::IntoIterator<Item = V>,
109            V: std::convert::Into<std::string::String>,
110        {
111            use std::iter::Iterator;
112            self.added_permissions = v.into_iter().map(|i| i.into()).collect();
113            self
114        }
115
116        /// Sets the value of [removed_permissions][crate::model::audit_data::PermissionDelta::removed_permissions].
117        pub fn set_removed_permissions<T, V>(mut self, v: T) -> Self
118        where
119            T: std::iter::IntoIterator<Item = V>,
120            V: std::convert::Into<std::string::String>,
121        {
122            use std::iter::Iterator;
123            self.removed_permissions = v.into_iter().map(|i| i.into()).collect();
124            self
125        }
126    }
127
128    impl wkt::message::Message for PermissionDelta {
129        fn typename() -> &'static str {
130            "type.googleapis.com/google.iam.admin.v1.AuditData.PermissionDelta"
131        }
132    }
133}
134
135/// An IAM service account.
136///
137/// A service account is an account for an application or a virtual machine (VM)
138/// instance, not a person. You can use a service account to call Google APIs. To
139/// learn more, read the [overview of service
140/// accounts](https://cloud.google.com/iam/help/service-accounts/overview).
141///
142/// When you create a service account, you specify the project ID that owns the
143/// service account, as well as a name that must be unique within the project.
144/// IAM uses these values to create an email address that identifies the service
145/// account.
146#[derive(Clone, Default, PartialEq)]
147#[non_exhaustive]
148pub struct ServiceAccount {
149    /// The resource name of the service account.
150    ///
151    /// Use one of the following formats:
152    ///
153    /// * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
154    /// * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}`
155    ///
156    /// As an alternative, you can use the `-` wildcard character instead of the
157    /// project ID:
158    ///
159    /// * `projects/-/serviceAccounts/{EMAIL_ADDRESS}`
160    /// * `projects/-/serviceAccounts/{UNIQUE_ID}`
161    ///
162    /// When possible, avoid using the `-` wildcard character, because it can cause
163    /// response messages to contain misleading error codes. For example, if you
164    /// try to get the service account
165    /// `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
166    /// response contains an HTTP `403 Forbidden` error instead of a `404 Not
167    /// Found` error.
168    pub name: std::string::String,
169
170    /// Output only. The ID of the project that owns the service account.
171    pub project_id: std::string::String,
172
173    /// Output only. The unique, stable numeric ID for the service account.
174    ///
175    /// Each service account retains its unique ID even if you delete the service
176    /// account. For example, if you delete a service account, then create a new
177    /// service account with the same name, the new service account has a different
178    /// unique ID than the deleted service account.
179    pub unique_id: std::string::String,
180
181    /// Output only. The email address of the service account.
182    pub email: std::string::String,
183
184    /// Optional. A user-specified, human-readable name for the service account. The maximum
185    /// length is 100 UTF-8 bytes.
186    pub display_name: std::string::String,
187
188    /// Deprecated. Do not use.
189    #[deprecated]
190    pub etag: ::bytes::Bytes,
191
192    /// Optional. A user-specified, human-readable description of the service account. The
193    /// maximum length is 256 UTF-8 bytes.
194    pub description: std::string::String,
195
196    /// Output only. The OAuth 2.0 client ID for the service account.
197    pub oauth2_client_id: std::string::String,
198
199    /// Output only. Whether the service account is disabled.
200    pub disabled: bool,
201
202    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
203}
204
205impl ServiceAccount {
206    pub fn new() -> Self {
207        std::default::Default::default()
208    }
209
210    /// Sets the value of [name][crate::model::ServiceAccount::name].
211    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
212        self.name = v.into();
213        self
214    }
215
216    /// Sets the value of [project_id][crate::model::ServiceAccount::project_id].
217    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
218        self.project_id = v.into();
219        self
220    }
221
222    /// Sets the value of [unique_id][crate::model::ServiceAccount::unique_id].
223    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
224        self.unique_id = v.into();
225        self
226    }
227
228    /// Sets the value of [email][crate::model::ServiceAccount::email].
229    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
230        self.email = v.into();
231        self
232    }
233
234    /// Sets the value of [display_name][crate::model::ServiceAccount::display_name].
235    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
236        self.display_name = v.into();
237        self
238    }
239
240    /// Sets the value of [etag][crate::model::ServiceAccount::etag].
241    #[deprecated]
242    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
243        self.etag = v.into();
244        self
245    }
246
247    /// Sets the value of [description][crate::model::ServiceAccount::description].
248    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249        self.description = v.into();
250        self
251    }
252
253    /// Sets the value of [oauth2_client_id][crate::model::ServiceAccount::oauth2_client_id].
254    pub fn set_oauth2_client_id<T: std::convert::Into<std::string::String>>(
255        mut self,
256        v: T,
257    ) -> Self {
258        self.oauth2_client_id = v.into();
259        self
260    }
261
262    /// Sets the value of [disabled][crate::model::ServiceAccount::disabled].
263    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
264        self.disabled = v.into();
265        self
266    }
267}
268
269impl wkt::message::Message for ServiceAccount {
270    fn typename() -> &'static str {
271        "type.googleapis.com/google.iam.admin.v1.ServiceAccount"
272    }
273}
274
275/// The service account create request.
276#[derive(Clone, Default, PartialEq)]
277#[non_exhaustive]
278pub struct CreateServiceAccountRequest {
279    /// Required. The resource name of the project associated with the service
280    /// accounts, such as `projects/my-project-123`.
281    pub name: std::string::String,
282
283    /// Required. The account id that is used to generate the service account
284    /// email address and a stable unique id. It is unique within a project,
285    /// must be 6-30 characters long, and match the regular expression
286    /// `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
287    pub account_id: std::string::String,
288
289    /// The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
290    /// create. Currently, only the following values are user assignable:
291    /// `display_name` and `description`.
292    ///
293    /// [google.iam.admin.v1.ServiceAccount]: crate::model::ServiceAccount
294    pub service_account: std::option::Option<crate::model::ServiceAccount>,
295
296    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
297}
298
299impl CreateServiceAccountRequest {
300    pub fn new() -> Self {
301        std::default::Default::default()
302    }
303
304    /// Sets the value of [name][crate::model::CreateServiceAccountRequest::name].
305    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
306        self.name = v.into();
307        self
308    }
309
310    /// Sets the value of [account_id][crate::model::CreateServiceAccountRequest::account_id].
311    pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312        self.account_id = v.into();
313        self
314    }
315
316    /// Sets the value of [service_account][crate::model::CreateServiceAccountRequest::service_account].
317    pub fn set_service_account<T>(mut self, v: T) -> Self
318    where
319        T: std::convert::Into<crate::model::ServiceAccount>,
320    {
321        self.service_account = std::option::Option::Some(v.into());
322        self
323    }
324
325    /// Sets or clears the value of [service_account][crate::model::CreateServiceAccountRequest::service_account].
326    pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
327    where
328        T: std::convert::Into<crate::model::ServiceAccount>,
329    {
330        self.service_account = v.map(|x| x.into());
331        self
332    }
333}
334
335impl wkt::message::Message for CreateServiceAccountRequest {
336    fn typename() -> &'static str {
337        "type.googleapis.com/google.iam.admin.v1.CreateServiceAccountRequest"
338    }
339}
340
341/// The service account list request.
342#[derive(Clone, Default, PartialEq)]
343#[non_exhaustive]
344pub struct ListServiceAccountsRequest {
345    /// Required. The resource name of the project associated with the service
346    /// accounts, such as `projects/my-project-123`.
347    pub name: std::string::String,
348
349    /// Optional limit on the number of service accounts to include in the
350    /// response. Further accounts can subsequently be obtained by including the
351    /// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]
352    /// in a subsequent request.
353    ///
354    /// The default is 20, and the maximum is 100.
355    ///
356    /// [google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]: crate::model::ListServiceAccountsResponse::next_page_token
357    pub page_size: i32,
358
359    /// Optional pagination token returned in an earlier
360    /// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token].
361    ///
362    /// [google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]: crate::model::ListServiceAccountsResponse::next_page_token
363    pub page_token: std::string::String,
364
365    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
366}
367
368impl ListServiceAccountsRequest {
369    pub fn new() -> Self {
370        std::default::Default::default()
371    }
372
373    /// Sets the value of [name][crate::model::ListServiceAccountsRequest::name].
374    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
375        self.name = v.into();
376        self
377    }
378
379    /// Sets the value of [page_size][crate::model::ListServiceAccountsRequest::page_size].
380    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
381        self.page_size = v.into();
382        self
383    }
384
385    /// Sets the value of [page_token][crate::model::ListServiceAccountsRequest::page_token].
386    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
387        self.page_token = v.into();
388        self
389    }
390}
391
392impl wkt::message::Message for ListServiceAccountsRequest {
393    fn typename() -> &'static str {
394        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountsRequest"
395    }
396}
397
398/// The service account list response.
399#[derive(Clone, Default, PartialEq)]
400#[non_exhaustive]
401pub struct ListServiceAccountsResponse {
402    /// The list of matching service accounts.
403    pub accounts: std::vec::Vec<crate::model::ServiceAccount>,
404
405    /// To retrieve the next page of results, set
406    /// [ListServiceAccountsRequest.page_token][google.iam.admin.v1.ListServiceAccountsRequest.page_token]
407    /// to this value.
408    ///
409    /// [google.iam.admin.v1.ListServiceAccountsRequest.page_token]: crate::model::ListServiceAccountsRequest::page_token
410    pub next_page_token: std::string::String,
411
412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
413}
414
415impl ListServiceAccountsResponse {
416    pub fn new() -> Self {
417        std::default::Default::default()
418    }
419
420    /// Sets the value of [accounts][crate::model::ListServiceAccountsResponse::accounts].
421    pub fn set_accounts<T, V>(mut self, v: T) -> Self
422    where
423        T: std::iter::IntoIterator<Item = V>,
424        V: std::convert::Into<crate::model::ServiceAccount>,
425    {
426        use std::iter::Iterator;
427        self.accounts = v.into_iter().map(|i| i.into()).collect();
428        self
429    }
430
431    /// Sets the value of [next_page_token][crate::model::ListServiceAccountsResponse::next_page_token].
432    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
433        self.next_page_token = v.into();
434        self
435    }
436}
437
438impl wkt::message::Message for ListServiceAccountsResponse {
439    fn typename() -> &'static str {
440        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountsResponse"
441    }
442}
443
444#[doc(hidden)]
445impl gax::paginator::internal::PageableResponse for ListServiceAccountsResponse {
446    type PageItem = crate::model::ServiceAccount;
447
448    fn items(self) -> std::vec::Vec<Self::PageItem> {
449        self.accounts
450    }
451
452    fn next_page_token(&self) -> std::string::String {
453        use std::clone::Clone;
454        self.next_page_token.clone()
455    }
456}
457
458/// The service account get request.
459#[derive(Clone, Default, PartialEq)]
460#[non_exhaustive]
461pub struct GetServiceAccountRequest {
462    /// Required. The resource name of the service account in the following format:
463    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
464    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
465    /// the account. The `ACCOUNT` value can be the `email` address or the
466    /// `unique_id` of the service account.
467    pub name: std::string::String,
468
469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
470}
471
472impl GetServiceAccountRequest {
473    pub fn new() -> Self {
474        std::default::Default::default()
475    }
476
477    /// Sets the value of [name][crate::model::GetServiceAccountRequest::name].
478    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
479        self.name = v.into();
480        self
481    }
482}
483
484impl wkt::message::Message for GetServiceAccountRequest {
485    fn typename() -> &'static str {
486        "type.googleapis.com/google.iam.admin.v1.GetServiceAccountRequest"
487    }
488}
489
490/// The service account delete request.
491#[derive(Clone, Default, PartialEq)]
492#[non_exhaustive]
493pub struct DeleteServiceAccountRequest {
494    /// Required. The resource name of the service account in the following format:
495    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
496    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
497    /// the account. The `ACCOUNT` value can be the `email` address or the
498    /// `unique_id` of the service account.
499    pub name: std::string::String,
500
501    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
502}
503
504impl DeleteServiceAccountRequest {
505    pub fn new() -> Self {
506        std::default::Default::default()
507    }
508
509    /// Sets the value of [name][crate::model::DeleteServiceAccountRequest::name].
510    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
511        self.name = v.into();
512        self
513    }
514}
515
516impl wkt::message::Message for DeleteServiceAccountRequest {
517    fn typename() -> &'static str {
518        "type.googleapis.com/google.iam.admin.v1.DeleteServiceAccountRequest"
519    }
520}
521
522/// The service account patch request.
523///
524/// You can patch only the `display_name` and `description` fields. You must use
525/// the `update_mask` field to specify which of these fields you want to patch.
526///
527/// Only the fields specified in the request are guaranteed to be returned in
528/// the response. Other fields may be empty in the response.
529#[derive(Clone, Default, PartialEq)]
530#[non_exhaustive]
531pub struct PatchServiceAccountRequest {
532    pub service_account: std::option::Option<crate::model::ServiceAccount>,
533
534    pub update_mask: std::option::Option<wkt::FieldMask>,
535
536    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
537}
538
539impl PatchServiceAccountRequest {
540    pub fn new() -> Self {
541        std::default::Default::default()
542    }
543
544    /// Sets the value of [service_account][crate::model::PatchServiceAccountRequest::service_account].
545    pub fn set_service_account<T>(mut self, v: T) -> Self
546    where
547        T: std::convert::Into<crate::model::ServiceAccount>,
548    {
549        self.service_account = std::option::Option::Some(v.into());
550        self
551    }
552
553    /// Sets or clears the value of [service_account][crate::model::PatchServiceAccountRequest::service_account].
554    pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
555    where
556        T: std::convert::Into<crate::model::ServiceAccount>,
557    {
558        self.service_account = v.map(|x| x.into());
559        self
560    }
561
562    /// Sets the value of [update_mask][crate::model::PatchServiceAccountRequest::update_mask].
563    pub fn set_update_mask<T>(mut self, v: T) -> Self
564    where
565        T: std::convert::Into<wkt::FieldMask>,
566    {
567        self.update_mask = std::option::Option::Some(v.into());
568        self
569    }
570
571    /// Sets or clears the value of [update_mask][crate::model::PatchServiceAccountRequest::update_mask].
572    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
573    where
574        T: std::convert::Into<wkt::FieldMask>,
575    {
576        self.update_mask = v.map(|x| x.into());
577        self
578    }
579}
580
581impl wkt::message::Message for PatchServiceAccountRequest {
582    fn typename() -> &'static str {
583        "type.googleapis.com/google.iam.admin.v1.PatchServiceAccountRequest"
584    }
585}
586
587/// The service account undelete request.
588#[derive(Clone, Default, PartialEq)]
589#[non_exhaustive]
590pub struct UndeleteServiceAccountRequest {
591    /// The resource name of the service account in the following format:
592    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}`.
593    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
594    /// the account.
595    pub name: std::string::String,
596
597    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
598}
599
600impl UndeleteServiceAccountRequest {
601    pub fn new() -> Self {
602        std::default::Default::default()
603    }
604
605    /// Sets the value of [name][crate::model::UndeleteServiceAccountRequest::name].
606    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
607        self.name = v.into();
608        self
609    }
610}
611
612impl wkt::message::Message for UndeleteServiceAccountRequest {
613    fn typename() -> &'static str {
614        "type.googleapis.com/google.iam.admin.v1.UndeleteServiceAccountRequest"
615    }
616}
617
618#[derive(Clone, Default, PartialEq)]
619#[non_exhaustive]
620pub struct UndeleteServiceAccountResponse {
621    /// Metadata for the restored service account.
622    pub restored_account: std::option::Option<crate::model::ServiceAccount>,
623
624    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
625}
626
627impl UndeleteServiceAccountResponse {
628    pub fn new() -> Self {
629        std::default::Default::default()
630    }
631
632    /// Sets the value of [restored_account][crate::model::UndeleteServiceAccountResponse::restored_account].
633    pub fn set_restored_account<T>(mut self, v: T) -> Self
634    where
635        T: std::convert::Into<crate::model::ServiceAccount>,
636    {
637        self.restored_account = std::option::Option::Some(v.into());
638        self
639    }
640
641    /// Sets or clears the value of [restored_account][crate::model::UndeleteServiceAccountResponse::restored_account].
642    pub fn set_or_clear_restored_account<T>(mut self, v: std::option::Option<T>) -> Self
643    where
644        T: std::convert::Into<crate::model::ServiceAccount>,
645    {
646        self.restored_account = v.map(|x| x.into());
647        self
648    }
649}
650
651impl wkt::message::Message for UndeleteServiceAccountResponse {
652    fn typename() -> &'static str {
653        "type.googleapis.com/google.iam.admin.v1.UndeleteServiceAccountResponse"
654    }
655}
656
657/// The service account enable request.
658#[derive(Clone, Default, PartialEq)]
659#[non_exhaustive]
660pub struct EnableServiceAccountRequest {
661    /// The resource name of the service account in the following format:
662    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
663    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
664    /// the account. The `ACCOUNT` value can be the `email` address or the
665    /// `unique_id` of the service account.
666    pub name: std::string::String,
667
668    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
669}
670
671impl EnableServiceAccountRequest {
672    pub fn new() -> Self {
673        std::default::Default::default()
674    }
675
676    /// Sets the value of [name][crate::model::EnableServiceAccountRequest::name].
677    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
678        self.name = v.into();
679        self
680    }
681}
682
683impl wkt::message::Message for EnableServiceAccountRequest {
684    fn typename() -> &'static str {
685        "type.googleapis.com/google.iam.admin.v1.EnableServiceAccountRequest"
686    }
687}
688
689/// The service account disable request.
690#[derive(Clone, Default, PartialEq)]
691#[non_exhaustive]
692pub struct DisableServiceAccountRequest {
693    /// The resource name of the service account in the following format:
694    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
695    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
696    /// the account. The `ACCOUNT` value can be the `email` address or the
697    /// `unique_id` of the service account.
698    pub name: std::string::String,
699
700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
701}
702
703impl DisableServiceAccountRequest {
704    pub fn new() -> Self {
705        std::default::Default::default()
706    }
707
708    /// Sets the value of [name][crate::model::DisableServiceAccountRequest::name].
709    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
710        self.name = v.into();
711        self
712    }
713}
714
715impl wkt::message::Message for DisableServiceAccountRequest {
716    fn typename() -> &'static str {
717        "type.googleapis.com/google.iam.admin.v1.DisableServiceAccountRequest"
718    }
719}
720
721/// The service account keys list request.
722#[derive(Clone, Default, PartialEq)]
723#[non_exhaustive]
724pub struct ListServiceAccountKeysRequest {
725    /// Required. The resource name of the service account in the following format:
726    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
727    ///
728    /// Using `-` as a wildcard for the `PROJECT_ID`, will infer the project from
729    /// the account. The `ACCOUNT` value can be the `email` address or the
730    /// `unique_id` of the service account.
731    pub name: std::string::String,
732
733    /// Filters the types of keys the user wants to include in the list
734    /// response. Duplicate key types are not allowed. If no key type
735    /// is provided, all keys are returned.
736    pub key_types: std::vec::Vec<crate::model::list_service_account_keys_request::KeyType>,
737
738    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
739}
740
741impl ListServiceAccountKeysRequest {
742    pub fn new() -> Self {
743        std::default::Default::default()
744    }
745
746    /// Sets the value of [name][crate::model::ListServiceAccountKeysRequest::name].
747    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
748        self.name = v.into();
749        self
750    }
751
752    /// Sets the value of [key_types][crate::model::ListServiceAccountKeysRequest::key_types].
753    pub fn set_key_types<T, V>(mut self, v: T) -> Self
754    where
755        T: std::iter::IntoIterator<Item = V>,
756        V: std::convert::Into<crate::model::list_service_account_keys_request::KeyType>,
757    {
758        use std::iter::Iterator;
759        self.key_types = v.into_iter().map(|i| i.into()).collect();
760        self
761    }
762}
763
764impl wkt::message::Message for ListServiceAccountKeysRequest {
765    fn typename() -> &'static str {
766        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountKeysRequest"
767    }
768}
769
770/// Defines additional types related to [ListServiceAccountKeysRequest].
771pub mod list_service_account_keys_request {
772    #[allow(unused_imports)]
773    use super::*;
774
775    /// `KeyType` filters to selectively retrieve certain varieties
776    /// of keys.
777    ///
778    /// # Working with unknown values
779    ///
780    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
781    /// additional enum variants at any time. Adding new variants is not considered
782    /// a breaking change. Applications should write their code in anticipation of:
783    ///
784    /// - New values appearing in future releases of the client library, **and**
785    /// - New values received dynamically, without application changes.
786    ///
787    /// Please consult the [Working with enums] section in the user guide for some
788    /// guidelines.
789    ///
790    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
791    #[derive(Clone, Debug, PartialEq)]
792    #[non_exhaustive]
793    pub enum KeyType {
794        /// Unspecified key type. The presence of this in the
795        /// message will immediately result in an error.
796        Unspecified,
797        /// User-managed keys (managed and rotated by the user).
798        UserManaged,
799        /// System-managed keys (managed and rotated by Google).
800        SystemManaged,
801        /// If set, the enum was initialized with an unknown value.
802        ///
803        /// Applications can examine the value using [KeyType::value] or
804        /// [KeyType::name].
805        UnknownValue(key_type::UnknownValue),
806    }
807
808    #[doc(hidden)]
809    pub mod key_type {
810        #[allow(unused_imports)]
811        use super::*;
812        #[derive(Clone, Debug, PartialEq)]
813        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
814    }
815
816    impl KeyType {
817        /// Gets the enum value.
818        ///
819        /// Returns `None` if the enum contains an unknown value deserialized from
820        /// the string representation of enums.
821        pub fn value(&self) -> std::option::Option<i32> {
822            match self {
823                Self::Unspecified => std::option::Option::Some(0),
824                Self::UserManaged => std::option::Option::Some(1),
825                Self::SystemManaged => std::option::Option::Some(2),
826                Self::UnknownValue(u) => u.0.value(),
827            }
828        }
829
830        /// Gets the enum value as a string.
831        ///
832        /// Returns `None` if the enum contains an unknown value deserialized from
833        /// the integer representation of enums.
834        pub fn name(&self) -> std::option::Option<&str> {
835            match self {
836                Self::Unspecified => std::option::Option::Some("KEY_TYPE_UNSPECIFIED"),
837                Self::UserManaged => std::option::Option::Some("USER_MANAGED"),
838                Self::SystemManaged => std::option::Option::Some("SYSTEM_MANAGED"),
839                Self::UnknownValue(u) => u.0.name(),
840            }
841        }
842    }
843
844    impl std::default::Default for KeyType {
845        fn default() -> Self {
846            use std::convert::From;
847            Self::from(0)
848        }
849    }
850
851    impl std::fmt::Display for KeyType {
852        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
853            wkt::internal::display_enum(f, self.name(), self.value())
854        }
855    }
856
857    impl std::convert::From<i32> for KeyType {
858        fn from(value: i32) -> Self {
859            match value {
860                0 => Self::Unspecified,
861                1 => Self::UserManaged,
862                2 => Self::SystemManaged,
863                _ => Self::UnknownValue(key_type::UnknownValue(
864                    wkt::internal::UnknownEnumValue::Integer(value),
865                )),
866            }
867        }
868    }
869
870    impl std::convert::From<&str> for KeyType {
871        fn from(value: &str) -> Self {
872            use std::string::ToString;
873            match value {
874                "KEY_TYPE_UNSPECIFIED" => Self::Unspecified,
875                "USER_MANAGED" => Self::UserManaged,
876                "SYSTEM_MANAGED" => Self::SystemManaged,
877                _ => Self::UnknownValue(key_type::UnknownValue(
878                    wkt::internal::UnknownEnumValue::String(value.to_string()),
879                )),
880            }
881        }
882    }
883
884    impl serde::ser::Serialize for KeyType {
885        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
886        where
887            S: serde::Serializer,
888        {
889            match self {
890                Self::Unspecified => serializer.serialize_i32(0),
891                Self::UserManaged => serializer.serialize_i32(1),
892                Self::SystemManaged => serializer.serialize_i32(2),
893                Self::UnknownValue(u) => u.0.serialize(serializer),
894            }
895        }
896    }
897
898    impl<'de> serde::de::Deserialize<'de> for KeyType {
899        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
900        where
901            D: serde::Deserializer<'de>,
902        {
903            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyType>::new(
904                ".google.iam.admin.v1.ListServiceAccountKeysRequest.KeyType",
905            ))
906        }
907    }
908}
909
910/// The service account keys list response.
911#[derive(Clone, Default, PartialEq)]
912#[non_exhaustive]
913pub struct ListServiceAccountKeysResponse {
914    /// The public keys for the service account.
915    pub keys: std::vec::Vec<crate::model::ServiceAccountKey>,
916
917    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
918}
919
920impl ListServiceAccountKeysResponse {
921    pub fn new() -> Self {
922        std::default::Default::default()
923    }
924
925    /// Sets the value of [keys][crate::model::ListServiceAccountKeysResponse::keys].
926    pub fn set_keys<T, V>(mut self, v: T) -> Self
927    where
928        T: std::iter::IntoIterator<Item = V>,
929        V: std::convert::Into<crate::model::ServiceAccountKey>,
930    {
931        use std::iter::Iterator;
932        self.keys = v.into_iter().map(|i| i.into()).collect();
933        self
934    }
935}
936
937impl wkt::message::Message for ListServiceAccountKeysResponse {
938    fn typename() -> &'static str {
939        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountKeysResponse"
940    }
941}
942
943/// The service account key get by id request.
944#[derive(Clone, Default, PartialEq)]
945#[non_exhaustive]
946pub struct GetServiceAccountKeyRequest {
947    /// Required. The resource name of the service account key in the following format:
948    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
949    ///
950    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
951    /// the account. The `ACCOUNT` value can be the `email` address or the
952    /// `unique_id` of the service account.
953    pub name: std::string::String,
954
955    /// Optional. The output format of the public key. The default is `TYPE_NONE`, which
956    /// means that the public key is not returned.
957    pub public_key_type: crate::model::ServiceAccountPublicKeyType,
958
959    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
960}
961
962impl GetServiceAccountKeyRequest {
963    pub fn new() -> Self {
964        std::default::Default::default()
965    }
966
967    /// Sets the value of [name][crate::model::GetServiceAccountKeyRequest::name].
968    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
969        self.name = v.into();
970        self
971    }
972
973    /// Sets the value of [public_key_type][crate::model::GetServiceAccountKeyRequest::public_key_type].
974    pub fn set_public_key_type<T: std::convert::Into<crate::model::ServiceAccountPublicKeyType>>(
975        mut self,
976        v: T,
977    ) -> Self {
978        self.public_key_type = v.into();
979        self
980    }
981}
982
983impl wkt::message::Message for GetServiceAccountKeyRequest {
984    fn typename() -> &'static str {
985        "type.googleapis.com/google.iam.admin.v1.GetServiceAccountKeyRequest"
986    }
987}
988
989/// Represents a service account key.
990///
991/// A service account has two sets of key-pairs: user-managed, and
992/// system-managed.
993///
994/// User-managed key-pairs can be created and deleted by users.  Users are
995/// responsible for rotating these keys periodically to ensure security of
996/// their service accounts.  Users retain the private key of these key-pairs,
997/// and Google retains ONLY the public key.
998///
999/// System-managed keys are automatically rotated by Google, and are used for
1000/// signing for a maximum of two weeks. The rotation process is probabilistic,
1001/// and usage of the new key will gradually ramp up and down over the key's
1002/// lifetime.
1003///
1004/// If you cache the public key set for a service account, we recommend that you
1005/// update the cache every 15 minutes. User-managed keys can be added and removed
1006/// at any time, so it is important to update the cache frequently. For
1007/// Google-managed keys, Google will publish a key at least 6 hours before it is
1008/// first used for signing and will keep publishing it for at least 6 hours after
1009/// it was last used for signing.
1010///
1011/// Public keys for all service accounts are also published at the OAuth2
1012/// Service Account API.
1013#[derive(Clone, Default, PartialEq)]
1014#[non_exhaustive]
1015pub struct ServiceAccountKey {
1016    /// The resource name of the service account key in the following format
1017    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
1018    pub name: std::string::String,
1019
1020    /// The output format for the private key.
1021    /// Only provided in `CreateServiceAccountKey` responses, not
1022    /// in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
1023    ///
1024    /// Google never exposes system-managed private keys, and never retains
1025    /// user-managed private keys.
1026    pub private_key_type: crate::model::ServiceAccountPrivateKeyType,
1027
1028    /// Specifies the algorithm (and possibly key size) for the key.
1029    pub key_algorithm: crate::model::ServiceAccountKeyAlgorithm,
1030
1031    /// The private key data. Only provided in `CreateServiceAccountKey`
1032    /// responses. Make sure to keep the private key data secure because it
1033    /// allows for the assertion of the service account identity.
1034    /// When base64 decoded, the private key data can be used to authenticate with
1035    /// Google API client libraries and with
1036    /// <a href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
1037    /// auth activate-service-account</a>.
1038    pub private_key_data: ::bytes::Bytes,
1039
1040    /// The public key data. Only provided in `GetServiceAccountKey` responses.
1041    pub public_key_data: ::bytes::Bytes,
1042
1043    /// The key can be used after this timestamp.
1044    pub valid_after_time: std::option::Option<wkt::Timestamp>,
1045
1046    /// The key can be used before this timestamp.
1047    /// For system-managed key pairs, this timestamp is the end time for the
1048    /// private key signing operation. The public key could still be used
1049    /// for verification for a few hours after this time.
1050    pub valid_before_time: std::option::Option<wkt::Timestamp>,
1051
1052    /// The key origin.
1053    pub key_origin: crate::model::ServiceAccountKeyOrigin,
1054
1055    /// The key type.
1056    pub key_type: crate::model::list_service_account_keys_request::KeyType,
1057
1058    /// The key status.
1059    pub disabled: bool,
1060
1061    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1062}
1063
1064impl ServiceAccountKey {
1065    pub fn new() -> Self {
1066        std::default::Default::default()
1067    }
1068
1069    /// Sets the value of [name][crate::model::ServiceAccountKey::name].
1070    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1071        self.name = v.into();
1072        self
1073    }
1074
1075    /// Sets the value of [private_key_type][crate::model::ServiceAccountKey::private_key_type].
1076    pub fn set_private_key_type<
1077        T: std::convert::Into<crate::model::ServiceAccountPrivateKeyType>,
1078    >(
1079        mut self,
1080        v: T,
1081    ) -> Self {
1082        self.private_key_type = v.into();
1083        self
1084    }
1085
1086    /// Sets the value of [key_algorithm][crate::model::ServiceAccountKey::key_algorithm].
1087    pub fn set_key_algorithm<T: std::convert::Into<crate::model::ServiceAccountKeyAlgorithm>>(
1088        mut self,
1089        v: T,
1090    ) -> Self {
1091        self.key_algorithm = v.into();
1092        self
1093    }
1094
1095    /// Sets the value of [private_key_data][crate::model::ServiceAccountKey::private_key_data].
1096    pub fn set_private_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1097        self.private_key_data = v.into();
1098        self
1099    }
1100
1101    /// Sets the value of [public_key_data][crate::model::ServiceAccountKey::public_key_data].
1102    pub fn set_public_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1103        self.public_key_data = v.into();
1104        self
1105    }
1106
1107    /// Sets the value of [valid_after_time][crate::model::ServiceAccountKey::valid_after_time].
1108    pub fn set_valid_after_time<T>(mut self, v: T) -> Self
1109    where
1110        T: std::convert::Into<wkt::Timestamp>,
1111    {
1112        self.valid_after_time = std::option::Option::Some(v.into());
1113        self
1114    }
1115
1116    /// Sets or clears the value of [valid_after_time][crate::model::ServiceAccountKey::valid_after_time].
1117    pub fn set_or_clear_valid_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1118    where
1119        T: std::convert::Into<wkt::Timestamp>,
1120    {
1121        self.valid_after_time = v.map(|x| x.into());
1122        self
1123    }
1124
1125    /// Sets the value of [valid_before_time][crate::model::ServiceAccountKey::valid_before_time].
1126    pub fn set_valid_before_time<T>(mut self, v: T) -> Self
1127    where
1128        T: std::convert::Into<wkt::Timestamp>,
1129    {
1130        self.valid_before_time = std::option::Option::Some(v.into());
1131        self
1132    }
1133
1134    /// Sets or clears the value of [valid_before_time][crate::model::ServiceAccountKey::valid_before_time].
1135    pub fn set_or_clear_valid_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1136    where
1137        T: std::convert::Into<wkt::Timestamp>,
1138    {
1139        self.valid_before_time = v.map(|x| x.into());
1140        self
1141    }
1142
1143    /// Sets the value of [key_origin][crate::model::ServiceAccountKey::key_origin].
1144    pub fn set_key_origin<T: std::convert::Into<crate::model::ServiceAccountKeyOrigin>>(
1145        mut self,
1146        v: T,
1147    ) -> Self {
1148        self.key_origin = v.into();
1149        self
1150    }
1151
1152    /// Sets the value of [key_type][crate::model::ServiceAccountKey::key_type].
1153    pub fn set_key_type<
1154        T: std::convert::Into<crate::model::list_service_account_keys_request::KeyType>,
1155    >(
1156        mut self,
1157        v: T,
1158    ) -> Self {
1159        self.key_type = v.into();
1160        self
1161    }
1162
1163    /// Sets the value of [disabled][crate::model::ServiceAccountKey::disabled].
1164    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1165        self.disabled = v.into();
1166        self
1167    }
1168}
1169
1170impl wkt::message::Message for ServiceAccountKey {
1171    fn typename() -> &'static str {
1172        "type.googleapis.com/google.iam.admin.v1.ServiceAccountKey"
1173    }
1174}
1175
1176/// The service account key create request.
1177#[derive(Clone, Default, PartialEq)]
1178#[non_exhaustive]
1179pub struct CreateServiceAccountKeyRequest {
1180    /// Required. The resource name of the service account in the following format:
1181    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
1182    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1183    /// the account. The `ACCOUNT` value can be the `email` address or the
1184    /// `unique_id` of the service account.
1185    pub name: std::string::String,
1186
1187    /// The output format of the private key. The default value is
1188    /// `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials File
1189    /// format.
1190    pub private_key_type: crate::model::ServiceAccountPrivateKeyType,
1191
1192    /// Which type of key and algorithm to use for the key.
1193    /// The default is currently a 2K RSA key.  However this may change in the
1194    /// future.
1195    pub key_algorithm: crate::model::ServiceAccountKeyAlgorithm,
1196
1197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1198}
1199
1200impl CreateServiceAccountKeyRequest {
1201    pub fn new() -> Self {
1202        std::default::Default::default()
1203    }
1204
1205    /// Sets the value of [name][crate::model::CreateServiceAccountKeyRequest::name].
1206    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1207        self.name = v.into();
1208        self
1209    }
1210
1211    /// Sets the value of [private_key_type][crate::model::CreateServiceAccountKeyRequest::private_key_type].
1212    pub fn set_private_key_type<
1213        T: std::convert::Into<crate::model::ServiceAccountPrivateKeyType>,
1214    >(
1215        mut self,
1216        v: T,
1217    ) -> Self {
1218        self.private_key_type = v.into();
1219        self
1220    }
1221
1222    /// Sets the value of [key_algorithm][crate::model::CreateServiceAccountKeyRequest::key_algorithm].
1223    pub fn set_key_algorithm<T: std::convert::Into<crate::model::ServiceAccountKeyAlgorithm>>(
1224        mut self,
1225        v: T,
1226    ) -> Self {
1227        self.key_algorithm = v.into();
1228        self
1229    }
1230}
1231
1232impl wkt::message::Message for CreateServiceAccountKeyRequest {
1233    fn typename() -> &'static str {
1234        "type.googleapis.com/google.iam.admin.v1.CreateServiceAccountKeyRequest"
1235    }
1236}
1237
1238/// The service account key upload request.
1239#[derive(Clone, Default, PartialEq)]
1240#[non_exhaustive]
1241pub struct UploadServiceAccountKeyRequest {
1242    /// The resource name of the service account in the following format:
1243    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
1244    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1245    /// the account. The `ACCOUNT` value can be the `email` address or the
1246    /// `unique_id` of the service account.
1247    pub name: std::string::String,
1248
1249    /// The public key to associate with the service account. Must be an RSA public
1250    /// key that is wrapped in an X.509 v3 certificate. Include the first line,
1251    /// `-----BEGIN CERTIFICATE-----`, and the last line,
1252    /// `-----END CERTIFICATE-----`.
1253    pub public_key_data: ::bytes::Bytes,
1254
1255    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1256}
1257
1258impl UploadServiceAccountKeyRequest {
1259    pub fn new() -> Self {
1260        std::default::Default::default()
1261    }
1262
1263    /// Sets the value of [name][crate::model::UploadServiceAccountKeyRequest::name].
1264    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1265        self.name = v.into();
1266        self
1267    }
1268
1269    /// Sets the value of [public_key_data][crate::model::UploadServiceAccountKeyRequest::public_key_data].
1270    pub fn set_public_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1271        self.public_key_data = v.into();
1272        self
1273    }
1274}
1275
1276impl wkt::message::Message for UploadServiceAccountKeyRequest {
1277    fn typename() -> &'static str {
1278        "type.googleapis.com/google.iam.admin.v1.UploadServiceAccountKeyRequest"
1279    }
1280}
1281
1282/// The service account key delete request.
1283#[derive(Clone, Default, PartialEq)]
1284#[non_exhaustive]
1285pub struct DeleteServiceAccountKeyRequest {
1286    /// Required. The resource name of the service account key in the following format:
1287    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
1288    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1289    /// the account. The `ACCOUNT` value can be the `email` address or the
1290    /// `unique_id` of the service account.
1291    pub name: std::string::String,
1292
1293    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1294}
1295
1296impl DeleteServiceAccountKeyRequest {
1297    pub fn new() -> Self {
1298        std::default::Default::default()
1299    }
1300
1301    /// Sets the value of [name][crate::model::DeleteServiceAccountKeyRequest::name].
1302    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1303        self.name = v.into();
1304        self
1305    }
1306}
1307
1308impl wkt::message::Message for DeleteServiceAccountKeyRequest {
1309    fn typename() -> &'static str {
1310        "type.googleapis.com/google.iam.admin.v1.DeleteServiceAccountKeyRequest"
1311    }
1312}
1313
1314/// The service account key disable request.
1315#[derive(Clone, Default, PartialEq)]
1316#[non_exhaustive]
1317pub struct DisableServiceAccountKeyRequest {
1318    /// Required. The resource name of the service account key in the following format:
1319    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
1320    ///
1321    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1322    /// the account. The `ACCOUNT` value can be the `email` address or the
1323    /// `unique_id` of the service account.
1324    pub name: std::string::String,
1325
1326    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1327}
1328
1329impl DisableServiceAccountKeyRequest {
1330    pub fn new() -> Self {
1331        std::default::Default::default()
1332    }
1333
1334    /// Sets the value of [name][crate::model::DisableServiceAccountKeyRequest::name].
1335    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1336        self.name = v.into();
1337        self
1338    }
1339}
1340
1341impl wkt::message::Message for DisableServiceAccountKeyRequest {
1342    fn typename() -> &'static str {
1343        "type.googleapis.com/google.iam.admin.v1.DisableServiceAccountKeyRequest"
1344    }
1345}
1346
1347/// The service account key enable request.
1348#[derive(Clone, Default, PartialEq)]
1349#[non_exhaustive]
1350pub struct EnableServiceAccountKeyRequest {
1351    /// Required. The resource name of the service account key in the following format:
1352    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
1353    ///
1354    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1355    /// the account. The `ACCOUNT` value can be the `email` address or the
1356    /// `unique_id` of the service account.
1357    pub name: std::string::String,
1358
1359    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1360}
1361
1362impl EnableServiceAccountKeyRequest {
1363    pub fn new() -> Self {
1364        std::default::Default::default()
1365    }
1366
1367    /// Sets the value of [name][crate::model::EnableServiceAccountKeyRequest::name].
1368    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1369        self.name = v.into();
1370        self
1371    }
1372}
1373
1374impl wkt::message::Message for EnableServiceAccountKeyRequest {
1375    fn typename() -> &'static str {
1376        "type.googleapis.com/google.iam.admin.v1.EnableServiceAccountKeyRequest"
1377    }
1378}
1379
1380/// Deprecated. [Migrate to Service Account Credentials
1381/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1382///
1383/// The service account sign blob request.
1384#[derive(Clone, Default, PartialEq)]
1385#[non_exhaustive]
1386pub struct SignBlobRequest {
1387    /// Required. Deprecated. [Migrate to Service Account Credentials
1388    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1389    ///
1390    /// The resource name of the service account in the following format:
1391    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
1392    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1393    /// the account. The `ACCOUNT` value can be the `email` address or the
1394    /// `unique_id` of the service account.
1395    #[deprecated]
1396    pub name: std::string::String,
1397
1398    /// Required. Deprecated. [Migrate to Service Account Credentials
1399    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1400    ///
1401    /// The bytes to sign.
1402    #[deprecated]
1403    pub bytes_to_sign: ::bytes::Bytes,
1404
1405    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1406}
1407
1408impl SignBlobRequest {
1409    pub fn new() -> Self {
1410        std::default::Default::default()
1411    }
1412
1413    /// Sets the value of [name][crate::model::SignBlobRequest::name].
1414    #[deprecated]
1415    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1416        self.name = v.into();
1417        self
1418    }
1419
1420    /// Sets the value of [bytes_to_sign][crate::model::SignBlobRequest::bytes_to_sign].
1421    #[deprecated]
1422    pub fn set_bytes_to_sign<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1423        self.bytes_to_sign = v.into();
1424        self
1425    }
1426}
1427
1428impl wkt::message::Message for SignBlobRequest {
1429    fn typename() -> &'static str {
1430        "type.googleapis.com/google.iam.admin.v1.SignBlobRequest"
1431    }
1432}
1433
1434/// Deprecated. [Migrate to Service Account Credentials
1435/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1436///
1437/// The service account sign blob response.
1438#[derive(Clone, Default, PartialEq)]
1439#[non_exhaustive]
1440pub struct SignBlobResponse {
1441    /// Deprecated. [Migrate to Service Account Credentials
1442    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1443    ///
1444    /// The id of the key used to sign the blob.
1445    #[deprecated]
1446    pub key_id: std::string::String,
1447
1448    /// Deprecated. [Migrate to Service Account Credentials
1449    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1450    ///
1451    /// The signed blob.
1452    #[deprecated]
1453    pub signature: ::bytes::Bytes,
1454
1455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1456}
1457
1458impl SignBlobResponse {
1459    pub fn new() -> Self {
1460        std::default::Default::default()
1461    }
1462
1463    /// Sets the value of [key_id][crate::model::SignBlobResponse::key_id].
1464    #[deprecated]
1465    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1466        self.key_id = v.into();
1467        self
1468    }
1469
1470    /// Sets the value of [signature][crate::model::SignBlobResponse::signature].
1471    #[deprecated]
1472    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1473        self.signature = v.into();
1474        self
1475    }
1476}
1477
1478impl wkt::message::Message for SignBlobResponse {
1479    fn typename() -> &'static str {
1480        "type.googleapis.com/google.iam.admin.v1.SignBlobResponse"
1481    }
1482}
1483
1484/// Deprecated. [Migrate to Service Account Credentials
1485/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1486///
1487/// The service account sign JWT request.
1488#[derive(Clone, Default, PartialEq)]
1489#[non_exhaustive]
1490pub struct SignJwtRequest {
1491    /// Required. Deprecated. [Migrate to Service Account Credentials
1492    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1493    ///
1494    /// The resource name of the service account in the following format:
1495    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
1496    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
1497    /// the account. The `ACCOUNT` value can be the `email` address or the
1498    /// `unique_id` of the service account.
1499    #[deprecated]
1500    pub name: std::string::String,
1501
1502    /// Required. Deprecated. [Migrate to Service Account Credentials
1503    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1504    ///
1505    /// The JWT payload to sign. Must be a serialized JSON object that contains a
1506    /// JWT Claims Set. For example: `{"sub": "user@example.com", "iat": 313435}`
1507    ///
1508    /// If the JWT Claims Set contains an expiration time (`exp`) claim, it must be
1509    /// an integer timestamp that is not in the past and no more than 12 hours in
1510    /// the future.
1511    ///
1512    /// If the JWT Claims Set does not contain an expiration time (`exp`) claim,
1513    /// this claim is added automatically, with a timestamp that is 1 hour in the
1514    /// future.
1515    #[deprecated]
1516    pub payload: std::string::String,
1517
1518    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1519}
1520
1521impl SignJwtRequest {
1522    pub fn new() -> Self {
1523        std::default::Default::default()
1524    }
1525
1526    /// Sets the value of [name][crate::model::SignJwtRequest::name].
1527    #[deprecated]
1528    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1529        self.name = v.into();
1530        self
1531    }
1532
1533    /// Sets the value of [payload][crate::model::SignJwtRequest::payload].
1534    #[deprecated]
1535    pub fn set_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1536        self.payload = v.into();
1537        self
1538    }
1539}
1540
1541impl wkt::message::Message for SignJwtRequest {
1542    fn typename() -> &'static str {
1543        "type.googleapis.com/google.iam.admin.v1.SignJwtRequest"
1544    }
1545}
1546
1547/// Deprecated. [Migrate to Service Account Credentials
1548/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1549///
1550/// The service account sign JWT response.
1551#[derive(Clone, Default, PartialEq)]
1552#[non_exhaustive]
1553pub struct SignJwtResponse {
1554    /// Deprecated. [Migrate to Service Account Credentials
1555    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1556    ///
1557    /// The id of the key used to sign the JWT.
1558    #[deprecated]
1559    pub key_id: std::string::String,
1560
1561    /// Deprecated. [Migrate to Service Account Credentials
1562    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
1563    ///
1564    /// The signed JWT.
1565    #[deprecated]
1566    pub signed_jwt: std::string::String,
1567
1568    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1569}
1570
1571impl SignJwtResponse {
1572    pub fn new() -> Self {
1573        std::default::Default::default()
1574    }
1575
1576    /// Sets the value of [key_id][crate::model::SignJwtResponse::key_id].
1577    #[deprecated]
1578    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1579        self.key_id = v.into();
1580        self
1581    }
1582
1583    /// Sets the value of [signed_jwt][crate::model::SignJwtResponse::signed_jwt].
1584    #[deprecated]
1585    pub fn set_signed_jwt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1586        self.signed_jwt = v.into();
1587        self
1588    }
1589}
1590
1591impl wkt::message::Message for SignJwtResponse {
1592    fn typename() -> &'static str {
1593        "type.googleapis.com/google.iam.admin.v1.SignJwtResponse"
1594    }
1595}
1596
1597/// A role in the Identity and Access Management API.
1598#[derive(Clone, Default, PartialEq)]
1599#[non_exhaustive]
1600pub struct Role {
1601    /// The name of the role.
1602    ///
1603    /// When Role is used in CreateRole, the role name must not be set.
1604    ///
1605    /// When Role is used in output and other input such as UpdateRole, the role
1606    /// name is the complete path, e.g., roles/logging.viewer for predefined roles
1607    /// and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom roles.
1608    pub name: std::string::String,
1609
1610    /// Optional. A human-readable title for the role.  Typically this
1611    /// is limited to 100 UTF-8 bytes.
1612    pub title: std::string::String,
1613
1614    /// Optional. A human-readable description for the role.
1615    pub description: std::string::String,
1616
1617    /// The names of the permissions this role grants when bound in an IAM policy.
1618    pub included_permissions: std::vec::Vec<std::string::String>,
1619
1620    /// The current launch stage of the role. If the `ALPHA` launch stage has been
1621    /// selected for a role, the `stage` field will not be included in the
1622    /// returned definition for the role.
1623    pub stage: crate::model::role::RoleLaunchStage,
1624
1625    /// Used to perform a consistent read-modify-write.
1626    pub etag: ::bytes::Bytes,
1627
1628    /// The current deleted state of the role. This field is read only.
1629    /// It will be ignored in calls to CreateRole and UpdateRole.
1630    pub deleted: bool,
1631
1632    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1633}
1634
1635impl Role {
1636    pub fn new() -> Self {
1637        std::default::Default::default()
1638    }
1639
1640    /// Sets the value of [name][crate::model::Role::name].
1641    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1642        self.name = v.into();
1643        self
1644    }
1645
1646    /// Sets the value of [title][crate::model::Role::title].
1647    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1648        self.title = v.into();
1649        self
1650    }
1651
1652    /// Sets the value of [description][crate::model::Role::description].
1653    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654        self.description = v.into();
1655        self
1656    }
1657
1658    /// Sets the value of [included_permissions][crate::model::Role::included_permissions].
1659    pub fn set_included_permissions<T, V>(mut self, v: T) -> Self
1660    where
1661        T: std::iter::IntoIterator<Item = V>,
1662        V: std::convert::Into<std::string::String>,
1663    {
1664        use std::iter::Iterator;
1665        self.included_permissions = v.into_iter().map(|i| i.into()).collect();
1666        self
1667    }
1668
1669    /// Sets the value of [stage][crate::model::Role::stage].
1670    pub fn set_stage<T: std::convert::Into<crate::model::role::RoleLaunchStage>>(
1671        mut self,
1672        v: T,
1673    ) -> Self {
1674        self.stage = v.into();
1675        self
1676    }
1677
1678    /// Sets the value of [etag][crate::model::Role::etag].
1679    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1680        self.etag = v.into();
1681        self
1682    }
1683
1684    /// Sets the value of [deleted][crate::model::Role::deleted].
1685    pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1686        self.deleted = v.into();
1687        self
1688    }
1689}
1690
1691impl wkt::message::Message for Role {
1692    fn typename() -> &'static str {
1693        "type.googleapis.com/google.iam.admin.v1.Role"
1694    }
1695}
1696
1697/// Defines additional types related to [Role].
1698pub mod role {
1699    #[allow(unused_imports)]
1700    use super::*;
1701
1702    /// A stage representing a role's lifecycle phase.
1703    ///
1704    /// # Working with unknown values
1705    ///
1706    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1707    /// additional enum variants at any time. Adding new variants is not considered
1708    /// a breaking change. Applications should write their code in anticipation of:
1709    ///
1710    /// - New values appearing in future releases of the client library, **and**
1711    /// - New values received dynamically, without application changes.
1712    ///
1713    /// Please consult the [Working with enums] section in the user guide for some
1714    /// guidelines.
1715    ///
1716    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1717    #[derive(Clone, Debug, PartialEq)]
1718    #[non_exhaustive]
1719    pub enum RoleLaunchStage {
1720        /// The user has indicated this role is currently in an Alpha phase. If this
1721        /// launch stage is selected, the `stage` field will not be included when
1722        /// requesting the definition for a given role.
1723        Alpha,
1724        /// The user has indicated this role is currently in a Beta phase.
1725        Beta,
1726        /// The user has indicated this role is generally available.
1727        Ga,
1728        /// The user has indicated this role is being deprecated.
1729        Deprecated,
1730        /// This role is disabled and will not contribute permissions to any
1731        /// principals it is granted to in policies.
1732        Disabled,
1733        /// The user has indicated this role is currently in an EAP phase.
1734        Eap,
1735        /// If set, the enum was initialized with an unknown value.
1736        ///
1737        /// Applications can examine the value using [RoleLaunchStage::value] or
1738        /// [RoleLaunchStage::name].
1739        UnknownValue(role_launch_stage::UnknownValue),
1740    }
1741
1742    #[doc(hidden)]
1743    pub mod role_launch_stage {
1744        #[allow(unused_imports)]
1745        use super::*;
1746        #[derive(Clone, Debug, PartialEq)]
1747        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1748    }
1749
1750    impl RoleLaunchStage {
1751        /// Gets the enum value.
1752        ///
1753        /// Returns `None` if the enum contains an unknown value deserialized from
1754        /// the string representation of enums.
1755        pub fn value(&self) -> std::option::Option<i32> {
1756            match self {
1757                Self::Alpha => std::option::Option::Some(0),
1758                Self::Beta => std::option::Option::Some(1),
1759                Self::Ga => std::option::Option::Some(2),
1760                Self::Deprecated => std::option::Option::Some(4),
1761                Self::Disabled => std::option::Option::Some(5),
1762                Self::Eap => std::option::Option::Some(6),
1763                Self::UnknownValue(u) => u.0.value(),
1764            }
1765        }
1766
1767        /// Gets the enum value as a string.
1768        ///
1769        /// Returns `None` if the enum contains an unknown value deserialized from
1770        /// the integer representation of enums.
1771        pub fn name(&self) -> std::option::Option<&str> {
1772            match self {
1773                Self::Alpha => std::option::Option::Some("ALPHA"),
1774                Self::Beta => std::option::Option::Some("BETA"),
1775                Self::Ga => std::option::Option::Some("GA"),
1776                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
1777                Self::Disabled => std::option::Option::Some("DISABLED"),
1778                Self::Eap => std::option::Option::Some("EAP"),
1779                Self::UnknownValue(u) => u.0.name(),
1780            }
1781        }
1782    }
1783
1784    impl std::default::Default for RoleLaunchStage {
1785        fn default() -> Self {
1786            use std::convert::From;
1787            Self::from(0)
1788        }
1789    }
1790
1791    impl std::fmt::Display for RoleLaunchStage {
1792        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1793            wkt::internal::display_enum(f, self.name(), self.value())
1794        }
1795    }
1796
1797    impl std::convert::From<i32> for RoleLaunchStage {
1798        fn from(value: i32) -> Self {
1799            match value {
1800                0 => Self::Alpha,
1801                1 => Self::Beta,
1802                2 => Self::Ga,
1803                4 => Self::Deprecated,
1804                5 => Self::Disabled,
1805                6 => Self::Eap,
1806                _ => Self::UnknownValue(role_launch_stage::UnknownValue(
1807                    wkt::internal::UnknownEnumValue::Integer(value),
1808                )),
1809            }
1810        }
1811    }
1812
1813    impl std::convert::From<&str> for RoleLaunchStage {
1814        fn from(value: &str) -> Self {
1815            use std::string::ToString;
1816            match value {
1817                "ALPHA" => Self::Alpha,
1818                "BETA" => Self::Beta,
1819                "GA" => Self::Ga,
1820                "DEPRECATED" => Self::Deprecated,
1821                "DISABLED" => Self::Disabled,
1822                "EAP" => Self::Eap,
1823                _ => Self::UnknownValue(role_launch_stage::UnknownValue(
1824                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1825                )),
1826            }
1827        }
1828    }
1829
1830    impl serde::ser::Serialize for RoleLaunchStage {
1831        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1832        where
1833            S: serde::Serializer,
1834        {
1835            match self {
1836                Self::Alpha => serializer.serialize_i32(0),
1837                Self::Beta => serializer.serialize_i32(1),
1838                Self::Ga => serializer.serialize_i32(2),
1839                Self::Deprecated => serializer.serialize_i32(4),
1840                Self::Disabled => serializer.serialize_i32(5),
1841                Self::Eap => serializer.serialize_i32(6),
1842                Self::UnknownValue(u) => u.0.serialize(serializer),
1843            }
1844        }
1845    }
1846
1847    impl<'de> serde::de::Deserialize<'de> for RoleLaunchStage {
1848        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1849        where
1850            D: serde::Deserializer<'de>,
1851        {
1852            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoleLaunchStage>::new(
1853                ".google.iam.admin.v1.Role.RoleLaunchStage",
1854            ))
1855        }
1856    }
1857}
1858
1859/// The grantable role query request.
1860#[derive(Clone, Default, PartialEq)]
1861#[non_exhaustive]
1862pub struct QueryGrantableRolesRequest {
1863    /// Required. The full resource name to query from the list of grantable roles.
1864    ///
1865    /// The name follows the Google Cloud Platform resource format.
1866    /// For example, a Cloud Platform project with id `my-project` will be named
1867    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
1868    pub full_resource_name: std::string::String,
1869
1870    pub view: crate::model::RoleView,
1871
1872    /// Optional limit on the number of roles to include in the response.
1873    ///
1874    /// The default is 300, and the maximum is 1,000.
1875    pub page_size: i32,
1876
1877    /// Optional pagination token returned in an earlier
1878    /// QueryGrantableRolesResponse.
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 QueryGrantableRolesRequest {
1885    pub fn new() -> Self {
1886        std::default::Default::default()
1887    }
1888
1889    /// Sets the value of [full_resource_name][crate::model::QueryGrantableRolesRequest::full_resource_name].
1890    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
1891        mut self,
1892        v: T,
1893    ) -> Self {
1894        self.full_resource_name = v.into();
1895        self
1896    }
1897
1898    /// Sets the value of [view][crate::model::QueryGrantableRolesRequest::view].
1899    pub fn set_view<T: std::convert::Into<crate::model::RoleView>>(mut self, v: T) -> Self {
1900        self.view = v.into();
1901        self
1902    }
1903
1904    /// Sets the value of [page_size][crate::model::QueryGrantableRolesRequest::page_size].
1905    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1906        self.page_size = v.into();
1907        self
1908    }
1909
1910    /// Sets the value of [page_token][crate::model::QueryGrantableRolesRequest::page_token].
1911    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1912        self.page_token = v.into();
1913        self
1914    }
1915}
1916
1917impl wkt::message::Message for QueryGrantableRolesRequest {
1918    fn typename() -> &'static str {
1919        "type.googleapis.com/google.iam.admin.v1.QueryGrantableRolesRequest"
1920    }
1921}
1922
1923/// The grantable role query response.
1924#[derive(Clone, Default, PartialEq)]
1925#[non_exhaustive]
1926pub struct QueryGrantableRolesResponse {
1927    /// The list of matching roles.
1928    pub roles: std::vec::Vec<crate::model::Role>,
1929
1930    /// To retrieve the next page of results, set
1931    /// `QueryGrantableRolesRequest.page_token` to this value.
1932    pub next_page_token: std::string::String,
1933
1934    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1935}
1936
1937impl QueryGrantableRolesResponse {
1938    pub fn new() -> Self {
1939        std::default::Default::default()
1940    }
1941
1942    /// Sets the value of [roles][crate::model::QueryGrantableRolesResponse::roles].
1943    pub fn set_roles<T, V>(mut self, v: T) -> Self
1944    where
1945        T: std::iter::IntoIterator<Item = V>,
1946        V: std::convert::Into<crate::model::Role>,
1947    {
1948        use std::iter::Iterator;
1949        self.roles = v.into_iter().map(|i| i.into()).collect();
1950        self
1951    }
1952
1953    /// Sets the value of [next_page_token][crate::model::QueryGrantableRolesResponse::next_page_token].
1954    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1955        self.next_page_token = v.into();
1956        self
1957    }
1958}
1959
1960impl wkt::message::Message for QueryGrantableRolesResponse {
1961    fn typename() -> &'static str {
1962        "type.googleapis.com/google.iam.admin.v1.QueryGrantableRolesResponse"
1963    }
1964}
1965
1966#[doc(hidden)]
1967impl gax::paginator::internal::PageableResponse for QueryGrantableRolesResponse {
1968    type PageItem = crate::model::Role;
1969
1970    fn items(self) -> std::vec::Vec<Self::PageItem> {
1971        self.roles
1972    }
1973
1974    fn next_page_token(&self) -> std::string::String {
1975        use std::clone::Clone;
1976        self.next_page_token.clone()
1977    }
1978}
1979
1980/// The request to get all roles defined under a resource.
1981#[derive(Clone, Default, PartialEq)]
1982#[non_exhaustive]
1983pub struct ListRolesRequest {
1984    /// The `parent` parameter's value depends on the target resource for the
1985    /// request, namely
1986    /// [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
1987    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
1988    /// or
1989    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
1990    /// Each resource type's `parent` value format is described below:
1991    ///
1992    /// * [`roles.list()`](https://cloud.google.com/iam/reference/rest/v1/roles/list): An empty string.
1993    ///   This method doesn't require a resource; it simply returns all
1994    ///   [predefined
1995    ///   roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
1996    ///   in Cloud IAM. Example request URL: `<https://iam.googleapis.com/v1/roles>`
1997    ///
1998    /// * [`projects.roles.list()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/list):
1999    ///   `projects/{PROJECT_ID}`. This method lists all project-level
2000    ///   [custom
2001    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
2002    ///   Example request URL:
2003    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles>`
2004    ///
2005    /// * [`organizations.roles.list()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/list):
2006    ///   `organizations/{ORGANIZATION_ID}`. This method lists all
2007    ///   organization-level [custom
2008    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
2009    ///   Example request URL:
2010    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles>`
2011    ///
2012    ///
2013    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2014    /// ID or organization ID.
2015    pub parent: std::string::String,
2016
2017    /// Optional limit on the number of roles to include in the response.
2018    ///
2019    /// The default is 300, and the maximum is 1,000.
2020    pub page_size: i32,
2021
2022    /// Optional pagination token returned in an earlier ListRolesResponse.
2023    pub page_token: std::string::String,
2024
2025    /// Optional view for the returned Role objects. When `FULL` is specified,
2026    /// the `includedPermissions` field is returned, which includes a list of all
2027    /// permissions in the role. The default value is `BASIC`, which does not
2028    /// return the `includedPermissions` field.
2029    pub view: crate::model::RoleView,
2030
2031    /// Include Roles that have been deleted.
2032    pub show_deleted: bool,
2033
2034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2035}
2036
2037impl ListRolesRequest {
2038    pub fn new() -> Self {
2039        std::default::Default::default()
2040    }
2041
2042    /// Sets the value of [parent][crate::model::ListRolesRequest::parent].
2043    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2044        self.parent = v.into();
2045        self
2046    }
2047
2048    /// Sets the value of [page_size][crate::model::ListRolesRequest::page_size].
2049    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2050        self.page_size = v.into();
2051        self
2052    }
2053
2054    /// Sets the value of [page_token][crate::model::ListRolesRequest::page_token].
2055    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2056        self.page_token = v.into();
2057        self
2058    }
2059
2060    /// Sets the value of [view][crate::model::ListRolesRequest::view].
2061    pub fn set_view<T: std::convert::Into<crate::model::RoleView>>(mut self, v: T) -> Self {
2062        self.view = v.into();
2063        self
2064    }
2065
2066    /// Sets the value of [show_deleted][crate::model::ListRolesRequest::show_deleted].
2067    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2068        self.show_deleted = v.into();
2069        self
2070    }
2071}
2072
2073impl wkt::message::Message for ListRolesRequest {
2074    fn typename() -> &'static str {
2075        "type.googleapis.com/google.iam.admin.v1.ListRolesRequest"
2076    }
2077}
2078
2079/// The response containing the roles defined under a resource.
2080#[derive(Clone, Default, PartialEq)]
2081#[non_exhaustive]
2082pub struct ListRolesResponse {
2083    /// The Roles defined on this resource.
2084    pub roles: std::vec::Vec<crate::model::Role>,
2085
2086    /// To retrieve the next page of results, set
2087    /// `ListRolesRequest.page_token` to this value.
2088    pub next_page_token: std::string::String,
2089
2090    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2091}
2092
2093impl ListRolesResponse {
2094    pub fn new() -> Self {
2095        std::default::Default::default()
2096    }
2097
2098    /// Sets the value of [roles][crate::model::ListRolesResponse::roles].
2099    pub fn set_roles<T, V>(mut self, v: T) -> Self
2100    where
2101        T: std::iter::IntoIterator<Item = V>,
2102        V: std::convert::Into<crate::model::Role>,
2103    {
2104        use std::iter::Iterator;
2105        self.roles = v.into_iter().map(|i| i.into()).collect();
2106        self
2107    }
2108
2109    /// Sets the value of [next_page_token][crate::model::ListRolesResponse::next_page_token].
2110    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2111        self.next_page_token = v.into();
2112        self
2113    }
2114}
2115
2116impl wkt::message::Message for ListRolesResponse {
2117    fn typename() -> &'static str {
2118        "type.googleapis.com/google.iam.admin.v1.ListRolesResponse"
2119    }
2120}
2121
2122#[doc(hidden)]
2123impl gax::paginator::internal::PageableResponse for ListRolesResponse {
2124    type PageItem = crate::model::Role;
2125
2126    fn items(self) -> std::vec::Vec<Self::PageItem> {
2127        self.roles
2128    }
2129
2130    fn next_page_token(&self) -> std::string::String {
2131        use std::clone::Clone;
2132        self.next_page_token.clone()
2133    }
2134}
2135
2136/// The request to get the definition of an existing role.
2137#[derive(Clone, Default, PartialEq)]
2138#[non_exhaustive]
2139pub struct GetRoleRequest {
2140    /// The `name` parameter's value depends on the target resource for the
2141    /// request, namely
2142    /// [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
2143    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
2144    /// or
2145    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
2146    /// Each resource type's `name` value format is described below:
2147    ///
2148    /// * [`roles.get()`](https://cloud.google.com/iam/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`.
2149    ///   This method returns results from all
2150    ///   [predefined
2151    ///   roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
2152    ///   in Cloud IAM. Example request URL:
2153    ///   `<https://iam.googleapis.com/v1/roles/{ROLE_NAME}>`
2154    ///
2155    /// * [`projects.roles.get()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/get):
2156    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only
2157    ///   [custom
2158    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2159    ///   have been created at the project level. Example request URL:
2160    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
2161    ///
2162    /// * [`organizations.roles.get()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/get):
2163    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
2164    ///   returns only [custom
2165    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2166    ///   have been created at the organization level. Example request URL:
2167    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
2168    ///
2169    ///
2170    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2171    /// ID or organization ID.
2172    pub name: std::string::String,
2173
2174    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2175}
2176
2177impl GetRoleRequest {
2178    pub fn new() -> Self {
2179        std::default::Default::default()
2180    }
2181
2182    /// Sets the value of [name][crate::model::GetRoleRequest::name].
2183    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2184        self.name = v.into();
2185        self
2186    }
2187}
2188
2189impl wkt::message::Message for GetRoleRequest {
2190    fn typename() -> &'static str {
2191        "type.googleapis.com/google.iam.admin.v1.GetRoleRequest"
2192    }
2193}
2194
2195/// The request to create a new role.
2196#[derive(Clone, Default, PartialEq)]
2197#[non_exhaustive]
2198pub struct CreateRoleRequest {
2199    /// The `parent` parameter's value depends on the target resource for the
2200    /// request, namely
2201    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
2202    /// or
2203    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
2204    /// Each resource type's `parent` value format is described below:
2205    ///
2206    /// * [`projects.roles.create()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/create):
2207    ///   `projects/{PROJECT_ID}`. This method creates project-level
2208    ///   [custom
2209    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
2210    ///   Example request URL:
2211    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles>`
2212    ///
2213    /// * [`organizations.roles.create()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/create):
2214    ///   `organizations/{ORGANIZATION_ID}`. This method creates organization-level
2215    ///   [custom
2216    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
2217    ///   Example request URL:
2218    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles>`
2219    ///
2220    ///
2221    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2222    /// ID or organization ID.
2223    pub parent: std::string::String,
2224
2225    /// The role ID to use for this role.
2226    ///
2227    /// A role ID may contain alphanumeric characters, underscores (`_`), and
2228    /// periods (`.`). It must contain a minimum of 3 characters and a maximum of
2229    /// 64 characters.
2230    pub role_id: std::string::String,
2231
2232    /// The Role resource to create.
2233    pub role: std::option::Option<crate::model::Role>,
2234
2235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2236}
2237
2238impl CreateRoleRequest {
2239    pub fn new() -> Self {
2240        std::default::Default::default()
2241    }
2242
2243    /// Sets the value of [parent][crate::model::CreateRoleRequest::parent].
2244    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2245        self.parent = v.into();
2246        self
2247    }
2248
2249    /// Sets the value of [role_id][crate::model::CreateRoleRequest::role_id].
2250    pub fn set_role_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2251        self.role_id = v.into();
2252        self
2253    }
2254
2255    /// Sets the value of [role][crate::model::CreateRoleRequest::role].
2256    pub fn set_role<T>(mut self, v: T) -> Self
2257    where
2258        T: std::convert::Into<crate::model::Role>,
2259    {
2260        self.role = std::option::Option::Some(v.into());
2261        self
2262    }
2263
2264    /// Sets or clears the value of [role][crate::model::CreateRoleRequest::role].
2265    pub fn set_or_clear_role<T>(mut self, v: std::option::Option<T>) -> Self
2266    where
2267        T: std::convert::Into<crate::model::Role>,
2268    {
2269        self.role = v.map(|x| x.into());
2270        self
2271    }
2272}
2273
2274impl wkt::message::Message for CreateRoleRequest {
2275    fn typename() -> &'static str {
2276        "type.googleapis.com/google.iam.admin.v1.CreateRoleRequest"
2277    }
2278}
2279
2280/// The request to update a role.
2281#[derive(Clone, Default, PartialEq)]
2282#[non_exhaustive]
2283pub struct UpdateRoleRequest {
2284    /// The `name` parameter's value depends on the target resource for the
2285    /// request, namely
2286    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
2287    /// or
2288    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
2289    /// Each resource type's `name` value format is described below:
2290    ///
2291    /// * [`projects.roles.patch()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/patch):
2292    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only
2293    ///   [custom
2294    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2295    ///   have been created at the project level. Example request URL:
2296    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
2297    ///
2298    /// * [`organizations.roles.patch()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/patch):
2299    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
2300    ///   updates only [custom
2301    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2302    ///   have been created at the organization level. Example request URL:
2303    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
2304    ///
2305    ///
2306    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2307    /// ID or organization ID.
2308    pub name: std::string::String,
2309
2310    /// The updated role.
2311    pub role: std::option::Option<crate::model::Role>,
2312
2313    /// A mask describing which fields in the Role have changed.
2314    pub update_mask: std::option::Option<wkt::FieldMask>,
2315
2316    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2317}
2318
2319impl UpdateRoleRequest {
2320    pub fn new() -> Self {
2321        std::default::Default::default()
2322    }
2323
2324    /// Sets the value of [name][crate::model::UpdateRoleRequest::name].
2325    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2326        self.name = v.into();
2327        self
2328    }
2329
2330    /// Sets the value of [role][crate::model::UpdateRoleRequest::role].
2331    pub fn set_role<T>(mut self, v: T) -> Self
2332    where
2333        T: std::convert::Into<crate::model::Role>,
2334    {
2335        self.role = std::option::Option::Some(v.into());
2336        self
2337    }
2338
2339    /// Sets or clears the value of [role][crate::model::UpdateRoleRequest::role].
2340    pub fn set_or_clear_role<T>(mut self, v: std::option::Option<T>) -> Self
2341    where
2342        T: std::convert::Into<crate::model::Role>,
2343    {
2344        self.role = v.map(|x| x.into());
2345        self
2346    }
2347
2348    /// Sets the value of [update_mask][crate::model::UpdateRoleRequest::update_mask].
2349    pub fn set_update_mask<T>(mut self, v: T) -> Self
2350    where
2351        T: std::convert::Into<wkt::FieldMask>,
2352    {
2353        self.update_mask = std::option::Option::Some(v.into());
2354        self
2355    }
2356
2357    /// Sets or clears the value of [update_mask][crate::model::UpdateRoleRequest::update_mask].
2358    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2359    where
2360        T: std::convert::Into<wkt::FieldMask>,
2361    {
2362        self.update_mask = v.map(|x| x.into());
2363        self
2364    }
2365}
2366
2367impl wkt::message::Message for UpdateRoleRequest {
2368    fn typename() -> &'static str {
2369        "type.googleapis.com/google.iam.admin.v1.UpdateRoleRequest"
2370    }
2371}
2372
2373/// The request to delete an existing role.
2374#[derive(Clone, Default, PartialEq)]
2375#[non_exhaustive]
2376pub struct DeleteRoleRequest {
2377    /// The `name` parameter's value depends on the target resource for the
2378    /// request, namely
2379    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
2380    /// or
2381    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
2382    /// Each resource type's `name` value format is described below:
2383    ///
2384    /// * [`projects.roles.delete()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/delete):
2385    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only
2386    ///   [custom
2387    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2388    ///   have been created at the project level. Example request URL:
2389    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
2390    ///
2391    /// * [`organizations.roles.delete()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/delete):
2392    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
2393    ///   deletes only [custom
2394    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2395    ///   have been created at the organization level. Example request URL:
2396    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
2397    ///
2398    ///
2399    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2400    /// ID or organization ID.
2401    pub name: std::string::String,
2402
2403    /// Used to perform a consistent read-modify-write.
2404    pub etag: ::bytes::Bytes,
2405
2406    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2407}
2408
2409impl DeleteRoleRequest {
2410    pub fn new() -> Self {
2411        std::default::Default::default()
2412    }
2413
2414    /// Sets the value of [name][crate::model::DeleteRoleRequest::name].
2415    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2416        self.name = v.into();
2417        self
2418    }
2419
2420    /// Sets the value of [etag][crate::model::DeleteRoleRequest::etag].
2421    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2422        self.etag = v.into();
2423        self
2424    }
2425}
2426
2427impl wkt::message::Message for DeleteRoleRequest {
2428    fn typename() -> &'static str {
2429        "type.googleapis.com/google.iam.admin.v1.DeleteRoleRequest"
2430    }
2431}
2432
2433/// The request to undelete an existing role.
2434#[derive(Clone, Default, PartialEq)]
2435#[non_exhaustive]
2436pub struct UndeleteRoleRequest {
2437    /// The `name` parameter's value depends on the target resource for the
2438    /// request, namely
2439    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
2440    /// or
2441    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
2442    /// Each resource type's `name` value format is described below:
2443    ///
2444    /// * [`projects.roles.undelete()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/undelete):
2445    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes
2446    ///   only [custom
2447    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2448    ///   have been created at the project level. Example request URL:
2449    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
2450    ///
2451    /// * [`organizations.roles.undelete()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/undelete):
2452    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
2453    ///   undeletes only [custom
2454    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
2455    ///   have been created at the organization level. Example request URL:
2456    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
2457    ///
2458    ///
2459    /// Note: Wildcard (*) values are invalid; you must specify a complete project
2460    /// ID or organization ID.
2461    pub name: std::string::String,
2462
2463    /// Used to perform a consistent read-modify-write.
2464    pub etag: ::bytes::Bytes,
2465
2466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2467}
2468
2469impl UndeleteRoleRequest {
2470    pub fn new() -> Self {
2471        std::default::Default::default()
2472    }
2473
2474    /// Sets the value of [name][crate::model::UndeleteRoleRequest::name].
2475    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2476        self.name = v.into();
2477        self
2478    }
2479
2480    /// Sets the value of [etag][crate::model::UndeleteRoleRequest::etag].
2481    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2482        self.etag = v.into();
2483        self
2484    }
2485}
2486
2487impl wkt::message::Message for UndeleteRoleRequest {
2488    fn typename() -> &'static str {
2489        "type.googleapis.com/google.iam.admin.v1.UndeleteRoleRequest"
2490    }
2491}
2492
2493/// A permission which can be included by a role.
2494#[derive(Clone, Default, PartialEq)]
2495#[non_exhaustive]
2496pub struct Permission {
2497    /// The name of this Permission.
2498    pub name: std::string::String,
2499
2500    /// The title of this Permission.
2501    pub title: std::string::String,
2502
2503    /// A brief description of what this Permission is used for.
2504    /// This permission can ONLY be used in predefined roles.
2505    pub description: std::string::String,
2506
2507    #[deprecated]
2508    pub only_in_predefined_roles: bool,
2509
2510    /// The current launch stage of the permission.
2511    pub stage: crate::model::permission::PermissionLaunchStage,
2512
2513    /// The current custom role support level.
2514    pub custom_roles_support_level: crate::model::permission::CustomRolesSupportLevel,
2515
2516    /// The service API associated with the permission is not enabled.
2517    pub api_disabled: bool,
2518
2519    /// The preferred name for this permission. If present, then this permission is
2520    /// an alias of, and equivalent to, the listed primary_permission.
2521    pub primary_permission: std::string::String,
2522
2523    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2524}
2525
2526impl Permission {
2527    pub fn new() -> Self {
2528        std::default::Default::default()
2529    }
2530
2531    /// Sets the value of [name][crate::model::Permission::name].
2532    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2533        self.name = v.into();
2534        self
2535    }
2536
2537    /// Sets the value of [title][crate::model::Permission::title].
2538    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2539        self.title = v.into();
2540        self
2541    }
2542
2543    /// Sets the value of [description][crate::model::Permission::description].
2544    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2545        self.description = v.into();
2546        self
2547    }
2548
2549    /// Sets the value of [only_in_predefined_roles][crate::model::Permission::only_in_predefined_roles].
2550    #[deprecated]
2551    pub fn set_only_in_predefined_roles<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2552        self.only_in_predefined_roles = v.into();
2553        self
2554    }
2555
2556    /// Sets the value of [stage][crate::model::Permission::stage].
2557    pub fn set_stage<T: std::convert::Into<crate::model::permission::PermissionLaunchStage>>(
2558        mut self,
2559        v: T,
2560    ) -> Self {
2561        self.stage = v.into();
2562        self
2563    }
2564
2565    /// Sets the value of [custom_roles_support_level][crate::model::Permission::custom_roles_support_level].
2566    pub fn set_custom_roles_support_level<
2567        T: std::convert::Into<crate::model::permission::CustomRolesSupportLevel>,
2568    >(
2569        mut self,
2570        v: T,
2571    ) -> Self {
2572        self.custom_roles_support_level = v.into();
2573        self
2574    }
2575
2576    /// Sets the value of [api_disabled][crate::model::Permission::api_disabled].
2577    pub fn set_api_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2578        self.api_disabled = v.into();
2579        self
2580    }
2581
2582    /// Sets the value of [primary_permission][crate::model::Permission::primary_permission].
2583    pub fn set_primary_permission<T: std::convert::Into<std::string::String>>(
2584        mut self,
2585        v: T,
2586    ) -> Self {
2587        self.primary_permission = v.into();
2588        self
2589    }
2590}
2591
2592impl wkt::message::Message for Permission {
2593    fn typename() -> &'static str {
2594        "type.googleapis.com/google.iam.admin.v1.Permission"
2595    }
2596}
2597
2598/// Defines additional types related to [Permission].
2599pub mod permission {
2600    #[allow(unused_imports)]
2601    use super::*;
2602
2603    /// A stage representing a permission's lifecycle phase.
2604    ///
2605    /// # Working with unknown values
2606    ///
2607    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2608    /// additional enum variants at any time. Adding new variants is not considered
2609    /// a breaking change. Applications should write their code in anticipation of:
2610    ///
2611    /// - New values appearing in future releases of the client library, **and**
2612    /// - New values received dynamically, without application changes.
2613    ///
2614    /// Please consult the [Working with enums] section in the user guide for some
2615    /// guidelines.
2616    ///
2617    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2618    #[derive(Clone, Debug, PartialEq)]
2619    #[non_exhaustive]
2620    pub enum PermissionLaunchStage {
2621        /// The permission is currently in an alpha phase.
2622        Alpha,
2623        /// The permission is currently in a beta phase.
2624        Beta,
2625        /// The permission is generally available.
2626        Ga,
2627        /// The permission is being deprecated.
2628        Deprecated,
2629        /// If set, the enum was initialized with an unknown value.
2630        ///
2631        /// Applications can examine the value using [PermissionLaunchStage::value] or
2632        /// [PermissionLaunchStage::name].
2633        UnknownValue(permission_launch_stage::UnknownValue),
2634    }
2635
2636    #[doc(hidden)]
2637    pub mod permission_launch_stage {
2638        #[allow(unused_imports)]
2639        use super::*;
2640        #[derive(Clone, Debug, PartialEq)]
2641        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2642    }
2643
2644    impl PermissionLaunchStage {
2645        /// Gets the enum value.
2646        ///
2647        /// Returns `None` if the enum contains an unknown value deserialized from
2648        /// the string representation of enums.
2649        pub fn value(&self) -> std::option::Option<i32> {
2650            match self {
2651                Self::Alpha => std::option::Option::Some(0),
2652                Self::Beta => std::option::Option::Some(1),
2653                Self::Ga => std::option::Option::Some(2),
2654                Self::Deprecated => std::option::Option::Some(3),
2655                Self::UnknownValue(u) => u.0.value(),
2656            }
2657        }
2658
2659        /// Gets the enum value as a string.
2660        ///
2661        /// Returns `None` if the enum contains an unknown value deserialized from
2662        /// the integer representation of enums.
2663        pub fn name(&self) -> std::option::Option<&str> {
2664            match self {
2665                Self::Alpha => std::option::Option::Some("ALPHA"),
2666                Self::Beta => std::option::Option::Some("BETA"),
2667                Self::Ga => std::option::Option::Some("GA"),
2668                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
2669                Self::UnknownValue(u) => u.0.name(),
2670            }
2671        }
2672    }
2673
2674    impl std::default::Default for PermissionLaunchStage {
2675        fn default() -> Self {
2676            use std::convert::From;
2677            Self::from(0)
2678        }
2679    }
2680
2681    impl std::fmt::Display for PermissionLaunchStage {
2682        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2683            wkt::internal::display_enum(f, self.name(), self.value())
2684        }
2685    }
2686
2687    impl std::convert::From<i32> for PermissionLaunchStage {
2688        fn from(value: i32) -> Self {
2689            match value {
2690                0 => Self::Alpha,
2691                1 => Self::Beta,
2692                2 => Self::Ga,
2693                3 => Self::Deprecated,
2694                _ => Self::UnknownValue(permission_launch_stage::UnknownValue(
2695                    wkt::internal::UnknownEnumValue::Integer(value),
2696                )),
2697            }
2698        }
2699    }
2700
2701    impl std::convert::From<&str> for PermissionLaunchStage {
2702        fn from(value: &str) -> Self {
2703            use std::string::ToString;
2704            match value {
2705                "ALPHA" => Self::Alpha,
2706                "BETA" => Self::Beta,
2707                "GA" => Self::Ga,
2708                "DEPRECATED" => Self::Deprecated,
2709                _ => Self::UnknownValue(permission_launch_stage::UnknownValue(
2710                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2711                )),
2712            }
2713        }
2714    }
2715
2716    impl serde::ser::Serialize for PermissionLaunchStage {
2717        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2718        where
2719            S: serde::Serializer,
2720        {
2721            match self {
2722                Self::Alpha => serializer.serialize_i32(0),
2723                Self::Beta => serializer.serialize_i32(1),
2724                Self::Ga => serializer.serialize_i32(2),
2725                Self::Deprecated => serializer.serialize_i32(3),
2726                Self::UnknownValue(u) => u.0.serialize(serializer),
2727            }
2728        }
2729    }
2730
2731    impl<'de> serde::de::Deserialize<'de> for PermissionLaunchStage {
2732        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2733        where
2734            D: serde::Deserializer<'de>,
2735        {
2736            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PermissionLaunchStage>::new(
2737                ".google.iam.admin.v1.Permission.PermissionLaunchStage",
2738            ))
2739        }
2740    }
2741
2742    /// The state of the permission with regards to custom roles.
2743    ///
2744    /// # Working with unknown values
2745    ///
2746    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2747    /// additional enum variants at any time. Adding new variants is not considered
2748    /// a breaking change. Applications should write their code in anticipation of:
2749    ///
2750    /// - New values appearing in future releases of the client library, **and**
2751    /// - New values received dynamically, without application changes.
2752    ///
2753    /// Please consult the [Working with enums] section in the user guide for some
2754    /// guidelines.
2755    ///
2756    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2757    #[derive(Clone, Debug, PartialEq)]
2758    #[non_exhaustive]
2759    pub enum CustomRolesSupportLevel {
2760        /// Default state. Permission is fully supported for custom role use.
2761        Supported,
2762        /// Permission is being tested to check custom role compatibility.
2763        Testing,
2764        /// Permission is not supported for custom role use.
2765        NotSupported,
2766        /// If set, the enum was initialized with an unknown value.
2767        ///
2768        /// Applications can examine the value using [CustomRolesSupportLevel::value] or
2769        /// [CustomRolesSupportLevel::name].
2770        UnknownValue(custom_roles_support_level::UnknownValue),
2771    }
2772
2773    #[doc(hidden)]
2774    pub mod custom_roles_support_level {
2775        #[allow(unused_imports)]
2776        use super::*;
2777        #[derive(Clone, Debug, PartialEq)]
2778        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2779    }
2780
2781    impl CustomRolesSupportLevel {
2782        /// Gets the enum value.
2783        ///
2784        /// Returns `None` if the enum contains an unknown value deserialized from
2785        /// the string representation of enums.
2786        pub fn value(&self) -> std::option::Option<i32> {
2787            match self {
2788                Self::Supported => std::option::Option::Some(0),
2789                Self::Testing => std::option::Option::Some(1),
2790                Self::NotSupported => std::option::Option::Some(2),
2791                Self::UnknownValue(u) => u.0.value(),
2792            }
2793        }
2794
2795        /// Gets the enum value as a string.
2796        ///
2797        /// Returns `None` if the enum contains an unknown value deserialized from
2798        /// the integer representation of enums.
2799        pub fn name(&self) -> std::option::Option<&str> {
2800            match self {
2801                Self::Supported => std::option::Option::Some("SUPPORTED"),
2802                Self::Testing => std::option::Option::Some("TESTING"),
2803                Self::NotSupported => std::option::Option::Some("NOT_SUPPORTED"),
2804                Self::UnknownValue(u) => u.0.name(),
2805            }
2806        }
2807    }
2808
2809    impl std::default::Default for CustomRolesSupportLevel {
2810        fn default() -> Self {
2811            use std::convert::From;
2812            Self::from(0)
2813        }
2814    }
2815
2816    impl std::fmt::Display for CustomRolesSupportLevel {
2817        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2818            wkt::internal::display_enum(f, self.name(), self.value())
2819        }
2820    }
2821
2822    impl std::convert::From<i32> for CustomRolesSupportLevel {
2823        fn from(value: i32) -> Self {
2824            match value {
2825                0 => Self::Supported,
2826                1 => Self::Testing,
2827                2 => Self::NotSupported,
2828                _ => Self::UnknownValue(custom_roles_support_level::UnknownValue(
2829                    wkt::internal::UnknownEnumValue::Integer(value),
2830                )),
2831            }
2832        }
2833    }
2834
2835    impl std::convert::From<&str> for CustomRolesSupportLevel {
2836        fn from(value: &str) -> Self {
2837            use std::string::ToString;
2838            match value {
2839                "SUPPORTED" => Self::Supported,
2840                "TESTING" => Self::Testing,
2841                "NOT_SUPPORTED" => Self::NotSupported,
2842                _ => Self::UnknownValue(custom_roles_support_level::UnknownValue(
2843                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2844                )),
2845            }
2846        }
2847    }
2848
2849    impl serde::ser::Serialize for CustomRolesSupportLevel {
2850        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2851        where
2852            S: serde::Serializer,
2853        {
2854            match self {
2855                Self::Supported => serializer.serialize_i32(0),
2856                Self::Testing => serializer.serialize_i32(1),
2857                Self::NotSupported => serializer.serialize_i32(2),
2858                Self::UnknownValue(u) => u.0.serialize(serializer),
2859            }
2860        }
2861    }
2862
2863    impl<'de> serde::de::Deserialize<'de> for CustomRolesSupportLevel {
2864        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2865        where
2866            D: serde::Deserializer<'de>,
2867        {
2868            deserializer.deserialize_any(
2869                wkt::internal::EnumVisitor::<CustomRolesSupportLevel>::new(
2870                    ".google.iam.admin.v1.Permission.CustomRolesSupportLevel",
2871                ),
2872            )
2873        }
2874    }
2875}
2876
2877/// A request to get permissions which can be tested on a resource.
2878#[derive(Clone, Default, PartialEq)]
2879#[non_exhaustive]
2880pub struct QueryTestablePermissionsRequest {
2881    /// Required. The full resource name to query from the list of testable
2882    /// permissions.
2883    ///
2884    /// The name follows the Google Cloud Platform resource format.
2885    /// For example, a Cloud Platform project with id `my-project` will be named
2886    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
2887    pub full_resource_name: std::string::String,
2888
2889    /// Optional limit on the number of permissions to include in the response.
2890    ///
2891    /// The default is 100, and the maximum is 1,000.
2892    pub page_size: i32,
2893
2894    /// Optional pagination token returned in an earlier
2895    /// QueryTestablePermissionsRequest.
2896    pub page_token: std::string::String,
2897
2898    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2899}
2900
2901impl QueryTestablePermissionsRequest {
2902    pub fn new() -> Self {
2903        std::default::Default::default()
2904    }
2905
2906    /// Sets the value of [full_resource_name][crate::model::QueryTestablePermissionsRequest::full_resource_name].
2907    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
2908        mut self,
2909        v: T,
2910    ) -> Self {
2911        self.full_resource_name = v.into();
2912        self
2913    }
2914
2915    /// Sets the value of [page_size][crate::model::QueryTestablePermissionsRequest::page_size].
2916    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2917        self.page_size = v.into();
2918        self
2919    }
2920
2921    /// Sets the value of [page_token][crate::model::QueryTestablePermissionsRequest::page_token].
2922    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2923        self.page_token = v.into();
2924        self
2925    }
2926}
2927
2928impl wkt::message::Message for QueryTestablePermissionsRequest {
2929    fn typename() -> &'static str {
2930        "type.googleapis.com/google.iam.admin.v1.QueryTestablePermissionsRequest"
2931    }
2932}
2933
2934/// The response containing permissions which can be tested on a resource.
2935#[derive(Clone, Default, PartialEq)]
2936#[non_exhaustive]
2937pub struct QueryTestablePermissionsResponse {
2938    /// The Permissions testable on the requested resource.
2939    pub permissions: std::vec::Vec<crate::model::Permission>,
2940
2941    /// To retrieve the next page of results, set
2942    /// `QueryTestableRolesRequest.page_token` to this value.
2943    pub next_page_token: std::string::String,
2944
2945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2946}
2947
2948impl QueryTestablePermissionsResponse {
2949    pub fn new() -> Self {
2950        std::default::Default::default()
2951    }
2952
2953    /// Sets the value of [permissions][crate::model::QueryTestablePermissionsResponse::permissions].
2954    pub fn set_permissions<T, V>(mut self, v: T) -> Self
2955    where
2956        T: std::iter::IntoIterator<Item = V>,
2957        V: std::convert::Into<crate::model::Permission>,
2958    {
2959        use std::iter::Iterator;
2960        self.permissions = v.into_iter().map(|i| i.into()).collect();
2961        self
2962    }
2963
2964    /// Sets the value of [next_page_token][crate::model::QueryTestablePermissionsResponse::next_page_token].
2965    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2966        self.next_page_token = v.into();
2967        self
2968    }
2969}
2970
2971impl wkt::message::Message for QueryTestablePermissionsResponse {
2972    fn typename() -> &'static str {
2973        "type.googleapis.com/google.iam.admin.v1.QueryTestablePermissionsResponse"
2974    }
2975}
2976
2977#[doc(hidden)]
2978impl gax::paginator::internal::PageableResponse for QueryTestablePermissionsResponse {
2979    type PageItem = crate::model::Permission;
2980
2981    fn items(self) -> std::vec::Vec<Self::PageItem> {
2982        self.permissions
2983    }
2984
2985    fn next_page_token(&self) -> std::string::String {
2986        use std::clone::Clone;
2987        self.next_page_token.clone()
2988    }
2989}
2990
2991/// A request to get the list of auditable services for a resource.
2992#[derive(Clone, Default, PartialEq)]
2993#[non_exhaustive]
2994pub struct QueryAuditableServicesRequest {
2995    /// Required. The full resource name to query from the list of auditable
2996    /// services.
2997    ///
2998    /// The name follows the Google Cloud Platform resource format.
2999    /// For example, a Cloud Platform project with id `my-project` will be named
3000    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
3001    pub full_resource_name: std::string::String,
3002
3003    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3004}
3005
3006impl QueryAuditableServicesRequest {
3007    pub fn new() -> Self {
3008        std::default::Default::default()
3009    }
3010
3011    /// Sets the value of [full_resource_name][crate::model::QueryAuditableServicesRequest::full_resource_name].
3012    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
3013        mut self,
3014        v: T,
3015    ) -> Self {
3016        self.full_resource_name = v.into();
3017        self
3018    }
3019}
3020
3021impl wkt::message::Message for QueryAuditableServicesRequest {
3022    fn typename() -> &'static str {
3023        "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesRequest"
3024    }
3025}
3026
3027/// A response containing a list of auditable services for a resource.
3028#[derive(Clone, Default, PartialEq)]
3029#[non_exhaustive]
3030pub struct QueryAuditableServicesResponse {
3031    /// The auditable services for a resource.
3032    pub services: std::vec::Vec<crate::model::query_auditable_services_response::AuditableService>,
3033
3034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3035}
3036
3037impl QueryAuditableServicesResponse {
3038    pub fn new() -> Self {
3039        std::default::Default::default()
3040    }
3041
3042    /// Sets the value of [services][crate::model::QueryAuditableServicesResponse::services].
3043    pub fn set_services<T, V>(mut self, v: T) -> Self
3044    where
3045        T: std::iter::IntoIterator<Item = V>,
3046        V: std::convert::Into<crate::model::query_auditable_services_response::AuditableService>,
3047    {
3048        use std::iter::Iterator;
3049        self.services = v.into_iter().map(|i| i.into()).collect();
3050        self
3051    }
3052}
3053
3054impl wkt::message::Message for QueryAuditableServicesResponse {
3055    fn typename() -> &'static str {
3056        "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesResponse"
3057    }
3058}
3059
3060/// Defines additional types related to [QueryAuditableServicesResponse].
3061pub mod query_auditable_services_response {
3062    #[allow(unused_imports)]
3063    use super::*;
3064
3065    /// Contains information about an auditable service.
3066    #[derive(Clone, Default, PartialEq)]
3067    #[non_exhaustive]
3068    pub struct AuditableService {
3069        /// Public name of the service.
3070        /// For example, the service name for Cloud IAM is 'iam.googleapis.com'.
3071        pub name: std::string::String,
3072
3073        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3074    }
3075
3076    impl AuditableService {
3077        pub fn new() -> Self {
3078            std::default::Default::default()
3079        }
3080
3081        /// Sets the value of [name][crate::model::query_auditable_services_response::AuditableService::name].
3082        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3083            self.name = v.into();
3084            self
3085        }
3086    }
3087
3088    impl wkt::message::Message for AuditableService {
3089        fn typename() -> &'static str {
3090            "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesResponse.AuditableService"
3091        }
3092    }
3093}
3094
3095/// The request to lint a Cloud IAM policy object.
3096#[derive(Clone, Default, PartialEq)]
3097#[non_exhaustive]
3098pub struct LintPolicyRequest {
3099    /// The full resource name of the policy this lint request is about.
3100    ///
3101    /// The name follows the Google Cloud Platform (GCP) resource format.
3102    /// For example, a GCP project with ID `my-project` will be named
3103    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
3104    ///
3105    /// The resource name is not used to read the policy instance from the Cloud
3106    /// IAM database. The candidate policy for lint has to be provided in the same
3107    /// request object.
3108    pub full_resource_name: std::string::String,
3109
3110    /// Required. The Cloud IAM object to be linted.
3111    pub lint_object: std::option::Option<crate::model::lint_policy_request::LintObject>,
3112
3113    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3114}
3115
3116impl LintPolicyRequest {
3117    pub fn new() -> Self {
3118        std::default::Default::default()
3119    }
3120
3121    /// Sets the value of [full_resource_name][crate::model::LintPolicyRequest::full_resource_name].
3122    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
3123        mut self,
3124        v: T,
3125    ) -> Self {
3126        self.full_resource_name = v.into();
3127        self
3128    }
3129
3130    /// Sets the value of [lint_object][crate::model::LintPolicyRequest::lint_object].
3131    ///
3132    /// Note that all the setters affecting `lint_object` are mutually
3133    /// exclusive.
3134    pub fn set_lint_object<
3135        T: std::convert::Into<std::option::Option<crate::model::lint_policy_request::LintObject>>,
3136    >(
3137        mut self,
3138        v: T,
3139    ) -> Self {
3140        self.lint_object = v.into();
3141        self
3142    }
3143
3144    /// The value of [lint_object][crate::model::LintPolicyRequest::lint_object]
3145    /// if it holds a `Condition`, `None` if the field is not set or
3146    /// holds a different branch.
3147    pub fn condition(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Expr>> {
3148        #[allow(unreachable_patterns)]
3149        self.lint_object.as_ref().and_then(|v| match v {
3150            crate::model::lint_policy_request::LintObject::Condition(v) => {
3151                std::option::Option::Some(v)
3152            }
3153            _ => std::option::Option::None,
3154        })
3155    }
3156
3157    /// Sets the value of [lint_object][crate::model::LintPolicyRequest::lint_object]
3158    /// to hold a `Condition`.
3159    ///
3160    /// Note that all the setters affecting `lint_object` are
3161    /// mutually exclusive.
3162    pub fn set_condition<T: std::convert::Into<std::boxed::Box<gtype::model::Expr>>>(
3163        mut self,
3164        v: T,
3165    ) -> Self {
3166        self.lint_object = std::option::Option::Some(
3167            crate::model::lint_policy_request::LintObject::Condition(v.into()),
3168        );
3169        self
3170    }
3171}
3172
3173impl wkt::message::Message for LintPolicyRequest {
3174    fn typename() -> &'static str {
3175        "type.googleapis.com/google.iam.admin.v1.LintPolicyRequest"
3176    }
3177}
3178
3179/// Defines additional types related to [LintPolicyRequest].
3180pub mod lint_policy_request {
3181    #[allow(unused_imports)]
3182    use super::*;
3183
3184    /// Required. The Cloud IAM object to be linted.
3185    #[derive(Clone, Debug, PartialEq)]
3186    #[non_exhaustive]
3187    pub enum LintObject {
3188        /// [google.iam.v1.Binding.condition] [google.iam.v1.Binding.condition] object to be linted.
3189        Condition(std::boxed::Box<gtype::model::Expr>),
3190    }
3191}
3192
3193/// Structured response of a single validation unit.
3194#[derive(Clone, Default, PartialEq)]
3195#[non_exhaustive]
3196pub struct LintResult {
3197    /// The validation unit level.
3198    pub level: crate::model::lint_result::Level,
3199
3200    /// The validation unit name, for instance
3201    /// "lintValidationUnits/ConditionComplexityCheck".
3202    pub validation_unit_name: std::string::String,
3203
3204    /// The validation unit severity.
3205    pub severity: crate::model::lint_result::Severity,
3206
3207    /// The name of the field for which this lint result is about.
3208    ///
3209    /// For nested messages `field_name` consists of names of the embedded fields
3210    /// separated by period character. The top-level qualifier is the input object
3211    /// to lint in the request. For example, the `field_name` value
3212    /// `condition.expression` identifies a lint result for the `expression` field
3213    /// of the provided condition.
3214    pub field_name: std::string::String,
3215
3216    /// 0-based character position of problematic construct within the object
3217    /// identified by `field_name`. Currently, this is populated only for condition
3218    /// expression.
3219    pub location_offset: i32,
3220
3221    /// Human readable debug message associated with the issue.
3222    pub debug_message: std::string::String,
3223
3224    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3225}
3226
3227impl LintResult {
3228    pub fn new() -> Self {
3229        std::default::Default::default()
3230    }
3231
3232    /// Sets the value of [level][crate::model::LintResult::level].
3233    pub fn set_level<T: std::convert::Into<crate::model::lint_result::Level>>(
3234        mut self,
3235        v: T,
3236    ) -> Self {
3237        self.level = v.into();
3238        self
3239    }
3240
3241    /// Sets the value of [validation_unit_name][crate::model::LintResult::validation_unit_name].
3242    pub fn set_validation_unit_name<T: std::convert::Into<std::string::String>>(
3243        mut self,
3244        v: T,
3245    ) -> Self {
3246        self.validation_unit_name = v.into();
3247        self
3248    }
3249
3250    /// Sets the value of [severity][crate::model::LintResult::severity].
3251    pub fn set_severity<T: std::convert::Into<crate::model::lint_result::Severity>>(
3252        mut self,
3253        v: T,
3254    ) -> Self {
3255        self.severity = v.into();
3256        self
3257    }
3258
3259    /// Sets the value of [field_name][crate::model::LintResult::field_name].
3260    pub fn set_field_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3261        self.field_name = v.into();
3262        self
3263    }
3264
3265    /// Sets the value of [location_offset][crate::model::LintResult::location_offset].
3266    pub fn set_location_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3267        self.location_offset = v.into();
3268        self
3269    }
3270
3271    /// Sets the value of [debug_message][crate::model::LintResult::debug_message].
3272    pub fn set_debug_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3273        self.debug_message = v.into();
3274        self
3275    }
3276}
3277
3278impl wkt::message::Message for LintResult {
3279    fn typename() -> &'static str {
3280        "type.googleapis.com/google.iam.admin.v1.LintResult"
3281    }
3282}
3283
3284/// Defines additional types related to [LintResult].
3285pub mod lint_result {
3286    #[allow(unused_imports)]
3287    use super::*;
3288
3289    /// Possible Level values of a validation unit corresponding to its domain
3290    /// of discourse.
3291    ///
3292    /// # Working with unknown values
3293    ///
3294    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3295    /// additional enum variants at any time. Adding new variants is not considered
3296    /// a breaking change. Applications should write their code in anticipation of:
3297    ///
3298    /// - New values appearing in future releases of the client library, **and**
3299    /// - New values received dynamically, without application changes.
3300    ///
3301    /// Please consult the [Working with enums] section in the user guide for some
3302    /// guidelines.
3303    ///
3304    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3305    #[derive(Clone, Debug, PartialEq)]
3306    #[non_exhaustive]
3307    pub enum Level {
3308        /// Level is unspecified.
3309        Unspecified,
3310        /// A validation unit which operates on an individual condition within a
3311        /// binding.
3312        Condition,
3313        /// If set, the enum was initialized with an unknown value.
3314        ///
3315        /// Applications can examine the value using [Level::value] or
3316        /// [Level::name].
3317        UnknownValue(level::UnknownValue),
3318    }
3319
3320    #[doc(hidden)]
3321    pub mod level {
3322        #[allow(unused_imports)]
3323        use super::*;
3324        #[derive(Clone, Debug, PartialEq)]
3325        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3326    }
3327
3328    impl Level {
3329        /// Gets the enum value.
3330        ///
3331        /// Returns `None` if the enum contains an unknown value deserialized from
3332        /// the string representation of enums.
3333        pub fn value(&self) -> std::option::Option<i32> {
3334            match self {
3335                Self::Unspecified => std::option::Option::Some(0),
3336                Self::Condition => std::option::Option::Some(3),
3337                Self::UnknownValue(u) => u.0.value(),
3338            }
3339        }
3340
3341        /// Gets the enum value as a string.
3342        ///
3343        /// Returns `None` if the enum contains an unknown value deserialized from
3344        /// the integer representation of enums.
3345        pub fn name(&self) -> std::option::Option<&str> {
3346            match self {
3347                Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
3348                Self::Condition => std::option::Option::Some("CONDITION"),
3349                Self::UnknownValue(u) => u.0.name(),
3350            }
3351        }
3352    }
3353
3354    impl std::default::Default for Level {
3355        fn default() -> Self {
3356            use std::convert::From;
3357            Self::from(0)
3358        }
3359    }
3360
3361    impl std::fmt::Display for Level {
3362        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3363            wkt::internal::display_enum(f, self.name(), self.value())
3364        }
3365    }
3366
3367    impl std::convert::From<i32> for Level {
3368        fn from(value: i32) -> Self {
3369            match value {
3370                0 => Self::Unspecified,
3371                3 => Self::Condition,
3372                _ => Self::UnknownValue(level::UnknownValue(
3373                    wkt::internal::UnknownEnumValue::Integer(value),
3374                )),
3375            }
3376        }
3377    }
3378
3379    impl std::convert::From<&str> for Level {
3380        fn from(value: &str) -> Self {
3381            use std::string::ToString;
3382            match value {
3383                "LEVEL_UNSPECIFIED" => Self::Unspecified,
3384                "CONDITION" => Self::Condition,
3385                _ => Self::UnknownValue(level::UnknownValue(
3386                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3387                )),
3388            }
3389        }
3390    }
3391
3392    impl serde::ser::Serialize for Level {
3393        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3394        where
3395            S: serde::Serializer,
3396        {
3397            match self {
3398                Self::Unspecified => serializer.serialize_i32(0),
3399                Self::Condition => serializer.serialize_i32(3),
3400                Self::UnknownValue(u) => u.0.serialize(serializer),
3401            }
3402        }
3403    }
3404
3405    impl<'de> serde::de::Deserialize<'de> for Level {
3406        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3407        where
3408            D: serde::Deserializer<'de>,
3409        {
3410            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
3411                ".google.iam.admin.v1.LintResult.Level",
3412            ))
3413        }
3414    }
3415
3416    /// Possible Severity values of an issued result.
3417    ///
3418    /// # Working with unknown values
3419    ///
3420    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3421    /// additional enum variants at any time. Adding new variants is not considered
3422    /// a breaking change. Applications should write their code in anticipation of:
3423    ///
3424    /// - New values appearing in future releases of the client library, **and**
3425    /// - New values received dynamically, without application changes.
3426    ///
3427    /// Please consult the [Working with enums] section in the user guide for some
3428    /// guidelines.
3429    ///
3430    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3431    #[derive(Clone, Debug, PartialEq)]
3432    #[non_exhaustive]
3433    pub enum Severity {
3434        /// Severity is unspecified.
3435        Unspecified,
3436        /// A validation unit returns an error only for critical issues. If an
3437        /// attempt is made to set the problematic policy without rectifying the
3438        /// critical issue, it causes the `setPolicy` operation to fail.
3439        Error,
3440        /// Any issue which is severe enough but does not cause an error.
3441        /// For example, suspicious constructs in the input object will not
3442        /// necessarily fail `setPolicy`, but there is a high likelihood that they
3443        /// won't behave as expected during policy evaluation in `checkPolicy`.
3444        /// This includes the following common scenarios:
3445        ///
3446        /// - Unsatisfiable condition: Expired timestamp in date/time condition.
3447        /// - Ineffective condition: Condition on a <principal, role> pair which is
3448        ///   granted unconditionally in another binding of the same policy.
3449        Warning,
3450        /// Reserved for the issues that are not severe as `ERROR`/`WARNING`, but
3451        /// need special handling. For instance, messages about skipped validation
3452        /// units are issued as `NOTICE`.
3453        Notice,
3454        /// Any informative statement which is not severe enough to raise
3455        /// `ERROR`/`WARNING`/`NOTICE`, like auto-correction recommendations on the
3456        /// input content. Note that current version of the linter does not utilize
3457        /// `INFO`.
3458        Info,
3459        /// Deprecated severity level.
3460        Deprecated,
3461        /// If set, the enum was initialized with an unknown value.
3462        ///
3463        /// Applications can examine the value using [Severity::value] or
3464        /// [Severity::name].
3465        UnknownValue(severity::UnknownValue),
3466    }
3467
3468    #[doc(hidden)]
3469    pub mod severity {
3470        #[allow(unused_imports)]
3471        use super::*;
3472        #[derive(Clone, Debug, PartialEq)]
3473        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3474    }
3475
3476    impl Severity {
3477        /// Gets the enum value.
3478        ///
3479        /// Returns `None` if the enum contains an unknown value deserialized from
3480        /// the string representation of enums.
3481        pub fn value(&self) -> std::option::Option<i32> {
3482            match self {
3483                Self::Unspecified => std::option::Option::Some(0),
3484                Self::Error => std::option::Option::Some(1),
3485                Self::Warning => std::option::Option::Some(2),
3486                Self::Notice => std::option::Option::Some(3),
3487                Self::Info => std::option::Option::Some(4),
3488                Self::Deprecated => std::option::Option::Some(5),
3489                Self::UnknownValue(u) => u.0.value(),
3490            }
3491        }
3492
3493        /// Gets the enum value as a string.
3494        ///
3495        /// Returns `None` if the enum contains an unknown value deserialized from
3496        /// the integer representation of enums.
3497        pub fn name(&self) -> std::option::Option<&str> {
3498            match self {
3499                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
3500                Self::Error => std::option::Option::Some("ERROR"),
3501                Self::Warning => std::option::Option::Some("WARNING"),
3502                Self::Notice => std::option::Option::Some("NOTICE"),
3503                Self::Info => std::option::Option::Some("INFO"),
3504                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
3505                Self::UnknownValue(u) => u.0.name(),
3506            }
3507        }
3508    }
3509
3510    impl std::default::Default for Severity {
3511        fn default() -> Self {
3512            use std::convert::From;
3513            Self::from(0)
3514        }
3515    }
3516
3517    impl std::fmt::Display for Severity {
3518        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3519            wkt::internal::display_enum(f, self.name(), self.value())
3520        }
3521    }
3522
3523    impl std::convert::From<i32> for Severity {
3524        fn from(value: i32) -> Self {
3525            match value {
3526                0 => Self::Unspecified,
3527                1 => Self::Error,
3528                2 => Self::Warning,
3529                3 => Self::Notice,
3530                4 => Self::Info,
3531                5 => Self::Deprecated,
3532                _ => Self::UnknownValue(severity::UnknownValue(
3533                    wkt::internal::UnknownEnumValue::Integer(value),
3534                )),
3535            }
3536        }
3537    }
3538
3539    impl std::convert::From<&str> for Severity {
3540        fn from(value: &str) -> Self {
3541            use std::string::ToString;
3542            match value {
3543                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
3544                "ERROR" => Self::Error,
3545                "WARNING" => Self::Warning,
3546                "NOTICE" => Self::Notice,
3547                "INFO" => Self::Info,
3548                "DEPRECATED" => Self::Deprecated,
3549                _ => Self::UnknownValue(severity::UnknownValue(
3550                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3551                )),
3552            }
3553        }
3554    }
3555
3556    impl serde::ser::Serialize for Severity {
3557        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3558        where
3559            S: serde::Serializer,
3560        {
3561            match self {
3562                Self::Unspecified => serializer.serialize_i32(0),
3563                Self::Error => serializer.serialize_i32(1),
3564                Self::Warning => serializer.serialize_i32(2),
3565                Self::Notice => serializer.serialize_i32(3),
3566                Self::Info => serializer.serialize_i32(4),
3567                Self::Deprecated => serializer.serialize_i32(5),
3568                Self::UnknownValue(u) => u.0.serialize(serializer),
3569            }
3570        }
3571    }
3572
3573    impl<'de> serde::de::Deserialize<'de> for Severity {
3574        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3575        where
3576            D: serde::Deserializer<'de>,
3577        {
3578            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
3579                ".google.iam.admin.v1.LintResult.Severity",
3580            ))
3581        }
3582    }
3583}
3584
3585/// The response of a lint operation. An empty response indicates
3586/// the operation was able to fully execute and no lint issue was found.
3587#[derive(Clone, Default, PartialEq)]
3588#[non_exhaustive]
3589pub struct LintPolicyResponse {
3590    /// List of lint results sorted by `severity` in descending order.
3591    pub lint_results: std::vec::Vec<crate::model::LintResult>,
3592
3593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3594}
3595
3596impl LintPolicyResponse {
3597    pub fn new() -> Self {
3598        std::default::Default::default()
3599    }
3600
3601    /// Sets the value of [lint_results][crate::model::LintPolicyResponse::lint_results].
3602    pub fn set_lint_results<T, V>(mut self, v: T) -> Self
3603    where
3604        T: std::iter::IntoIterator<Item = V>,
3605        V: std::convert::Into<crate::model::LintResult>,
3606    {
3607        use std::iter::Iterator;
3608        self.lint_results = v.into_iter().map(|i| i.into()).collect();
3609        self
3610    }
3611}
3612
3613impl wkt::message::Message for LintPolicyResponse {
3614    fn typename() -> &'static str {
3615        "type.googleapis.com/google.iam.admin.v1.LintPolicyResponse"
3616    }
3617}
3618
3619/// Supported key algorithms.
3620///
3621/// # Working with unknown values
3622///
3623/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3624/// additional enum variants at any time. Adding new variants is not considered
3625/// a breaking change. Applications should write their code in anticipation of:
3626///
3627/// - New values appearing in future releases of the client library, **and**
3628/// - New values received dynamically, without application changes.
3629///
3630/// Please consult the [Working with enums] section in the user guide for some
3631/// guidelines.
3632///
3633/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3634#[derive(Clone, Debug, PartialEq)]
3635#[non_exhaustive]
3636pub enum ServiceAccountKeyAlgorithm {
3637    /// An unspecified key algorithm.
3638    KeyAlgUnspecified,
3639    /// 1k RSA Key.
3640    KeyAlgRsa1024,
3641    /// 2k RSA Key.
3642    KeyAlgRsa2048,
3643    /// If set, the enum was initialized with an unknown value.
3644    ///
3645    /// Applications can examine the value using [ServiceAccountKeyAlgorithm::value] or
3646    /// [ServiceAccountKeyAlgorithm::name].
3647    UnknownValue(service_account_key_algorithm::UnknownValue),
3648}
3649
3650#[doc(hidden)]
3651pub mod service_account_key_algorithm {
3652    #[allow(unused_imports)]
3653    use super::*;
3654    #[derive(Clone, Debug, PartialEq)]
3655    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3656}
3657
3658impl ServiceAccountKeyAlgorithm {
3659    /// Gets the enum value.
3660    ///
3661    /// Returns `None` if the enum contains an unknown value deserialized from
3662    /// the string representation of enums.
3663    pub fn value(&self) -> std::option::Option<i32> {
3664        match self {
3665            Self::KeyAlgUnspecified => std::option::Option::Some(0),
3666            Self::KeyAlgRsa1024 => std::option::Option::Some(1),
3667            Self::KeyAlgRsa2048 => std::option::Option::Some(2),
3668            Self::UnknownValue(u) => u.0.value(),
3669        }
3670    }
3671
3672    /// Gets the enum value as a string.
3673    ///
3674    /// Returns `None` if the enum contains an unknown value deserialized from
3675    /// the integer representation of enums.
3676    pub fn name(&self) -> std::option::Option<&str> {
3677        match self {
3678            Self::KeyAlgUnspecified => std::option::Option::Some("KEY_ALG_UNSPECIFIED"),
3679            Self::KeyAlgRsa1024 => std::option::Option::Some("KEY_ALG_RSA_1024"),
3680            Self::KeyAlgRsa2048 => std::option::Option::Some("KEY_ALG_RSA_2048"),
3681            Self::UnknownValue(u) => u.0.name(),
3682        }
3683    }
3684}
3685
3686impl std::default::Default for ServiceAccountKeyAlgorithm {
3687    fn default() -> Self {
3688        use std::convert::From;
3689        Self::from(0)
3690    }
3691}
3692
3693impl std::fmt::Display for ServiceAccountKeyAlgorithm {
3694    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3695        wkt::internal::display_enum(f, self.name(), self.value())
3696    }
3697}
3698
3699impl std::convert::From<i32> for ServiceAccountKeyAlgorithm {
3700    fn from(value: i32) -> Self {
3701        match value {
3702            0 => Self::KeyAlgUnspecified,
3703            1 => Self::KeyAlgRsa1024,
3704            2 => Self::KeyAlgRsa2048,
3705            _ => Self::UnknownValue(service_account_key_algorithm::UnknownValue(
3706                wkt::internal::UnknownEnumValue::Integer(value),
3707            )),
3708        }
3709    }
3710}
3711
3712impl std::convert::From<&str> for ServiceAccountKeyAlgorithm {
3713    fn from(value: &str) -> Self {
3714        use std::string::ToString;
3715        match value {
3716            "KEY_ALG_UNSPECIFIED" => Self::KeyAlgUnspecified,
3717            "KEY_ALG_RSA_1024" => Self::KeyAlgRsa1024,
3718            "KEY_ALG_RSA_2048" => Self::KeyAlgRsa2048,
3719            _ => Self::UnknownValue(service_account_key_algorithm::UnknownValue(
3720                wkt::internal::UnknownEnumValue::String(value.to_string()),
3721            )),
3722        }
3723    }
3724}
3725
3726impl serde::ser::Serialize for ServiceAccountKeyAlgorithm {
3727    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3728    where
3729        S: serde::Serializer,
3730    {
3731        match self {
3732            Self::KeyAlgUnspecified => serializer.serialize_i32(0),
3733            Self::KeyAlgRsa1024 => serializer.serialize_i32(1),
3734            Self::KeyAlgRsa2048 => serializer.serialize_i32(2),
3735            Self::UnknownValue(u) => u.0.serialize(serializer),
3736        }
3737    }
3738}
3739
3740impl<'de> serde::de::Deserialize<'de> for ServiceAccountKeyAlgorithm {
3741    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3742    where
3743        D: serde::Deserializer<'de>,
3744    {
3745        deserializer.deserialize_any(
3746            wkt::internal::EnumVisitor::<ServiceAccountKeyAlgorithm>::new(
3747                ".google.iam.admin.v1.ServiceAccountKeyAlgorithm",
3748            ),
3749        )
3750    }
3751}
3752
3753/// Supported private key output formats.
3754///
3755/// # Working with unknown values
3756///
3757/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3758/// additional enum variants at any time. Adding new variants is not considered
3759/// a breaking change. Applications should write their code in anticipation of:
3760///
3761/// - New values appearing in future releases of the client library, **and**
3762/// - New values received dynamically, without application changes.
3763///
3764/// Please consult the [Working with enums] section in the user guide for some
3765/// guidelines.
3766///
3767/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3768#[derive(Clone, Debug, PartialEq)]
3769#[non_exhaustive]
3770pub enum ServiceAccountPrivateKeyType {
3771    /// Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`.
3772    TypeUnspecified,
3773    /// PKCS12 format.
3774    /// The password for the PKCS12 file is `notasecret`.
3775    /// For more information, see <https://tools.ietf.org/html/rfc7292>.
3776    TypePkcs12File,
3777    /// Google Credentials File format.
3778    TypeGoogleCredentialsFile,
3779    /// If set, the enum was initialized with an unknown value.
3780    ///
3781    /// Applications can examine the value using [ServiceAccountPrivateKeyType::value] or
3782    /// [ServiceAccountPrivateKeyType::name].
3783    UnknownValue(service_account_private_key_type::UnknownValue),
3784}
3785
3786#[doc(hidden)]
3787pub mod service_account_private_key_type {
3788    #[allow(unused_imports)]
3789    use super::*;
3790    #[derive(Clone, Debug, PartialEq)]
3791    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3792}
3793
3794impl ServiceAccountPrivateKeyType {
3795    /// Gets the enum value.
3796    ///
3797    /// Returns `None` if the enum contains an unknown value deserialized from
3798    /// the string representation of enums.
3799    pub fn value(&self) -> std::option::Option<i32> {
3800        match self {
3801            Self::TypeUnspecified => std::option::Option::Some(0),
3802            Self::TypePkcs12File => std::option::Option::Some(1),
3803            Self::TypeGoogleCredentialsFile => std::option::Option::Some(2),
3804            Self::UnknownValue(u) => u.0.value(),
3805        }
3806    }
3807
3808    /// Gets the enum value as a string.
3809    ///
3810    /// Returns `None` if the enum contains an unknown value deserialized from
3811    /// the integer representation of enums.
3812    pub fn name(&self) -> std::option::Option<&str> {
3813        match self {
3814            Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
3815            Self::TypePkcs12File => std::option::Option::Some("TYPE_PKCS12_FILE"),
3816            Self::TypeGoogleCredentialsFile => {
3817                std::option::Option::Some("TYPE_GOOGLE_CREDENTIALS_FILE")
3818            }
3819            Self::UnknownValue(u) => u.0.name(),
3820        }
3821    }
3822}
3823
3824impl std::default::Default for ServiceAccountPrivateKeyType {
3825    fn default() -> Self {
3826        use std::convert::From;
3827        Self::from(0)
3828    }
3829}
3830
3831impl std::fmt::Display for ServiceAccountPrivateKeyType {
3832    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3833        wkt::internal::display_enum(f, self.name(), self.value())
3834    }
3835}
3836
3837impl std::convert::From<i32> for ServiceAccountPrivateKeyType {
3838    fn from(value: i32) -> Self {
3839        match value {
3840            0 => Self::TypeUnspecified,
3841            1 => Self::TypePkcs12File,
3842            2 => Self::TypeGoogleCredentialsFile,
3843            _ => Self::UnknownValue(service_account_private_key_type::UnknownValue(
3844                wkt::internal::UnknownEnumValue::Integer(value),
3845            )),
3846        }
3847    }
3848}
3849
3850impl std::convert::From<&str> for ServiceAccountPrivateKeyType {
3851    fn from(value: &str) -> Self {
3852        use std::string::ToString;
3853        match value {
3854            "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
3855            "TYPE_PKCS12_FILE" => Self::TypePkcs12File,
3856            "TYPE_GOOGLE_CREDENTIALS_FILE" => Self::TypeGoogleCredentialsFile,
3857            _ => Self::UnknownValue(service_account_private_key_type::UnknownValue(
3858                wkt::internal::UnknownEnumValue::String(value.to_string()),
3859            )),
3860        }
3861    }
3862}
3863
3864impl serde::ser::Serialize for ServiceAccountPrivateKeyType {
3865    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3866    where
3867        S: serde::Serializer,
3868    {
3869        match self {
3870            Self::TypeUnspecified => serializer.serialize_i32(0),
3871            Self::TypePkcs12File => serializer.serialize_i32(1),
3872            Self::TypeGoogleCredentialsFile => serializer.serialize_i32(2),
3873            Self::UnknownValue(u) => u.0.serialize(serializer),
3874        }
3875    }
3876}
3877
3878impl<'de> serde::de::Deserialize<'de> for ServiceAccountPrivateKeyType {
3879    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3880    where
3881        D: serde::Deserializer<'de>,
3882    {
3883        deserializer.deserialize_any(
3884            wkt::internal::EnumVisitor::<ServiceAccountPrivateKeyType>::new(
3885                ".google.iam.admin.v1.ServiceAccountPrivateKeyType",
3886            ),
3887        )
3888    }
3889}
3890
3891/// Supported public key output formats.
3892///
3893/// # Working with unknown values
3894///
3895/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3896/// additional enum variants at any time. Adding new variants is not considered
3897/// a breaking change. Applications should write their code in anticipation of:
3898///
3899/// - New values appearing in future releases of the client library, **and**
3900/// - New values received dynamically, without application changes.
3901///
3902/// Please consult the [Working with enums] section in the user guide for some
3903/// guidelines.
3904///
3905/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3906#[derive(Clone, Debug, PartialEq)]
3907#[non_exhaustive]
3908pub enum ServiceAccountPublicKeyType {
3909    /// Do not return the public key.
3910    TypeNone,
3911    /// X509 PEM format.
3912    TypeX509PemFile,
3913    /// Raw public key.
3914    TypeRawPublicKey,
3915    /// If set, the enum was initialized with an unknown value.
3916    ///
3917    /// Applications can examine the value using [ServiceAccountPublicKeyType::value] or
3918    /// [ServiceAccountPublicKeyType::name].
3919    UnknownValue(service_account_public_key_type::UnknownValue),
3920}
3921
3922#[doc(hidden)]
3923pub mod service_account_public_key_type {
3924    #[allow(unused_imports)]
3925    use super::*;
3926    #[derive(Clone, Debug, PartialEq)]
3927    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3928}
3929
3930impl ServiceAccountPublicKeyType {
3931    /// Gets the enum value.
3932    ///
3933    /// Returns `None` if the enum contains an unknown value deserialized from
3934    /// the string representation of enums.
3935    pub fn value(&self) -> std::option::Option<i32> {
3936        match self {
3937            Self::TypeNone => std::option::Option::Some(0),
3938            Self::TypeX509PemFile => std::option::Option::Some(1),
3939            Self::TypeRawPublicKey => std::option::Option::Some(2),
3940            Self::UnknownValue(u) => u.0.value(),
3941        }
3942    }
3943
3944    /// Gets the enum value as a string.
3945    ///
3946    /// Returns `None` if the enum contains an unknown value deserialized from
3947    /// the integer representation of enums.
3948    pub fn name(&self) -> std::option::Option<&str> {
3949        match self {
3950            Self::TypeNone => std::option::Option::Some("TYPE_NONE"),
3951            Self::TypeX509PemFile => std::option::Option::Some("TYPE_X509_PEM_FILE"),
3952            Self::TypeRawPublicKey => std::option::Option::Some("TYPE_RAW_PUBLIC_KEY"),
3953            Self::UnknownValue(u) => u.0.name(),
3954        }
3955    }
3956}
3957
3958impl std::default::Default for ServiceAccountPublicKeyType {
3959    fn default() -> Self {
3960        use std::convert::From;
3961        Self::from(0)
3962    }
3963}
3964
3965impl std::fmt::Display for ServiceAccountPublicKeyType {
3966    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3967        wkt::internal::display_enum(f, self.name(), self.value())
3968    }
3969}
3970
3971impl std::convert::From<i32> for ServiceAccountPublicKeyType {
3972    fn from(value: i32) -> Self {
3973        match value {
3974            0 => Self::TypeNone,
3975            1 => Self::TypeX509PemFile,
3976            2 => Self::TypeRawPublicKey,
3977            _ => Self::UnknownValue(service_account_public_key_type::UnknownValue(
3978                wkt::internal::UnknownEnumValue::Integer(value),
3979            )),
3980        }
3981    }
3982}
3983
3984impl std::convert::From<&str> for ServiceAccountPublicKeyType {
3985    fn from(value: &str) -> Self {
3986        use std::string::ToString;
3987        match value {
3988            "TYPE_NONE" => Self::TypeNone,
3989            "TYPE_X509_PEM_FILE" => Self::TypeX509PemFile,
3990            "TYPE_RAW_PUBLIC_KEY" => Self::TypeRawPublicKey,
3991            _ => Self::UnknownValue(service_account_public_key_type::UnknownValue(
3992                wkt::internal::UnknownEnumValue::String(value.to_string()),
3993            )),
3994        }
3995    }
3996}
3997
3998impl serde::ser::Serialize for ServiceAccountPublicKeyType {
3999    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4000    where
4001        S: serde::Serializer,
4002    {
4003        match self {
4004            Self::TypeNone => serializer.serialize_i32(0),
4005            Self::TypeX509PemFile => serializer.serialize_i32(1),
4006            Self::TypeRawPublicKey => serializer.serialize_i32(2),
4007            Self::UnknownValue(u) => u.0.serialize(serializer),
4008        }
4009    }
4010}
4011
4012impl<'de> serde::de::Deserialize<'de> for ServiceAccountPublicKeyType {
4013    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4014    where
4015        D: serde::Deserializer<'de>,
4016    {
4017        deserializer.deserialize_any(
4018            wkt::internal::EnumVisitor::<ServiceAccountPublicKeyType>::new(
4019                ".google.iam.admin.v1.ServiceAccountPublicKeyType",
4020            ),
4021        )
4022    }
4023}
4024
4025/// Service Account Key Origin.
4026///
4027/// # Working with unknown values
4028///
4029/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4030/// additional enum variants at any time. Adding new variants is not considered
4031/// a breaking change. Applications should write their code in anticipation of:
4032///
4033/// - New values appearing in future releases of the client library, **and**
4034/// - New values received dynamically, without application changes.
4035///
4036/// Please consult the [Working with enums] section in the user guide for some
4037/// guidelines.
4038///
4039/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4040#[derive(Clone, Debug, PartialEq)]
4041#[non_exhaustive]
4042pub enum ServiceAccountKeyOrigin {
4043    /// Unspecified key origin.
4044    OriginUnspecified,
4045    /// Key is provided by user.
4046    UserProvided,
4047    /// Key is provided by Google.
4048    GoogleProvided,
4049    /// If set, the enum was initialized with an unknown value.
4050    ///
4051    /// Applications can examine the value using [ServiceAccountKeyOrigin::value] or
4052    /// [ServiceAccountKeyOrigin::name].
4053    UnknownValue(service_account_key_origin::UnknownValue),
4054}
4055
4056#[doc(hidden)]
4057pub mod service_account_key_origin {
4058    #[allow(unused_imports)]
4059    use super::*;
4060    #[derive(Clone, Debug, PartialEq)]
4061    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4062}
4063
4064impl ServiceAccountKeyOrigin {
4065    /// Gets the enum value.
4066    ///
4067    /// Returns `None` if the enum contains an unknown value deserialized from
4068    /// the string representation of enums.
4069    pub fn value(&self) -> std::option::Option<i32> {
4070        match self {
4071            Self::OriginUnspecified => std::option::Option::Some(0),
4072            Self::UserProvided => std::option::Option::Some(1),
4073            Self::GoogleProvided => std::option::Option::Some(2),
4074            Self::UnknownValue(u) => u.0.value(),
4075        }
4076    }
4077
4078    /// Gets the enum value as a string.
4079    ///
4080    /// Returns `None` if the enum contains an unknown value deserialized from
4081    /// the integer representation of enums.
4082    pub fn name(&self) -> std::option::Option<&str> {
4083        match self {
4084            Self::OriginUnspecified => std::option::Option::Some("ORIGIN_UNSPECIFIED"),
4085            Self::UserProvided => std::option::Option::Some("USER_PROVIDED"),
4086            Self::GoogleProvided => std::option::Option::Some("GOOGLE_PROVIDED"),
4087            Self::UnknownValue(u) => u.0.name(),
4088        }
4089    }
4090}
4091
4092impl std::default::Default for ServiceAccountKeyOrigin {
4093    fn default() -> Self {
4094        use std::convert::From;
4095        Self::from(0)
4096    }
4097}
4098
4099impl std::fmt::Display for ServiceAccountKeyOrigin {
4100    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4101        wkt::internal::display_enum(f, self.name(), self.value())
4102    }
4103}
4104
4105impl std::convert::From<i32> for ServiceAccountKeyOrigin {
4106    fn from(value: i32) -> Self {
4107        match value {
4108            0 => Self::OriginUnspecified,
4109            1 => Self::UserProvided,
4110            2 => Self::GoogleProvided,
4111            _ => Self::UnknownValue(service_account_key_origin::UnknownValue(
4112                wkt::internal::UnknownEnumValue::Integer(value),
4113            )),
4114        }
4115    }
4116}
4117
4118impl std::convert::From<&str> for ServiceAccountKeyOrigin {
4119    fn from(value: &str) -> Self {
4120        use std::string::ToString;
4121        match value {
4122            "ORIGIN_UNSPECIFIED" => Self::OriginUnspecified,
4123            "USER_PROVIDED" => Self::UserProvided,
4124            "GOOGLE_PROVIDED" => Self::GoogleProvided,
4125            _ => Self::UnknownValue(service_account_key_origin::UnknownValue(
4126                wkt::internal::UnknownEnumValue::String(value.to_string()),
4127            )),
4128        }
4129    }
4130}
4131
4132impl serde::ser::Serialize for ServiceAccountKeyOrigin {
4133    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4134    where
4135        S: serde::Serializer,
4136    {
4137        match self {
4138            Self::OriginUnspecified => serializer.serialize_i32(0),
4139            Self::UserProvided => serializer.serialize_i32(1),
4140            Self::GoogleProvided => serializer.serialize_i32(2),
4141            Self::UnknownValue(u) => u.0.serialize(serializer),
4142        }
4143    }
4144}
4145
4146impl<'de> serde::de::Deserialize<'de> for ServiceAccountKeyOrigin {
4147    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4148    where
4149        D: serde::Deserializer<'de>,
4150    {
4151        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceAccountKeyOrigin>::new(
4152            ".google.iam.admin.v1.ServiceAccountKeyOrigin",
4153        ))
4154    }
4155}
4156
4157/// A view for Role objects.
4158///
4159/// # Working with unknown values
4160///
4161/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4162/// additional enum variants at any time. Adding new variants is not considered
4163/// a breaking change. Applications should write their code in anticipation of:
4164///
4165/// - New values appearing in future releases of the client library, **and**
4166/// - New values received dynamically, without application changes.
4167///
4168/// Please consult the [Working with enums] section in the user guide for some
4169/// guidelines.
4170///
4171/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4172#[derive(Clone, Debug, PartialEq)]
4173#[non_exhaustive]
4174pub enum RoleView {
4175    /// Omits the `included_permissions` field.
4176    /// This is the default value.
4177    Basic,
4178    /// Returns all fields.
4179    Full,
4180    /// If set, the enum was initialized with an unknown value.
4181    ///
4182    /// Applications can examine the value using [RoleView::value] or
4183    /// [RoleView::name].
4184    UnknownValue(role_view::UnknownValue),
4185}
4186
4187#[doc(hidden)]
4188pub mod role_view {
4189    #[allow(unused_imports)]
4190    use super::*;
4191    #[derive(Clone, Debug, PartialEq)]
4192    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4193}
4194
4195impl RoleView {
4196    /// Gets the enum value.
4197    ///
4198    /// Returns `None` if the enum contains an unknown value deserialized from
4199    /// the string representation of enums.
4200    pub fn value(&self) -> std::option::Option<i32> {
4201        match self {
4202            Self::Basic => std::option::Option::Some(0),
4203            Self::Full => std::option::Option::Some(1),
4204            Self::UnknownValue(u) => u.0.value(),
4205        }
4206    }
4207
4208    /// Gets the enum value as a string.
4209    ///
4210    /// Returns `None` if the enum contains an unknown value deserialized from
4211    /// the integer representation of enums.
4212    pub fn name(&self) -> std::option::Option<&str> {
4213        match self {
4214            Self::Basic => std::option::Option::Some("BASIC"),
4215            Self::Full => std::option::Option::Some("FULL"),
4216            Self::UnknownValue(u) => u.0.name(),
4217        }
4218    }
4219}
4220
4221impl std::default::Default for RoleView {
4222    fn default() -> Self {
4223        use std::convert::From;
4224        Self::from(0)
4225    }
4226}
4227
4228impl std::fmt::Display for RoleView {
4229    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4230        wkt::internal::display_enum(f, self.name(), self.value())
4231    }
4232}
4233
4234impl std::convert::From<i32> for RoleView {
4235    fn from(value: i32) -> Self {
4236        match value {
4237            0 => Self::Basic,
4238            1 => Self::Full,
4239            _ => Self::UnknownValue(role_view::UnknownValue(
4240                wkt::internal::UnknownEnumValue::Integer(value),
4241            )),
4242        }
4243    }
4244}
4245
4246impl std::convert::From<&str> for RoleView {
4247    fn from(value: &str) -> Self {
4248        use std::string::ToString;
4249        match value {
4250            "BASIC" => Self::Basic,
4251            "FULL" => Self::Full,
4252            _ => Self::UnknownValue(role_view::UnknownValue(
4253                wkt::internal::UnknownEnumValue::String(value.to_string()),
4254            )),
4255        }
4256    }
4257}
4258
4259impl serde::ser::Serialize for RoleView {
4260    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4261    where
4262        S: serde::Serializer,
4263    {
4264        match self {
4265            Self::Basic => serializer.serialize_i32(0),
4266            Self::Full => serializer.serialize_i32(1),
4267            Self::UnknownValue(u) => u.0.serialize(serializer),
4268        }
4269    }
4270}
4271
4272impl<'de> serde::de::Deserialize<'de> for RoleView {
4273    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4274    where
4275        D: serde::Deserializer<'de>,
4276    {
4277        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoleView>::new(
4278            ".google.iam.admin.v1.RoleView",
4279        ))
4280    }
4281}