#![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 gaxi;
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;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DenyRule {
pub denied_principals: std::vec::Vec<std::string::String>,
pub exception_principals: std::vec::Vec<std::string::String>,
pub denied_permissions: std::vec::Vec<std::string::String>,
pub exception_permissions: std::vec::Vec<std::string::String>,
pub denial_condition: std::option::Option<gtype::model::Expr>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DenyRule {
pub fn new() -> Self {
std::default::Default::default()
}
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
}
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
}
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
}
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
}
pub fn set_denial_condition<T>(mut self, v: T) -> Self
where
T: std::convert::Into<gtype::model::Expr>,
{
self.denial_condition = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_denial_condition<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<gtype::model::Expr>,
{
self.denial_condition = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for DenyRule {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.DenyRule"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Policy {
pub name: std::string::String,
pub uid: std::string::String,
pub kind: std::string::String,
pub display_name: std::string::String,
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
pub etag: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub delete_time: std::option::Option<wkt::Timestamp>,
pub rules: std::vec::Vec<crate::model::PolicyRule>,
pub managing_authority: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Policy {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = v.into();
self
}
pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
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
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_delete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = v.map(|x| x.into());
self
}
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
}
pub fn set_managing_authority<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.managing_authority = v.into();
self
}
}
impl wkt::message::Message for Policy {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.Policy"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PolicyRule {
pub description: std::string::String,
pub kind: std::option::Option<crate::model::policy_rule::Kind>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PolicyRule {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
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
}
pub fn 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,
})
}
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"
}
}
pub mod policy_rule {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Kind {
DenyRule(std::boxed::Box<crate::model::DenyRule>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPoliciesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListPoliciesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPoliciesResponse {
pub policies: std::vec::Vec<crate::model::Policy>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListPoliciesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
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
}
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
}
}
impl wkt::message::Message for ListPoliciesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.ListPoliciesResponse"
}
}
#[doc(hidden)]
impl gax::paginator::internal::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 {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPolicyRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetPolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatePolicyRequest {
pub parent: std::string::String,
pub policy: std::option::Option<crate::model::Policy>,
pub policy_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreatePolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = v.map(|x| x.into());
self
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdatePolicyRequest {
pub policy: std::option::Option<crate::model::Policy>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdatePolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Policy>,
{
self.policy = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdatePolicyRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.UpdatePolicyRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePolicyRequest {
pub name: std::string::String,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeletePolicyRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PolicyOperationMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PolicyOperationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for PolicyOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.iam.v2.PolicyOperationMetadata"
}
}