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