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