Skip to main content

google_cloud_iam_v1/
model.rs

1// Copyright 2024 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_type;
25extern crate lazy_static;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// Request message for `SetIamPolicy` method.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct SetIamPolicyRequest {
41    /// REQUIRED: The resource for which the policy is being specified.
42    /// See the operation documentation for the appropriate value for this field.
43    pub resource: std::string::String,
44
45    /// REQUIRED: The complete policy to be applied to the `resource`. The size of
46    /// the policy is limited to a few 10s of KB. An empty policy is a
47    /// valid policy but certain Cloud Platform services (such as Projects)
48    /// might reject them.
49    pub policy: std::option::Option<crate::model::Policy>,
50
51    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
52    /// the fields in the mask will be modified. If no mask is provided, the
53    /// following default mask is used:
54    ///
55    /// `paths: "bindings, etag"`
56    pub update_mask: std::option::Option<wkt::FieldMask>,
57
58    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl SetIamPolicyRequest {
62    pub fn new() -> Self {
63        std::default::Default::default()
64    }
65
66    /// Sets the value of [resource][crate::model::SetIamPolicyRequest::resource].
67    ///
68    /// # Example
69    /// ```ignore,no_run
70    /// # use google_cloud_iam_v1::model::SetIamPolicyRequest;
71    /// let x = SetIamPolicyRequest::new().set_resource("example");
72    /// ```
73    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
74        self.resource = v.into();
75        self
76    }
77
78    /// Sets the value of [policy][crate::model::SetIamPolicyRequest::policy].
79    ///
80    /// # Example
81    /// ```ignore,no_run
82    /// # use google_cloud_iam_v1::model::SetIamPolicyRequest;
83    /// use google_cloud_iam_v1::model::Policy;
84    /// let x = SetIamPolicyRequest::new().set_policy(Policy::default()/* use setters */);
85    /// ```
86    pub fn set_policy<T>(mut self, v: T) -> Self
87    where
88        T: std::convert::Into<crate::model::Policy>,
89    {
90        self.policy = std::option::Option::Some(v.into());
91        self
92    }
93
94    /// Sets or clears the value of [policy][crate::model::SetIamPolicyRequest::policy].
95    ///
96    /// # Example
97    /// ```ignore,no_run
98    /// # use google_cloud_iam_v1::model::SetIamPolicyRequest;
99    /// use google_cloud_iam_v1::model::Policy;
100    /// let x = SetIamPolicyRequest::new().set_or_clear_policy(Some(Policy::default()/* use setters */));
101    /// let x = SetIamPolicyRequest::new().set_or_clear_policy(None::<Policy>);
102    /// ```
103    pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
104    where
105        T: std::convert::Into<crate::model::Policy>,
106    {
107        self.policy = v.map(|x| x.into());
108        self
109    }
110
111    /// Sets the value of [update_mask][crate::model::SetIamPolicyRequest::update_mask].
112    ///
113    /// # Example
114    /// ```ignore,no_run
115    /// # use google_cloud_iam_v1::model::SetIamPolicyRequest;
116    /// use wkt::FieldMask;
117    /// let x = SetIamPolicyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
118    /// ```
119    pub fn set_update_mask<T>(mut self, v: T) -> Self
120    where
121        T: std::convert::Into<wkt::FieldMask>,
122    {
123        self.update_mask = std::option::Option::Some(v.into());
124        self
125    }
126
127    /// Sets or clears the value of [update_mask][crate::model::SetIamPolicyRequest::update_mask].
128    ///
129    /// # Example
130    /// ```ignore,no_run
131    /// # use google_cloud_iam_v1::model::SetIamPolicyRequest;
132    /// use wkt::FieldMask;
133    /// let x = SetIamPolicyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
134    /// let x = SetIamPolicyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
135    /// ```
136    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
137    where
138        T: std::convert::Into<wkt::FieldMask>,
139    {
140        self.update_mask = v.map(|x| x.into());
141        self
142    }
143}
144
145impl wkt::message::Message for SetIamPolicyRequest {
146    fn typename() -> &'static str {
147        "type.googleapis.com/google.iam.v1.SetIamPolicyRequest"
148    }
149}
150
151/// Request message for `GetIamPolicy` method.
152#[derive(Clone, Default, PartialEq)]
153#[non_exhaustive]
154pub struct GetIamPolicyRequest {
155    /// REQUIRED: The resource for which the policy is being requested.
156    /// See the operation documentation for the appropriate value for this field.
157    pub resource: std::string::String,
158
159    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to
160    /// `GetIamPolicy`.
161    pub options: std::option::Option<crate::model::GetPolicyOptions>,
162
163    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
164}
165
166impl GetIamPolicyRequest {
167    pub fn new() -> Self {
168        std::default::Default::default()
169    }
170
171    /// Sets the value of [resource][crate::model::GetIamPolicyRequest::resource].
172    ///
173    /// # Example
174    /// ```ignore,no_run
175    /// # use google_cloud_iam_v1::model::GetIamPolicyRequest;
176    /// let x = GetIamPolicyRequest::new().set_resource("example");
177    /// ```
178    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
179        self.resource = v.into();
180        self
181    }
182
183    /// Sets the value of [options][crate::model::GetIamPolicyRequest::options].
184    ///
185    /// # Example
186    /// ```ignore,no_run
187    /// # use google_cloud_iam_v1::model::GetIamPolicyRequest;
188    /// use google_cloud_iam_v1::model::GetPolicyOptions;
189    /// let x = GetIamPolicyRequest::new().set_options(GetPolicyOptions::default()/* use setters */);
190    /// ```
191    pub fn set_options<T>(mut self, v: T) -> Self
192    where
193        T: std::convert::Into<crate::model::GetPolicyOptions>,
194    {
195        self.options = std::option::Option::Some(v.into());
196        self
197    }
198
199    /// Sets or clears the value of [options][crate::model::GetIamPolicyRequest::options].
200    ///
201    /// # Example
202    /// ```ignore,no_run
203    /// # use google_cloud_iam_v1::model::GetIamPolicyRequest;
204    /// use google_cloud_iam_v1::model::GetPolicyOptions;
205    /// let x = GetIamPolicyRequest::new().set_or_clear_options(Some(GetPolicyOptions::default()/* use setters */));
206    /// let x = GetIamPolicyRequest::new().set_or_clear_options(None::<GetPolicyOptions>);
207    /// ```
208    pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
209    where
210        T: std::convert::Into<crate::model::GetPolicyOptions>,
211    {
212        self.options = v.map(|x| x.into());
213        self
214    }
215}
216
217impl wkt::message::Message for GetIamPolicyRequest {
218    fn typename() -> &'static str {
219        "type.googleapis.com/google.iam.v1.GetIamPolicyRequest"
220    }
221}
222
223/// Request message for `TestIamPermissions` method.
224#[derive(Clone, Default, PartialEq)]
225#[non_exhaustive]
226pub struct TestIamPermissionsRequest {
227    /// REQUIRED: The resource for which the policy detail is being requested.
228    /// See the operation documentation for the appropriate value for this field.
229    pub resource: std::string::String,
230
231    /// The set of permissions to check for the `resource`. Permissions with
232    /// wildcards (such as '*' or 'storage.*') are not allowed. For more
233    /// information see
234    /// [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
235    pub permissions: std::vec::Vec<std::string::String>,
236
237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
238}
239
240impl TestIamPermissionsRequest {
241    pub fn new() -> Self {
242        std::default::Default::default()
243    }
244
245    /// Sets the value of [resource][crate::model::TestIamPermissionsRequest::resource].
246    ///
247    /// # Example
248    /// ```ignore,no_run
249    /// # use google_cloud_iam_v1::model::TestIamPermissionsRequest;
250    /// let x = TestIamPermissionsRequest::new().set_resource("example");
251    /// ```
252    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
253        self.resource = v.into();
254        self
255    }
256
257    /// Sets the value of [permissions][crate::model::TestIamPermissionsRequest::permissions].
258    ///
259    /// # Example
260    /// ```ignore,no_run
261    /// # use google_cloud_iam_v1::model::TestIamPermissionsRequest;
262    /// let x = TestIamPermissionsRequest::new().set_permissions(["a", "b", "c"]);
263    /// ```
264    pub fn set_permissions<T, V>(mut self, v: T) -> Self
265    where
266        T: std::iter::IntoIterator<Item = V>,
267        V: std::convert::Into<std::string::String>,
268    {
269        use std::iter::Iterator;
270        self.permissions = v.into_iter().map(|i| i.into()).collect();
271        self
272    }
273}
274
275impl wkt::message::Message for TestIamPermissionsRequest {
276    fn typename() -> &'static str {
277        "type.googleapis.com/google.iam.v1.TestIamPermissionsRequest"
278    }
279}
280
281/// Response message for `TestIamPermissions` method.
282#[derive(Clone, Default, PartialEq)]
283#[non_exhaustive]
284pub struct TestIamPermissionsResponse {
285    /// A subset of `TestPermissionsRequest.permissions` that the caller is
286    /// allowed.
287    pub permissions: std::vec::Vec<std::string::String>,
288
289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
290}
291
292impl TestIamPermissionsResponse {
293    pub fn new() -> Self {
294        std::default::Default::default()
295    }
296
297    /// Sets the value of [permissions][crate::model::TestIamPermissionsResponse::permissions].
298    ///
299    /// # Example
300    /// ```ignore,no_run
301    /// # use google_cloud_iam_v1::model::TestIamPermissionsResponse;
302    /// let x = TestIamPermissionsResponse::new().set_permissions(["a", "b", "c"]);
303    /// ```
304    pub fn set_permissions<T, V>(mut self, v: T) -> Self
305    where
306        T: std::iter::IntoIterator<Item = V>,
307        V: std::convert::Into<std::string::String>,
308    {
309        use std::iter::Iterator;
310        self.permissions = v.into_iter().map(|i| i.into()).collect();
311        self
312    }
313}
314
315impl wkt::message::Message for TestIamPermissionsResponse {
316    fn typename() -> &'static str {
317        "type.googleapis.com/google.iam.v1.TestIamPermissionsResponse"
318    }
319}
320
321/// Encapsulates settings provided to GetIamPolicy.
322#[derive(Clone, Default, PartialEq)]
323#[non_exhaustive]
324pub struct GetPolicyOptions {
325    /// Optional. The maximum policy version that will be used to format the
326    /// policy.
327    ///
328    /// Valid values are 0, 1, and 3. Requests specifying an invalid value will be
329    /// rejected.
330    ///
331    /// Requests for policies with any conditional role bindings must specify
332    /// version 3. Policies with no conditional role bindings may specify any valid
333    /// value or leave the field unset.
334    ///
335    /// The policy in the response might use the policy version that you specified,
336    /// or it might use a lower policy version. For example, if you specify version
337    /// 3, but the policy has no conditional role bindings, the response uses
338    /// version 1.
339    ///
340    /// To learn which resources support conditions in their IAM policies, see the
341    /// [IAM
342    /// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
343    pub requested_policy_version: i32,
344
345    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
346}
347
348impl GetPolicyOptions {
349    pub fn new() -> Self {
350        std::default::Default::default()
351    }
352
353    /// Sets the value of [requested_policy_version][crate::model::GetPolicyOptions::requested_policy_version].
354    ///
355    /// # Example
356    /// ```ignore,no_run
357    /// # use google_cloud_iam_v1::model::GetPolicyOptions;
358    /// let x = GetPolicyOptions::new().set_requested_policy_version(42);
359    /// ```
360    pub fn set_requested_policy_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
361        self.requested_policy_version = v.into();
362        self
363    }
364}
365
366impl wkt::message::Message for GetPolicyOptions {
367    fn typename() -> &'static str {
368        "type.googleapis.com/google.iam.v1.GetPolicyOptions"
369    }
370}
371
372/// An Identity and Access Management (IAM) policy, which specifies access
373/// controls for Google Cloud resources.
374///
375/// A `Policy` is a collection of `bindings`. A `binding` binds one or more
376/// `members`, or principals, to a single `role`. Principals can be user
377/// accounts, service accounts, Google groups, and domains (such as G Suite). A
378/// `role` is a named list of permissions; each `role` can be an IAM predefined
379/// role or a user-created custom role.
380///
381/// For some types of Google Cloud resources, a `binding` can also specify a
382/// `condition`, which is a logical expression that allows access to a resource
383/// only if the expression evaluates to `true`. A condition can add constraints
384/// based on attributes of the request, the resource, or both. To learn which
385/// resources support conditions in their IAM policies, see the
386/// [IAM
387/// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
388///
389/// **JSON example:**
390///
391/// ```norust
392///     {
393///       "bindings": [
394///         {
395///           "role": "roles/resourcemanager.organizationAdmin",
396///           "members": [
397///             "user:mike@example.com",
398///             "group:admins@example.com",
399///             "domain:google.com",
400///             "serviceAccount:my-project-id@appspot.gserviceaccount.com"
401///           ]
402///         },
403///         {
404///           "role": "roles/resourcemanager.organizationViewer",
405///           "members": [
406///             "user:eve@example.com"
407///           ],
408///           "condition": {
409///             "title": "expirable access",
410///             "description": "Does not grant access after Sep 2020",
411///             "expression": "request.time <
412///             timestamp('2020-10-01T00:00:00.000Z')",
413///           }
414///         }
415///       ],
416///       "etag": "BwWWja0YfJA=",
417///       "version": 3
418///     }
419/// ```
420///
421/// **YAML example:**
422///
423/// ```norust
424///     bindings:
425///     - members:
426///       - user:mike@example.com
427///       - group:admins@example.com
428///       - domain:google.com
429///       - serviceAccount:my-project-id@appspot.gserviceaccount.com
430///       role: roles/resourcemanager.organizationAdmin
431///     - members:
432///       - user:eve@example.com
433///       role: roles/resourcemanager.organizationViewer
434///       condition:
435///         title: expirable access
436///         description: Does not grant access after Sep 2020
437///         expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
438///     etag: BwWWja0YfJA=
439///     version: 3
440/// ```
441///
442/// For a description of IAM and its features, see the
443/// [IAM documentation](https://cloud.google.com/iam/docs/).
444#[derive(Clone, Default, PartialEq)]
445#[non_exhaustive]
446pub struct Policy {
447    /// Specifies the format of the policy.
448    ///
449    /// Valid values are `0`, `1`, and `3`. Requests that specify an invalid value
450    /// are rejected.
451    ///
452    /// Any operation that affects conditional role bindings must specify version
453    /// `3`. This requirement applies to the following operations:
454    ///
455    /// * Getting a policy that includes a conditional role binding
456    /// * Adding a conditional role binding to a policy
457    /// * Changing a conditional role binding in a policy
458    /// * Removing any role binding, with or without a condition, from a policy
459    ///   that includes conditions
460    ///
461    /// **Important:** If you use IAM Conditions, you must include the `etag` field
462    /// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
463    /// you to overwrite a version `3` policy with a version `1` policy, and all of
464    /// the conditions in the version `3` policy are lost.
465    ///
466    /// If a policy does not include any conditions, operations on that policy may
467    /// specify any valid version or leave the field unset.
468    ///
469    /// To learn which resources support conditions in their IAM policies, see the
470    /// [IAM
471    /// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
472    pub version: i32,
473
474    /// Associates a list of `members`, or principals, with a `role`. Optionally,
475    /// may specify a `condition` that determines how and when the `bindings` are
476    /// applied. Each of the `bindings` must contain at least one principal.
477    ///
478    /// The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250
479    /// of these principals can be Google groups. Each occurrence of a principal
480    /// counts towards these limits. For example, if the `bindings` grant 50
481    /// different roles to `user:alice@example.com`, and not to any other
482    /// principal, then you can add another 1,450 principals to the `bindings` in
483    /// the `Policy`.
484    pub bindings: std::vec::Vec<crate::model::Binding>,
485
486    /// Specifies cloud audit logging configuration for this policy.
487    pub audit_configs: std::vec::Vec<crate::model::AuditConfig>,
488
489    /// `etag` is used for optimistic concurrency control as a way to help
490    /// prevent simultaneous updates of a policy from overwriting each other.
491    /// It is strongly suggested that systems make use of the `etag` in the
492    /// read-modify-write cycle to perform policy updates in order to avoid race
493    /// conditions: An `etag` is returned in the response to `getIamPolicy`, and
494    /// systems are expected to put that etag in the request to `setIamPolicy` to
495    /// ensure that their change will be applied to the same version of the policy.
496    ///
497    /// **Important:** If you use IAM Conditions, you must include the `etag` field
498    /// whenever you call `setIamPolicy`. If you omit this field, then IAM allows
499    /// you to overwrite a version `3` policy with a version `1` policy, and all of
500    /// the conditions in the version `3` policy are lost.
501    pub etag: ::bytes::Bytes,
502
503    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
504}
505
506impl Policy {
507    pub fn new() -> Self {
508        std::default::Default::default()
509    }
510
511    /// Sets the value of [version][crate::model::Policy::version].
512    ///
513    /// # Example
514    /// ```ignore,no_run
515    /// # use google_cloud_iam_v1::model::Policy;
516    /// let x = Policy::new().set_version(42);
517    /// ```
518    pub fn set_version<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
519        self.version = v.into();
520        self
521    }
522
523    /// Sets the value of [bindings][crate::model::Policy::bindings].
524    ///
525    /// # Example
526    /// ```ignore,no_run
527    /// # use google_cloud_iam_v1::model::Policy;
528    /// use google_cloud_iam_v1::model::Binding;
529    /// let x = Policy::new()
530    ///     .set_bindings([
531    ///         Binding::default()/* use setters */,
532    ///         Binding::default()/* use (different) setters */,
533    ///     ]);
534    /// ```
535    pub fn set_bindings<T, V>(mut self, v: T) -> Self
536    where
537        T: std::iter::IntoIterator<Item = V>,
538        V: std::convert::Into<crate::model::Binding>,
539    {
540        use std::iter::Iterator;
541        self.bindings = v.into_iter().map(|i| i.into()).collect();
542        self
543    }
544
545    /// Sets the value of [audit_configs][crate::model::Policy::audit_configs].
546    ///
547    /// # Example
548    /// ```ignore,no_run
549    /// # use google_cloud_iam_v1::model::Policy;
550    /// use google_cloud_iam_v1::model::AuditConfig;
551    /// let x = Policy::new()
552    ///     .set_audit_configs([
553    ///         AuditConfig::default()/* use setters */,
554    ///         AuditConfig::default()/* use (different) setters */,
555    ///     ]);
556    /// ```
557    pub fn set_audit_configs<T, V>(mut self, v: T) -> Self
558    where
559        T: std::iter::IntoIterator<Item = V>,
560        V: std::convert::Into<crate::model::AuditConfig>,
561    {
562        use std::iter::Iterator;
563        self.audit_configs = v.into_iter().map(|i| i.into()).collect();
564        self
565    }
566
567    /// Sets the value of [etag][crate::model::Policy::etag].
568    ///
569    /// # Example
570    /// ```ignore,no_run
571    /// # use google_cloud_iam_v1::model::Policy;
572    /// let x = Policy::new().set_etag(bytes::Bytes::from_static(b"example"));
573    /// ```
574    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
575        self.etag = v.into();
576        self
577    }
578}
579
580impl wkt::message::Message for Policy {
581    fn typename() -> &'static str {
582        "type.googleapis.com/google.iam.v1.Policy"
583    }
584}
585
586/// Associates `members`, or principals, with a `role`.
587#[derive(Clone, Default, PartialEq)]
588#[non_exhaustive]
589pub struct Binding {
590    /// Role that is assigned to the list of `members`, or principals.
591    /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
592    pub role: std::string::String,
593
594    /// Specifies the principals requesting access for a Google Cloud resource.
595    /// `members` can have the following values:
596    ///
597    /// * `allUsers`: A special identifier that represents anyone who is
598    ///   on the internet; with or without a Google account.
599    ///
600    /// * `allAuthenticatedUsers`: A special identifier that represents anyone
601    ///   who is authenticated with a Google account or a service account.
602    ///
603    /// * `user:{emailid}`: An email address that represents a specific Google
604    ///   account. For example, `alice@example.com` .
605    ///
606    /// * `serviceAccount:{emailid}`: An email address that represents a service
607    ///   account. For example, `my-other-app@appspot.gserviceaccount.com`.
608    ///
609    /// * `group:{emailid}`: An email address that represents a Google group.
610    ///   For example, `admins@example.com`.
611    ///
612    /// * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique
613    ///   identifier) representing a user that has been recently deleted. For
614    ///   example, `alice@example.com?uid=123456789012345678901`. If the user is
615    ///   recovered, this value reverts to `user:{emailid}` and the recovered user
616    ///   retains the role in the binding.
617    ///
618    /// * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
619    ///   unique identifier) representing a service account that has been recently
620    ///   deleted. For example,
621    ///   `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
622    ///   If the service account is undeleted, this value reverts to
623    ///   `serviceAccount:{emailid}` and the undeleted service account retains the
624    ///   role in the binding.
625    ///
626    /// * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique
627    ///   identifier) representing a Google group that has been recently
628    ///   deleted. For example, `admins@example.com?uid=123456789012345678901`. If
629    ///   the group is recovered, this value reverts to `group:{emailid}` and the
630    ///   recovered group retains the role in the binding.
631    ///
632    /// * `domain:{domain}`: The G Suite domain (primary) that represents all the
633    ///   users of that domain. For example, `google.com` or `example.com`.
634    ///
635    pub members: std::vec::Vec<std::string::String>,
636
637    /// The condition that is associated with this binding.
638    ///
639    /// If the condition evaluates to `true`, then this binding applies to the
640    /// current request.
641    ///
642    /// If the condition evaluates to `false`, then this binding does not apply to
643    /// the current request. However, a different role binding might grant the same
644    /// role to one or more of the principals in this binding.
645    ///
646    /// To learn which resources support conditions in their IAM policies, see the
647    /// [IAM
648    /// documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
649    pub condition: std::option::Option<google_cloud_type::model::Expr>,
650
651    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
652}
653
654impl Binding {
655    pub fn new() -> Self {
656        std::default::Default::default()
657    }
658
659    /// Sets the value of [role][crate::model::Binding::role].
660    ///
661    /// # Example
662    /// ```ignore,no_run
663    /// # use google_cloud_iam_v1::model::Binding;
664    /// let x = Binding::new().set_role("example");
665    /// ```
666    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
667        self.role = v.into();
668        self
669    }
670
671    /// Sets the value of [members][crate::model::Binding::members].
672    ///
673    /// # Example
674    /// ```ignore,no_run
675    /// # use google_cloud_iam_v1::model::Binding;
676    /// let x = Binding::new().set_members(["a", "b", "c"]);
677    /// ```
678    pub fn set_members<T, V>(mut self, v: T) -> Self
679    where
680        T: std::iter::IntoIterator<Item = V>,
681        V: std::convert::Into<std::string::String>,
682    {
683        use std::iter::Iterator;
684        self.members = v.into_iter().map(|i| i.into()).collect();
685        self
686    }
687
688    /// Sets the value of [condition][crate::model::Binding::condition].
689    ///
690    /// # Example
691    /// ```ignore,no_run
692    /// # use google_cloud_iam_v1::model::Binding;
693    /// use google_cloud_type::model::Expr;
694    /// let x = Binding::new().set_condition(Expr::default()/* use setters */);
695    /// ```
696    pub fn set_condition<T>(mut self, v: T) -> Self
697    where
698        T: std::convert::Into<google_cloud_type::model::Expr>,
699    {
700        self.condition = std::option::Option::Some(v.into());
701        self
702    }
703
704    /// Sets or clears the value of [condition][crate::model::Binding::condition].
705    ///
706    /// # Example
707    /// ```ignore,no_run
708    /// # use google_cloud_iam_v1::model::Binding;
709    /// use google_cloud_type::model::Expr;
710    /// let x = Binding::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
711    /// let x = Binding::new().set_or_clear_condition(None::<Expr>);
712    /// ```
713    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
714    where
715        T: std::convert::Into<google_cloud_type::model::Expr>,
716    {
717        self.condition = v.map(|x| x.into());
718        self
719    }
720}
721
722impl wkt::message::Message for Binding {
723    fn typename() -> &'static str {
724        "type.googleapis.com/google.iam.v1.Binding"
725    }
726}
727
728/// Specifies the audit configuration for a service.
729/// The configuration determines which permission types are logged, and what
730/// identities, if any, are exempted from logging.
731/// An AuditConfig must have one or more AuditLogConfigs.
732///
733/// If there are AuditConfigs for both `allServices` and a specific service,
734/// the union of the two AuditConfigs is used for that service: the log_types
735/// specified in each AuditConfig are enabled, and the exempted_members in each
736/// AuditLogConfig are exempted.
737///
738/// Example Policy with multiple AuditConfigs:
739///
740/// ```norust
741/// {
742///   "audit_configs": [
743///     {
744///       "service": "allServices",
745///       "audit_log_configs": [
746///         {
747///           "log_type": "DATA_READ",
748///           "exempted_members": [
749///             "user:jose@example.com"
750///           ]
751///         },
752///         {
753///           "log_type": "DATA_WRITE"
754///         },
755///         {
756///           "log_type": "ADMIN_READ"
757///         }
758///       ]
759///     },
760///     {
761///       "service": "sampleservice.googleapis.com",
762///       "audit_log_configs": [
763///         {
764///           "log_type": "DATA_READ"
765///         },
766///         {
767///           "log_type": "DATA_WRITE",
768///           "exempted_members": [
769///             "user:aliya@example.com"
770///           ]
771///         }
772///       ]
773///     }
774///   ]
775/// }
776/// ```
777///
778/// For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
779/// logging. It also exempts `jose@example.com` from DATA_READ logging, and
780/// `aliya@example.com` from DATA_WRITE logging.
781#[derive(Clone, Default, PartialEq)]
782#[non_exhaustive]
783pub struct AuditConfig {
784    /// Specifies a service that will be enabled for audit logging.
785    /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
786    /// `allServices` is a special value that covers all services.
787    pub service: std::string::String,
788
789    /// The configuration for logging of each type of permission.
790    pub audit_log_configs: std::vec::Vec<crate::model::AuditLogConfig>,
791
792    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
793}
794
795impl AuditConfig {
796    pub fn new() -> Self {
797        std::default::Default::default()
798    }
799
800    /// Sets the value of [service][crate::model::AuditConfig::service].
801    ///
802    /// # Example
803    /// ```ignore,no_run
804    /// # use google_cloud_iam_v1::model::AuditConfig;
805    /// let x = AuditConfig::new().set_service("example");
806    /// ```
807    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
808        self.service = v.into();
809        self
810    }
811
812    /// Sets the value of [audit_log_configs][crate::model::AuditConfig::audit_log_configs].
813    ///
814    /// # Example
815    /// ```ignore,no_run
816    /// # use google_cloud_iam_v1::model::AuditConfig;
817    /// use google_cloud_iam_v1::model::AuditLogConfig;
818    /// let x = AuditConfig::new()
819    ///     .set_audit_log_configs([
820    ///         AuditLogConfig::default()/* use setters */,
821    ///         AuditLogConfig::default()/* use (different) setters */,
822    ///     ]);
823    /// ```
824    pub fn set_audit_log_configs<T, V>(mut self, v: T) -> Self
825    where
826        T: std::iter::IntoIterator<Item = V>,
827        V: std::convert::Into<crate::model::AuditLogConfig>,
828    {
829        use std::iter::Iterator;
830        self.audit_log_configs = v.into_iter().map(|i| i.into()).collect();
831        self
832    }
833}
834
835impl wkt::message::Message for AuditConfig {
836    fn typename() -> &'static str {
837        "type.googleapis.com/google.iam.v1.AuditConfig"
838    }
839}
840
841/// Provides the configuration for logging a type of permissions.
842/// Example:
843///
844/// ```norust
845/// {
846///   "audit_log_configs": [
847///     {
848///       "log_type": "DATA_READ",
849///       "exempted_members": [
850///         "user:jose@example.com"
851///       ]
852///     },
853///     {
854///       "log_type": "DATA_WRITE"
855///     }
856///   ]
857/// }
858/// ```
859///
860/// This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
861/// jose@example.com from DATA_READ logging.
862#[derive(Clone, Default, PartialEq)]
863#[non_exhaustive]
864pub struct AuditLogConfig {
865    /// The log type that this config enables.
866    pub log_type: crate::model::audit_log_config::LogType,
867
868    /// Specifies the identities that do not cause logging for this type of
869    /// permission.
870    /// Follows the same format of
871    /// [Binding.members][google.iam.v1.Binding.members].
872    ///
873    /// [google.iam.v1.Binding.members]: crate::model::Binding::members
874    pub exempted_members: std::vec::Vec<std::string::String>,
875
876    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
877}
878
879impl AuditLogConfig {
880    pub fn new() -> Self {
881        std::default::Default::default()
882    }
883
884    /// Sets the value of [log_type][crate::model::AuditLogConfig::log_type].
885    ///
886    /// # Example
887    /// ```ignore,no_run
888    /// # use google_cloud_iam_v1::model::AuditLogConfig;
889    /// use google_cloud_iam_v1::model::audit_log_config::LogType;
890    /// let x0 = AuditLogConfig::new().set_log_type(LogType::AdminRead);
891    /// let x1 = AuditLogConfig::new().set_log_type(LogType::DataWrite);
892    /// let x2 = AuditLogConfig::new().set_log_type(LogType::DataRead);
893    /// ```
894    pub fn set_log_type<T: std::convert::Into<crate::model::audit_log_config::LogType>>(
895        mut self,
896        v: T,
897    ) -> Self {
898        self.log_type = v.into();
899        self
900    }
901
902    /// Sets the value of [exempted_members][crate::model::AuditLogConfig::exempted_members].
903    ///
904    /// # Example
905    /// ```ignore,no_run
906    /// # use google_cloud_iam_v1::model::AuditLogConfig;
907    /// let x = AuditLogConfig::new().set_exempted_members(["a", "b", "c"]);
908    /// ```
909    pub fn set_exempted_members<T, V>(mut self, v: T) -> Self
910    where
911        T: std::iter::IntoIterator<Item = V>,
912        V: std::convert::Into<std::string::String>,
913    {
914        use std::iter::Iterator;
915        self.exempted_members = v.into_iter().map(|i| i.into()).collect();
916        self
917    }
918}
919
920impl wkt::message::Message for AuditLogConfig {
921    fn typename() -> &'static str {
922        "type.googleapis.com/google.iam.v1.AuditLogConfig"
923    }
924}
925
926/// Defines additional types related to [AuditLogConfig].
927pub mod audit_log_config {
928    #[allow(unused_imports)]
929    use super::*;
930
931    /// The list of valid permission types for which logging can be configured.
932    /// Admin writes are always logged, and are not configurable.
933    ///
934    /// # Working with unknown values
935    ///
936    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
937    /// additional enum variants at any time. Adding new variants is not considered
938    /// a breaking change. Applications should write their code in anticipation of:
939    ///
940    /// - New values appearing in future releases of the client library, **and**
941    /// - New values received dynamically, without application changes.
942    ///
943    /// Please consult the [Working with enums] section in the user guide for some
944    /// guidelines.
945    ///
946    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
947    #[derive(Clone, Debug, PartialEq)]
948    #[non_exhaustive]
949    pub enum LogType {
950        /// Default case. Should never be this.
951        Unspecified,
952        /// Admin reads. Example: CloudIAM getIamPolicy
953        AdminRead,
954        /// Data writes. Example: CloudSQL Users create
955        DataWrite,
956        /// Data reads. Example: CloudSQL Users list
957        DataRead,
958        /// If set, the enum was initialized with an unknown value.
959        ///
960        /// Applications can examine the value using [LogType::value] or
961        /// [LogType::name].
962        UnknownValue(log_type::UnknownValue),
963    }
964
965    #[doc(hidden)]
966    pub mod log_type {
967        #[allow(unused_imports)]
968        use super::*;
969        #[derive(Clone, Debug, PartialEq)]
970        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
971    }
972
973    impl LogType {
974        /// Gets the enum value.
975        ///
976        /// Returns `None` if the enum contains an unknown value deserialized from
977        /// the string representation of enums.
978        pub fn value(&self) -> std::option::Option<i32> {
979            match self {
980                Self::Unspecified => std::option::Option::Some(0),
981                Self::AdminRead => std::option::Option::Some(1),
982                Self::DataWrite => std::option::Option::Some(2),
983                Self::DataRead => std::option::Option::Some(3),
984                Self::UnknownValue(u) => u.0.value(),
985            }
986        }
987
988        /// Gets the enum value as a string.
989        ///
990        /// Returns `None` if the enum contains an unknown value deserialized from
991        /// the integer representation of enums.
992        pub fn name(&self) -> std::option::Option<&str> {
993            match self {
994                Self::Unspecified => std::option::Option::Some("LOG_TYPE_UNSPECIFIED"),
995                Self::AdminRead => std::option::Option::Some("ADMIN_READ"),
996                Self::DataWrite => std::option::Option::Some("DATA_WRITE"),
997                Self::DataRead => std::option::Option::Some("DATA_READ"),
998                Self::UnknownValue(u) => u.0.name(),
999            }
1000        }
1001    }
1002
1003    impl std::default::Default for LogType {
1004        fn default() -> Self {
1005            use std::convert::From;
1006            Self::from(0)
1007        }
1008    }
1009
1010    impl std::fmt::Display for LogType {
1011        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1012            wkt::internal::display_enum(f, self.name(), self.value())
1013        }
1014    }
1015
1016    impl std::convert::From<i32> for LogType {
1017        fn from(value: i32) -> Self {
1018            match value {
1019                0 => Self::Unspecified,
1020                1 => Self::AdminRead,
1021                2 => Self::DataWrite,
1022                3 => Self::DataRead,
1023                _ => Self::UnknownValue(log_type::UnknownValue(
1024                    wkt::internal::UnknownEnumValue::Integer(value),
1025                )),
1026            }
1027        }
1028    }
1029
1030    impl std::convert::From<&str> for LogType {
1031        fn from(value: &str) -> Self {
1032            use std::string::ToString;
1033            match value {
1034                "LOG_TYPE_UNSPECIFIED" => Self::Unspecified,
1035                "ADMIN_READ" => Self::AdminRead,
1036                "DATA_WRITE" => Self::DataWrite,
1037                "DATA_READ" => Self::DataRead,
1038                _ => Self::UnknownValue(log_type::UnknownValue(
1039                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1040                )),
1041            }
1042        }
1043    }
1044
1045    impl serde::ser::Serialize for LogType {
1046        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1047        where
1048            S: serde::Serializer,
1049        {
1050            match self {
1051                Self::Unspecified => serializer.serialize_i32(0),
1052                Self::AdminRead => serializer.serialize_i32(1),
1053                Self::DataWrite => serializer.serialize_i32(2),
1054                Self::DataRead => serializer.serialize_i32(3),
1055                Self::UnknownValue(u) => u.0.serialize(serializer),
1056            }
1057        }
1058    }
1059
1060    impl<'de> serde::de::Deserialize<'de> for LogType {
1061        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1062        where
1063            D: serde::Deserializer<'de>,
1064        {
1065            deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogType>::new(
1066                ".google.iam.v1.AuditLogConfig.LogType",
1067            ))
1068        }
1069    }
1070}
1071
1072/// The difference delta between two policies.
1073#[derive(Clone, Default, PartialEq)]
1074#[non_exhaustive]
1075pub struct PolicyDelta {
1076    /// The delta for Bindings between two policies.
1077    pub binding_deltas: std::vec::Vec<crate::model::BindingDelta>,
1078
1079    /// The delta for AuditConfigs between two policies.
1080    pub audit_config_deltas: std::vec::Vec<crate::model::AuditConfigDelta>,
1081
1082    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1083}
1084
1085impl PolicyDelta {
1086    pub fn new() -> Self {
1087        std::default::Default::default()
1088    }
1089
1090    /// Sets the value of [binding_deltas][crate::model::PolicyDelta::binding_deltas].
1091    ///
1092    /// # Example
1093    /// ```ignore,no_run
1094    /// # use google_cloud_iam_v1::model::PolicyDelta;
1095    /// use google_cloud_iam_v1::model::BindingDelta;
1096    /// let x = PolicyDelta::new()
1097    ///     .set_binding_deltas([
1098    ///         BindingDelta::default()/* use setters */,
1099    ///         BindingDelta::default()/* use (different) setters */,
1100    ///     ]);
1101    /// ```
1102    pub fn set_binding_deltas<T, V>(mut self, v: T) -> Self
1103    where
1104        T: std::iter::IntoIterator<Item = V>,
1105        V: std::convert::Into<crate::model::BindingDelta>,
1106    {
1107        use std::iter::Iterator;
1108        self.binding_deltas = v.into_iter().map(|i| i.into()).collect();
1109        self
1110    }
1111
1112    /// Sets the value of [audit_config_deltas][crate::model::PolicyDelta::audit_config_deltas].
1113    ///
1114    /// # Example
1115    /// ```ignore,no_run
1116    /// # use google_cloud_iam_v1::model::PolicyDelta;
1117    /// use google_cloud_iam_v1::model::AuditConfigDelta;
1118    /// let x = PolicyDelta::new()
1119    ///     .set_audit_config_deltas([
1120    ///         AuditConfigDelta::default()/* use setters */,
1121    ///         AuditConfigDelta::default()/* use (different) setters */,
1122    ///     ]);
1123    /// ```
1124    pub fn set_audit_config_deltas<T, V>(mut self, v: T) -> Self
1125    where
1126        T: std::iter::IntoIterator<Item = V>,
1127        V: std::convert::Into<crate::model::AuditConfigDelta>,
1128    {
1129        use std::iter::Iterator;
1130        self.audit_config_deltas = v.into_iter().map(|i| i.into()).collect();
1131        self
1132    }
1133}
1134
1135impl wkt::message::Message for PolicyDelta {
1136    fn typename() -> &'static str {
1137        "type.googleapis.com/google.iam.v1.PolicyDelta"
1138    }
1139}
1140
1141/// One delta entry for Binding. Each individual change (only one member in each
1142/// entry) to a binding will be a separate entry.
1143#[derive(Clone, Default, PartialEq)]
1144#[non_exhaustive]
1145pub struct BindingDelta {
1146    /// The action that was performed on a Binding.
1147    /// Required
1148    pub action: crate::model::binding_delta::Action,
1149
1150    /// Role that is assigned to `members`.
1151    /// For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
1152    /// Required
1153    pub role: std::string::String,
1154
1155    /// A single identity requesting access for a Google Cloud resource.
1156    /// Follows the same format of Binding.members.
1157    /// Required
1158    pub member: std::string::String,
1159
1160    /// The condition that is associated with this binding.
1161    pub condition: std::option::Option<google_cloud_type::model::Expr>,
1162
1163    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1164}
1165
1166impl BindingDelta {
1167    pub fn new() -> Self {
1168        std::default::Default::default()
1169    }
1170
1171    /// Sets the value of [action][crate::model::BindingDelta::action].
1172    ///
1173    /// # Example
1174    /// ```ignore,no_run
1175    /// # use google_cloud_iam_v1::model::BindingDelta;
1176    /// use google_cloud_iam_v1::model::binding_delta::Action;
1177    /// let x0 = BindingDelta::new().set_action(Action::Add);
1178    /// let x1 = BindingDelta::new().set_action(Action::Remove);
1179    /// ```
1180    pub fn set_action<T: std::convert::Into<crate::model::binding_delta::Action>>(
1181        mut self,
1182        v: T,
1183    ) -> Self {
1184        self.action = v.into();
1185        self
1186    }
1187
1188    /// Sets the value of [role][crate::model::BindingDelta::role].
1189    ///
1190    /// # Example
1191    /// ```ignore,no_run
1192    /// # use google_cloud_iam_v1::model::BindingDelta;
1193    /// let x = BindingDelta::new().set_role("example");
1194    /// ```
1195    pub fn set_role<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1196        self.role = v.into();
1197        self
1198    }
1199
1200    /// Sets the value of [member][crate::model::BindingDelta::member].
1201    ///
1202    /// # Example
1203    /// ```ignore,no_run
1204    /// # use google_cloud_iam_v1::model::BindingDelta;
1205    /// let x = BindingDelta::new().set_member("example");
1206    /// ```
1207    pub fn set_member<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1208        self.member = v.into();
1209        self
1210    }
1211
1212    /// Sets the value of [condition][crate::model::BindingDelta::condition].
1213    ///
1214    /// # Example
1215    /// ```ignore,no_run
1216    /// # use google_cloud_iam_v1::model::BindingDelta;
1217    /// use google_cloud_type::model::Expr;
1218    /// let x = BindingDelta::new().set_condition(Expr::default()/* use setters */);
1219    /// ```
1220    pub fn set_condition<T>(mut self, v: T) -> Self
1221    where
1222        T: std::convert::Into<google_cloud_type::model::Expr>,
1223    {
1224        self.condition = std::option::Option::Some(v.into());
1225        self
1226    }
1227
1228    /// Sets or clears the value of [condition][crate::model::BindingDelta::condition].
1229    ///
1230    /// # Example
1231    /// ```ignore,no_run
1232    /// # use google_cloud_iam_v1::model::BindingDelta;
1233    /// use google_cloud_type::model::Expr;
1234    /// let x = BindingDelta::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
1235    /// let x = BindingDelta::new().set_or_clear_condition(None::<Expr>);
1236    /// ```
1237    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
1238    where
1239        T: std::convert::Into<google_cloud_type::model::Expr>,
1240    {
1241        self.condition = v.map(|x| x.into());
1242        self
1243    }
1244}
1245
1246impl wkt::message::Message for BindingDelta {
1247    fn typename() -> &'static str {
1248        "type.googleapis.com/google.iam.v1.BindingDelta"
1249    }
1250}
1251
1252/// Defines additional types related to [BindingDelta].
1253pub mod binding_delta {
1254    #[allow(unused_imports)]
1255    use super::*;
1256
1257    /// The type of action performed on a Binding in a policy.
1258    ///
1259    /// # Working with unknown values
1260    ///
1261    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1262    /// additional enum variants at any time. Adding new variants is not considered
1263    /// a breaking change. Applications should write their code in anticipation of:
1264    ///
1265    /// - New values appearing in future releases of the client library, **and**
1266    /// - New values received dynamically, without application changes.
1267    ///
1268    /// Please consult the [Working with enums] section in the user guide for some
1269    /// guidelines.
1270    ///
1271    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1272    #[derive(Clone, Debug, PartialEq)]
1273    #[non_exhaustive]
1274    pub enum Action {
1275        /// Unspecified.
1276        Unspecified,
1277        /// Addition of a Binding.
1278        Add,
1279        /// Removal of a Binding.
1280        Remove,
1281        /// If set, the enum was initialized with an unknown value.
1282        ///
1283        /// Applications can examine the value using [Action::value] or
1284        /// [Action::name].
1285        UnknownValue(action::UnknownValue),
1286    }
1287
1288    #[doc(hidden)]
1289    pub mod action {
1290        #[allow(unused_imports)]
1291        use super::*;
1292        #[derive(Clone, Debug, PartialEq)]
1293        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1294    }
1295
1296    impl Action {
1297        /// Gets the enum value.
1298        ///
1299        /// Returns `None` if the enum contains an unknown value deserialized from
1300        /// the string representation of enums.
1301        pub fn value(&self) -> std::option::Option<i32> {
1302            match self {
1303                Self::Unspecified => std::option::Option::Some(0),
1304                Self::Add => std::option::Option::Some(1),
1305                Self::Remove => std::option::Option::Some(2),
1306                Self::UnknownValue(u) => u.0.value(),
1307            }
1308        }
1309
1310        /// Gets the enum value as a string.
1311        ///
1312        /// Returns `None` if the enum contains an unknown value deserialized from
1313        /// the integer representation of enums.
1314        pub fn name(&self) -> std::option::Option<&str> {
1315            match self {
1316                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
1317                Self::Add => std::option::Option::Some("ADD"),
1318                Self::Remove => std::option::Option::Some("REMOVE"),
1319                Self::UnknownValue(u) => u.0.name(),
1320            }
1321        }
1322    }
1323
1324    impl std::default::Default for Action {
1325        fn default() -> Self {
1326            use std::convert::From;
1327            Self::from(0)
1328        }
1329    }
1330
1331    impl std::fmt::Display for Action {
1332        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1333            wkt::internal::display_enum(f, self.name(), self.value())
1334        }
1335    }
1336
1337    impl std::convert::From<i32> for Action {
1338        fn from(value: i32) -> Self {
1339            match value {
1340                0 => Self::Unspecified,
1341                1 => Self::Add,
1342                2 => Self::Remove,
1343                _ => Self::UnknownValue(action::UnknownValue(
1344                    wkt::internal::UnknownEnumValue::Integer(value),
1345                )),
1346            }
1347        }
1348    }
1349
1350    impl std::convert::From<&str> for Action {
1351        fn from(value: &str) -> Self {
1352            use std::string::ToString;
1353            match value {
1354                "ACTION_UNSPECIFIED" => Self::Unspecified,
1355                "ADD" => Self::Add,
1356                "REMOVE" => Self::Remove,
1357                _ => Self::UnknownValue(action::UnknownValue(
1358                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1359                )),
1360            }
1361        }
1362    }
1363
1364    impl serde::ser::Serialize for Action {
1365        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1366        where
1367            S: serde::Serializer,
1368        {
1369            match self {
1370                Self::Unspecified => serializer.serialize_i32(0),
1371                Self::Add => serializer.serialize_i32(1),
1372                Self::Remove => serializer.serialize_i32(2),
1373                Self::UnknownValue(u) => u.0.serialize(serializer),
1374            }
1375        }
1376    }
1377
1378    impl<'de> serde::de::Deserialize<'de> for Action {
1379        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1380        where
1381            D: serde::Deserializer<'de>,
1382        {
1383            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
1384                ".google.iam.v1.BindingDelta.Action",
1385            ))
1386        }
1387    }
1388}
1389
1390/// One delta entry for AuditConfig. Each individual change (only one
1391/// exempted_member in each entry) to a AuditConfig will be a separate entry.
1392#[derive(Clone, Default, PartialEq)]
1393#[non_exhaustive]
1394pub struct AuditConfigDelta {
1395    /// The action that was performed on an audit configuration in a policy.
1396    /// Required
1397    pub action: crate::model::audit_config_delta::Action,
1398
1399    /// Specifies a service that was configured for Cloud Audit Logging.
1400    /// For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
1401    /// `allServices` is a special value that covers all services.
1402    /// Required
1403    pub service: std::string::String,
1404
1405    /// A single identity that is exempted from "data access" audit
1406    /// logging for the `service` specified above.
1407    /// Follows the same format of Binding.members.
1408    pub exempted_member: std::string::String,
1409
1410    /// Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always
1411    /// enabled, and cannot be configured.
1412    /// Required
1413    pub log_type: std::string::String,
1414
1415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1416}
1417
1418impl AuditConfigDelta {
1419    pub fn new() -> Self {
1420        std::default::Default::default()
1421    }
1422
1423    /// Sets the value of [action][crate::model::AuditConfigDelta::action].
1424    ///
1425    /// # Example
1426    /// ```ignore,no_run
1427    /// # use google_cloud_iam_v1::model::AuditConfigDelta;
1428    /// use google_cloud_iam_v1::model::audit_config_delta::Action;
1429    /// let x0 = AuditConfigDelta::new().set_action(Action::Add);
1430    /// let x1 = AuditConfigDelta::new().set_action(Action::Remove);
1431    /// ```
1432    pub fn set_action<T: std::convert::Into<crate::model::audit_config_delta::Action>>(
1433        mut self,
1434        v: T,
1435    ) -> Self {
1436        self.action = v.into();
1437        self
1438    }
1439
1440    /// Sets the value of [service][crate::model::AuditConfigDelta::service].
1441    ///
1442    /// # Example
1443    /// ```ignore,no_run
1444    /// # use google_cloud_iam_v1::model::AuditConfigDelta;
1445    /// let x = AuditConfigDelta::new().set_service("example");
1446    /// ```
1447    pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1448        self.service = v.into();
1449        self
1450    }
1451
1452    /// Sets the value of [exempted_member][crate::model::AuditConfigDelta::exempted_member].
1453    ///
1454    /// # Example
1455    /// ```ignore,no_run
1456    /// # use google_cloud_iam_v1::model::AuditConfigDelta;
1457    /// let x = AuditConfigDelta::new().set_exempted_member("example");
1458    /// ```
1459    pub fn set_exempted_member<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1460        self.exempted_member = v.into();
1461        self
1462    }
1463
1464    /// Sets the value of [log_type][crate::model::AuditConfigDelta::log_type].
1465    ///
1466    /// # Example
1467    /// ```ignore,no_run
1468    /// # use google_cloud_iam_v1::model::AuditConfigDelta;
1469    /// let x = AuditConfigDelta::new().set_log_type("example");
1470    /// ```
1471    pub fn set_log_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1472        self.log_type = v.into();
1473        self
1474    }
1475}
1476
1477impl wkt::message::Message for AuditConfigDelta {
1478    fn typename() -> &'static str {
1479        "type.googleapis.com/google.iam.v1.AuditConfigDelta"
1480    }
1481}
1482
1483/// Defines additional types related to [AuditConfigDelta].
1484pub mod audit_config_delta {
1485    #[allow(unused_imports)]
1486    use super::*;
1487
1488    /// The type of action performed on an audit configuration in a policy.
1489    ///
1490    /// # Working with unknown values
1491    ///
1492    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1493    /// additional enum variants at any time. Adding new variants is not considered
1494    /// a breaking change. Applications should write their code in anticipation of:
1495    ///
1496    /// - New values appearing in future releases of the client library, **and**
1497    /// - New values received dynamically, without application changes.
1498    ///
1499    /// Please consult the [Working with enums] section in the user guide for some
1500    /// guidelines.
1501    ///
1502    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1503    #[derive(Clone, Debug, PartialEq)]
1504    #[non_exhaustive]
1505    pub enum Action {
1506        /// Unspecified.
1507        Unspecified,
1508        /// Addition of an audit configuration.
1509        Add,
1510        /// Removal of an audit configuration.
1511        Remove,
1512        /// If set, the enum was initialized with an unknown value.
1513        ///
1514        /// Applications can examine the value using [Action::value] or
1515        /// [Action::name].
1516        UnknownValue(action::UnknownValue),
1517    }
1518
1519    #[doc(hidden)]
1520    pub mod action {
1521        #[allow(unused_imports)]
1522        use super::*;
1523        #[derive(Clone, Debug, PartialEq)]
1524        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1525    }
1526
1527    impl Action {
1528        /// Gets the enum value.
1529        ///
1530        /// Returns `None` if the enum contains an unknown value deserialized from
1531        /// the string representation of enums.
1532        pub fn value(&self) -> std::option::Option<i32> {
1533            match self {
1534                Self::Unspecified => std::option::Option::Some(0),
1535                Self::Add => std::option::Option::Some(1),
1536                Self::Remove => std::option::Option::Some(2),
1537                Self::UnknownValue(u) => u.0.value(),
1538            }
1539        }
1540
1541        /// Gets the enum value as a string.
1542        ///
1543        /// Returns `None` if the enum contains an unknown value deserialized from
1544        /// the integer representation of enums.
1545        pub fn name(&self) -> std::option::Option<&str> {
1546            match self {
1547                Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
1548                Self::Add => std::option::Option::Some("ADD"),
1549                Self::Remove => std::option::Option::Some("REMOVE"),
1550                Self::UnknownValue(u) => u.0.name(),
1551            }
1552        }
1553    }
1554
1555    impl std::default::Default for Action {
1556        fn default() -> Self {
1557            use std::convert::From;
1558            Self::from(0)
1559        }
1560    }
1561
1562    impl std::fmt::Display for Action {
1563        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1564            wkt::internal::display_enum(f, self.name(), self.value())
1565        }
1566    }
1567
1568    impl std::convert::From<i32> for Action {
1569        fn from(value: i32) -> Self {
1570            match value {
1571                0 => Self::Unspecified,
1572                1 => Self::Add,
1573                2 => Self::Remove,
1574                _ => Self::UnknownValue(action::UnknownValue(
1575                    wkt::internal::UnknownEnumValue::Integer(value),
1576                )),
1577            }
1578        }
1579    }
1580
1581    impl std::convert::From<&str> for Action {
1582        fn from(value: &str) -> Self {
1583            use std::string::ToString;
1584            match value {
1585                "ACTION_UNSPECIFIED" => Self::Unspecified,
1586                "ADD" => Self::Add,
1587                "REMOVE" => Self::Remove,
1588                _ => Self::UnknownValue(action::UnknownValue(
1589                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1590                )),
1591            }
1592        }
1593    }
1594
1595    impl serde::ser::Serialize for Action {
1596        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1597        where
1598            S: serde::Serializer,
1599        {
1600            match self {
1601                Self::Unspecified => serializer.serialize_i32(0),
1602                Self::Add => serializer.serialize_i32(1),
1603                Self::Remove => serializer.serialize_i32(2),
1604                Self::UnknownValue(u) => u.0.serialize(serializer),
1605            }
1606        }
1607    }
1608
1609    impl<'de> serde::de::Deserialize<'de> for Action {
1610        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1611        where
1612            D: serde::Deserializer<'de>,
1613        {
1614            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
1615                ".google.iam.v1.AuditConfigDelta.Action",
1616            ))
1617        }
1618    }
1619}
1620
1621/// Output-only policy member strings of a Google Cloud resource's built-in
1622/// identity.
1623#[derive(Clone, Default, PartialEq)]
1624#[non_exhaustive]
1625pub struct ResourcePolicyMember {
1626    /// IAM policy binding member referring to a Google Cloud resource by
1627    /// user-assigned name (<https://google.aip.dev/122>). If a resource is deleted
1628    /// and recreated with the same name, the binding will be applicable to the new
1629    /// resource.
1630    ///
1631    /// Example:
1632    /// `principal://parametermanager.googleapis.com/projects/12345/name/locations/us-central1-a/parameters/my-parameter`
1633    pub iam_policy_name_principal: std::string::String,
1634
1635    /// IAM policy binding member referring to a Google Cloud resource by
1636    /// system-assigned unique identifier (<https://google.aip.dev/148#uid>). If a
1637    /// resource is deleted and recreated with the same name, the binding will not
1638    /// be applicable to the new resource
1639    ///
1640    /// Example:
1641    /// `principal://parametermanager.googleapis.com/projects/12345/uid/locations/us-central1-a/parameters/a918fed5`
1642    pub iam_policy_uid_principal: std::string::String,
1643
1644    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1645}
1646
1647impl ResourcePolicyMember {
1648    pub fn new() -> Self {
1649        std::default::Default::default()
1650    }
1651
1652    /// Sets the value of [iam_policy_name_principal][crate::model::ResourcePolicyMember::iam_policy_name_principal].
1653    ///
1654    /// # Example
1655    /// ```ignore,no_run
1656    /// # use google_cloud_iam_v1::model::ResourcePolicyMember;
1657    /// let x = ResourcePolicyMember::new().set_iam_policy_name_principal("example");
1658    /// ```
1659    pub fn set_iam_policy_name_principal<T: std::convert::Into<std::string::String>>(
1660        mut self,
1661        v: T,
1662    ) -> Self {
1663        self.iam_policy_name_principal = v.into();
1664        self
1665    }
1666
1667    /// Sets the value of [iam_policy_uid_principal][crate::model::ResourcePolicyMember::iam_policy_uid_principal].
1668    ///
1669    /// # Example
1670    /// ```ignore,no_run
1671    /// # use google_cloud_iam_v1::model::ResourcePolicyMember;
1672    /// let x = ResourcePolicyMember::new().set_iam_policy_uid_principal("example");
1673    /// ```
1674    pub fn set_iam_policy_uid_principal<T: std::convert::Into<std::string::String>>(
1675        mut self,
1676        v: T,
1677    ) -> Self {
1678        self.iam_policy_uid_principal = v.into();
1679        self
1680    }
1681}
1682
1683impl wkt::message::Message for ResourcePolicyMember {
1684    fn typename() -> &'static str {
1685        "type.googleapis.com/google.iam.v1.ResourcePolicyMember"
1686    }
1687}