gcp_sdk_iam_v2/model.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gtype;
extern crate lazy_static;
extern crate longrunning;
extern crate lro;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
/// A deny rule in an IAM deny policy.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DenyRule {
/// The identities that are prevented from using one or more permissions on
/// Google Cloud resources. This field can contain the following values:
///
/// * `principalSet://goog/public:all`: A special identifier that represents
/// any principal that is on the internet, even if they do not have a Google
/// Account or are not logged in.
///
/// * `principal://goog/subject/{email_id}`: A specific Google Account.
/// Includes Gmail, Cloud Identity, and Google Workspace user accounts. For
/// example, `principal://goog/subject/alice@example.com`.
///
/// * `deleted:principal://goog/subject/{email_id}?uid={uid}`: A specific
/// Google Account that was deleted recently. For example,
/// `deleted:principal://goog/subject/alice@example.com?uid=1234567890`. If
/// the Google Account is recovered, this identifier reverts to the standard
/// identifier for a Google Account.
///
/// * `principalSet://goog/group/{group_id}`: A Google group. For example,
/// `principalSet://goog/group/admins@example.com`.
///
/// * `deleted:principalSet://goog/group/{group_id}?uid={uid}`: A Google group
/// that was deleted recently. For example,
/// `deleted:principalSet://goog/group/admins@example.com?uid=1234567890`. If
/// the Google group is restored, this identifier reverts to the standard
/// identifier for a Google group.
///
/// * `principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}`:
/// A Google Cloud service account. For example,
/// `principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com`.
///
/// * `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/{service_account_id}?uid={uid}`:
/// A Google Cloud service account that was deleted recently. For example,
/// `deleted:principal://iam.googleapis.com/projects/-/serviceAccounts/my-service-account@iam.gserviceaccount.com?uid=1234567890`.
/// If the service account is undeleted, this identifier reverts to the
/// standard identifier for a service account.
///
/// * `principalSet://goog/cloudIdentityCustomerId/{customer_id}`: All of the
/// principals associated with the specified Google Workspace or Cloud
/// Identity customer ID. For example,
/// `principalSet://goog/cloudIdentityCustomerId/C01Abc35`.
///
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub denied_principals: std::vec::Vec<std::string::String>,
/// The identities that are excluded from the deny rule, even if they are
/// listed in the `denied_principals`. For example, you could add a Google
/// group to the `denied_principals`, then exclude specific users who belong to
/// that group.
///
/// This field can contain the same values as the `denied_principals` field,
/// excluding `principalSet://goog/public:all`, which represents all users on
/// the internet.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub exception_principals: std::vec::Vec<std::string::String>,
/// The permissions that are explicitly denied by this rule. Each permission
/// uses the format `{service_fqdn}/{resource}.{verb}`, where `{service_fqdn}`
/// is the fully qualified domain name for the service. For example,
/// `iam.googleapis.com/roles.list`.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub denied_permissions: std::vec::Vec<std::string::String>,
/// Specifies the permissions that this rule excludes from the set of denied
/// permissions given by `denied_permissions`. If a permission appears in
/// `denied_permissions` _and_ in `exception_permissions` then it will _not_ be
/// denied.
///
/// The excluded permissions can be specified using the same syntax as
/// `denied_permissions`.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub exception_permissions: std::vec::Vec<std::string::String>,
/// The condition that determines whether this deny rule applies to a request.
/// If the condition expression evaluates to `true`, then the deny rule is
/// applied; otherwise, the deny rule is not applied.
///
/// Each deny rule is evaluated independently. If this deny rule does not apply
/// to a request, other deny rules might still apply.
///
/// The condition can use CEL functions that evaluate
/// [resource
/// tags](https://cloud.google.com/iam/help/conditions/resource-tags). Other
/// functions and operators are not supported.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub denial_condition: std::option::Option<gtype::model::Expr>,
}
impl DenyRule {
/// Sets the value of [denial_condition][crate::model::DenyRule::denial_condition].
pub fn set_denial_condition<T: std::convert::Into<std::option::Option<gtype::model::Expr>>>(
mut self,
v: T,
) -> Self {
self.denial_condition = v.into();
self
}
/// Sets the value of [denied_principals][crate::model::DenyRule::denied_principals].
pub fn set_denied_principals<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.denied_principals = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [exception_principals][crate::model::DenyRule::exception_principals].
pub fn set_exception_principals<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.exception_principals = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [denied_permissions][crate::model::DenyRule::denied_permissions].
pub fn set_denied_permissions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.denied_permissions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [exception_permissions][crate::model::DenyRule::exception_permissions].
pub fn set_exception_permissions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.exception_permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for DenyRule {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.DenyRule"
}
}
/// Data for an IAM policy.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct Policy {
/// Immutable. The resource name of the `Policy`, which must be unique. Format:
/// `policies/{attachment_point}/denypolicies/{policy_id}`
///
/// The attachment point is identified by its URL-encoded full resource name,
/// which means that the forward-slash character, `/`, must be written as
/// `%2F`. For example,
/// `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-deny-policy`.
///
/// For organizations and folders, use the numeric ID in the full resource
/// name. For projects, requests can use the alphanumeric or the numeric ID.
/// Responses always contain the numeric ID.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
/// Immutable. The globally unique ID of the `Policy`. Assigned automatically when the
/// `Policy` is created.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub uid: std::string::String,
/// Output only. The kind of the `Policy`. Always contains the value `DenyPolicy`.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub kind: std::string::String,
/// A user-specified description of the `Policy`. This value can be up to 63
/// characters.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub display_name: std::string::String,
/// A key-value map to store arbitrary metadata for the `Policy`. Keys
/// can be up to 63 characters. Values can be up to 255 characters.
#[serde(skip_serializing_if = "std::collections::HashMap::is_empty")]
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
/// An opaque tag that identifies the current version of the `Policy`. IAM uses
/// this value to help manage concurrent updates, so they do not cause one
/// update to be overwritten by another.
///
/// If this field is present in a [CreatePolicy][] request, the value is
/// ignored.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub etag: std::string::String,
/// Output only. The time when the `Policy` was created.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time when the `Policy` was last updated.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub update_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time when the `Policy` was deleted. Empty if the policy is not deleted.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub delete_time: std::option::Option<wkt::Timestamp>,
/// A list of rules that specify the behavior of the `Policy`. All of the rules
/// should be of the `kind` specified in the `Policy`.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub rules: std::vec::Vec<crate::model::PolicyRule>,
/// Immutable. Specifies that this policy is managed by an authority and can only be
/// modified by that authority. Usage is restricted.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub managing_authority: std::string::String,
}
impl Policy {
/// Sets the value of [name][crate::model::Policy::name].
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [uid][crate::model::Policy::uid].
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = v.into();
self
}
/// Sets the value of [kind][crate::model::Policy::kind].
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [display_name][crate::model::Policy::display_name].
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [etag][crate::model::Policy::etag].
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
/// Sets the value of [create_time][crate::model::Policy::create_time].
pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.create_time = v.into();
self
}
/// Sets the value of [update_time][crate::model::Policy::update_time].
pub fn set_update_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.update_time = v.into();
self
}
/// Sets the value of [delete_time][crate::model::Policy::delete_time].
pub fn set_delete_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.delete_time = v.into();
self
}
/// Sets the value of [managing_authority][crate::model::Policy::managing_authority].
pub fn set_managing_authority<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.managing_authority = v.into();
self
}
/// Sets the value of [rules][crate::model::Policy::rules].
pub fn set_rules<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PolicyRule>,
{
use std::iter::Iterator;
self.rules = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [annotations][crate::model::Policy::annotations].
pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for Policy {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.Policy"
}
}
/// A single rule in a `Policy`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct PolicyRule {
/// A user-specified description of the rule. This value can be up to 256
/// characters.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub description: std::string::String,
#[serde(flatten, skip_serializing_if = "std::option::Option::is_none")]
pub kind: std::option::Option<crate::model::policy_rule::Kind>,
}
impl PolicyRule {
/// Sets the value of [description][crate::model::PolicyRule::description].
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of `kind`.
pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
mut self,
v: T,
) -> Self {
self.kind = v.into();
self
}
/// The value of [kind][crate::model::PolicyRule::kind]
/// if it holds a `DenyRule`, `None` if the field is not set or
/// holds a different branch.
pub fn get_deny_rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::DenyRule>> {
#[allow(unreachable_patterns)]
self.kind.as_ref().and_then(|v| match v {
crate::model::policy_rule::Kind::DenyRule(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [kind][crate::model::PolicyRule::kind]
/// to hold a `DenyRule`.
///
/// Note that all the setters affecting `kind` are
/// mutually exclusive.
pub fn set_deny_rule<T: std::convert::Into<std::boxed::Box<crate::model::DenyRule>>>(
mut self,
v: T,
) -> Self {
self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyRule(v.into()));
self
}
}
impl wkt::message::Message for PolicyRule {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.PolicyRule"
}
}
/// Defines additional types related to PolicyRule
pub mod policy_rule {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub enum Kind {
/// A rule for a deny policy.
DenyRule(std::boxed::Box<crate::model::DenyRule>),
}
}
/// Request message for `ListPolicies`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ListPoliciesRequest {
/// Required. The resource that the policy is attached to, along with the kind of policy
/// to list. Format:
/// `policies/{attachment_point}/denypolicies`
///
/// The attachment point is identified by its URL-encoded full resource name,
/// which means that the forward-slash character, `/`, must be written as
/// `%2F`. For example,
/// `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
///
/// For organizations and folders, use the numeric ID in the full resource
/// name. For projects, you can use the alphanumeric or the numeric ID.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
/// The maximum number of policies to return. IAM ignores this value and uses
/// the value 1000.
pub page_size: i32,
/// A page token received in a [ListPoliciesResponse][google.iam.v2.ListPoliciesResponse]. Provide this token to
/// retrieve the next page.
///
/// [google.iam.v2.ListPoliciesResponse]: crate::model::ListPoliciesResponse
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub page_token: std::string::String,
}
impl ListPoliciesRequest {
/// Sets the value of [parent][crate::model::ListPoliciesRequest::parent].
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListPoliciesRequest::page_size].
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListPoliciesRequest::page_token].
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for ListPoliciesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.ListPoliciesRequest"
}
}
/// Response message for `ListPolicies`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct ListPoliciesResponse {
/// Metadata for the policies that are attached to the resource.
#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
pub policies: std::vec::Vec<crate::model::Policy>,
/// A page token that you can use in a [ListPoliciesRequest][google.iam.v2.ListPoliciesRequest] to retrieve the
/// next page. If this field is omitted, there are no additional pages.
///
/// [google.iam.v2.ListPoliciesRequest]: crate::model::ListPoliciesRequest
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub next_page_token: std::string::String,
}
impl ListPoliciesResponse {
/// Sets the value of [next_page_token][crate::model::ListPoliciesResponse::next_page_token].
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
/// Sets the value of [policies][crate::model::ListPoliciesResponse::policies].
pub fn set_policies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Policy>,
{
use std::iter::Iterator;
self.policies = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListPoliciesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.ListPoliciesResponse"
}
}
#[cfg(feature = "unstable-stream")]
impl gax::paginator::PageableResponse for ListPoliciesResponse {
type PageItem = crate::model::Policy;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.policies
}
fn next_page_token(&self) -> std::string::String {
gax::paginator::extract_token(&self.next_page_token)
}
}
/// Request message for `GetPolicy`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct GetPolicyRequest {
/// Required. The resource name of the policy to retrieve. Format:
/// `policies/{attachment_point}/denypolicies/{policy_id}`
///
/// Use the URL-encoded full resource name, which means that the forward-slash
/// character, `/`, must be written as `%2F`. For example,
/// `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
///
/// For organizations and folders, use the numeric ID in the full resource
/// name. For projects, you can use the alphanumeric or the numeric ID.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
}
impl GetPolicyRequest {
/// Sets the value of [name][crate::model::GetPolicyRequest::name].
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetPolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.GetPolicyRequest"
}
}
/// Request message for `CreatePolicy`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct CreatePolicyRequest {
/// Required. The resource that the policy is attached to, along with the kind of policy
/// to create. Format: `policies/{attachment_point}/denypolicies`
///
/// The attachment point is identified by its URL-encoded full resource name,
/// which means that the forward-slash character, `/`, must be written as
/// `%2F`. For example,
/// `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`.
///
/// For organizations and folders, use the numeric ID in the full resource
/// name. For projects, you can use the alphanumeric or the numeric ID.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub parent: std::string::String,
/// Required. The policy to create.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub policy: std::option::Option<crate::model::Policy>,
/// The ID to use for this policy, which will become the final component of
/// the policy's resource name. The ID must contain 3 to 63 characters. It can
/// contain lowercase letters and numbers, as well as dashes (`-`) and periods
/// (`.`). The first character must be a lowercase letter.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub policy_id: std::string::String,
}
impl CreatePolicyRequest {
/// Sets the value of [parent][crate::model::CreatePolicyRequest::parent].
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [policy][crate::model::CreatePolicyRequest::policy].
pub fn set_policy<T: std::convert::Into<std::option::Option<crate::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.policy = v.into();
self
}
/// Sets the value of [policy_id][crate::model::CreatePolicyRequest::policy_id].
pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.policy_id = v.into();
self
}
}
impl wkt::message::Message for CreatePolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.CreatePolicyRequest"
}
}
/// Request message for `UpdatePolicy`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct UpdatePolicyRequest {
/// Required. The policy to update.
///
/// To prevent conflicting updates, the `etag` value must match the value that
/// is stored in IAM. If the `etag` values do not match, the request fails with
/// a `409` error code and `ABORTED` status.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub policy: std::option::Option<crate::model::Policy>,
}
impl UpdatePolicyRequest {
/// Sets the value of [policy][crate::model::UpdatePolicyRequest::policy].
pub fn set_policy<T: std::convert::Into<std::option::Option<crate::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.policy = v.into();
self
}
}
impl wkt::message::Message for UpdatePolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.UpdatePolicyRequest"
}
}
/// Request message for `DeletePolicy`.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct DeletePolicyRequest {
/// Required. The resource name of the policy to delete. Format:
/// `policies/{attachment_point}/denypolicies/{policy_id}`
///
/// Use the URL-encoded full resource name, which means that the forward-slash
/// character, `/`, must be written as `%2F`. For example,
/// `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`.
///
/// For organizations and folders, use the numeric ID in the full resource
/// name. For projects, you can use the alphanumeric or the numeric ID.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub name: std::string::String,
/// Optional. The expected `etag` of the policy to delete. If the value does not match
/// the value that is stored in IAM, the request fails with a `409` error code
/// and `ABORTED` status.
///
/// If you omit this field, the policy is deleted regardless of its current
/// `etag`.
#[serde(skip_serializing_if = "std::string::String::is_empty")]
pub etag: std::string::String,
}
impl DeletePolicyRequest {
/// Sets the value of [name][crate::model::DeletePolicyRequest::name].
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [etag][crate::model::DeletePolicyRequest::etag].
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for DeletePolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.DeletePolicyRequest"
}
}
/// Metadata for long-running `Policy` operations.
#[serde_with::serde_as]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, rename_all = "camelCase")]
#[non_exhaustive]
pub struct PolicyOperationMetadata {
/// Timestamp when the `google.longrunning.Operation` was created.
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub create_time: std::option::Option<wkt::Timestamp>,
}
impl PolicyOperationMetadata {
/// Sets the value of [create_time][crate::model::PolicyOperationMetadata::create_time].
pub fn set_create_time<T: std::convert::Into<std::option::Option<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.create_time = v.into();
self
}
}
impl wkt::message::Message for PolicyOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.PolicyOperationMetadata"
}
}