pub mod folders {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::Folders>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct GetFolder(RequestBuilder<crate::model::GetFolderRequest>);
impl GetFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Folder> {
(*self.0.stub)
.get_folder(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct ListFolders(RequestBuilder<crate::model::ListFoldersRequest>);
impl ListFolders {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListFoldersRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListFoldersResponse> {
(*self.0.stub)
.list_folders(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListFoldersResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.show_deleted = v.into();
self
}
}
impl gax::options::RequestBuilder for ListFolders {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SearchFolders(RequestBuilder<crate::model::SearchFoldersRequest>);
impl SearchFolders {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::SearchFoldersRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SearchFoldersResponse> {
(*self.0.stub)
.search_folders(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::SearchFoldersResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.query = v.into();
self
}
}
impl gax::options::RequestBuilder for SearchFolders {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateFolder(RequestBuilder<crate::model::CreateFolderRequest>);
impl CreateFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_folder(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Folder, crate::model::CreateFolderMetadata> {
type Operation =
lro::Operation<crate::model::Folder, crate::model::CreateFolderMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_folder<T: Into<std::option::Option<crate::model::Folder>>>(
mut self,
v: T,
) -> Self {
self.0.request.folder = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UpdateFolder(RequestBuilder<crate::model::UpdateFolderRequest>);
impl UpdateFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UpdateFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.update_folder(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Folder, crate::model::UpdateFolderMetadata> {
type Operation =
lro::Operation<crate::model::Folder, crate::model::UpdateFolderMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_folder<T: Into<std::option::Option<crate::model::Folder>>>(
mut self,
v: T,
) -> Self {
self.0.request.folder = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for UpdateFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct MoveFolder(RequestBuilder<crate::model::MoveFolderRequest>);
impl MoveFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::MoveFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.move_folder(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Folder, crate::model::MoveFolderMetadata> {
type Operation = lro::Operation<crate::model::Folder, crate::model::MoveFolderMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.destination_parent = v.into();
self
}
}
impl gax::options::RequestBuilder for MoveFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteFolder(RequestBuilder<crate::model::DeleteFolderRequest>);
impl DeleteFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_folder(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Folder, crate::model::DeleteFolderMetadata> {
type Operation =
lro::Operation<crate::model::Folder, crate::model::DeleteFolderMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UndeleteFolder(RequestBuilder<crate::model::UndeleteFolderRequest>);
impl UndeleteFolder {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UndeleteFolderRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.undelete_folder(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Folder, crate::model::UndeleteFolderMetadata> {
type Operation =
lro::Operation<crate::model::Folder, crate::model::UndeleteFolderMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for UndeleteFolder {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
mut self,
v: T,
) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_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.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Folders>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod organizations {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::Organizations>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct GetOrganization(RequestBuilder<crate::model::GetOrganizationRequest>);
impl GetOrganization {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetOrganizationRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Organization> {
(*self.0.stub)
.get_organization(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOrganization {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SearchOrganizations(RequestBuilder<crate::model::SearchOrganizationsRequest>);
impl SearchOrganizations {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::SearchOrganizationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SearchOrganizationsResponse> {
(*self.0.stub)
.search_organizations(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::SearchOrganizationsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.query = v.into();
self
}
}
impl gax::options::RequestBuilder for SearchOrganizations {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
mut self,
v: T,
) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_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.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Organizations>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod projects {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::Projects>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct GetProject(RequestBuilder<crate::model::GetProjectRequest>);
impl GetProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Project> {
(*self.0.stub)
.get_project(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct ListProjects(RequestBuilder<crate::model::ListProjectsRequest>);
impl ListProjects {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListProjectsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListProjectsResponse> {
(*self.0.stub)
.list_projects(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListProjectsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.show_deleted = v.into();
self
}
}
impl gax::options::RequestBuilder for ListProjects {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SearchProjects(RequestBuilder<crate::model::SearchProjectsRequest>);
impl SearchProjects {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::SearchProjectsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SearchProjectsResponse> {
(*self.0.stub)
.search_projects(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::SearchProjectsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.query = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
}
impl gax::options::RequestBuilder for SearchProjects {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateProject(RequestBuilder<crate::model::CreateProjectRequest>);
impl CreateProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_project(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Project, crate::model::CreateProjectMetadata> {
type Operation =
lro::Operation<crate::model::Project, crate::model::CreateProjectMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_project<T: Into<std::option::Option<crate::model::Project>>>(
mut self,
v: T,
) -> Self {
self.0.request.project = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UpdateProject(RequestBuilder<crate::model::UpdateProjectRequest>);
impl UpdateProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UpdateProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.update_project(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Project, crate::model::UpdateProjectMetadata> {
type Operation =
lro::Operation<crate::model::Project, crate::model::UpdateProjectMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_project<T: Into<std::option::Option<crate::model::Project>>>(
mut self,
v: T,
) -> Self {
self.0.request.project = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for UpdateProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct MoveProject(RequestBuilder<crate::model::MoveProjectRequest>);
impl MoveProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::MoveProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.move_project(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Project, crate::model::MoveProjectMetadata> {
type Operation =
lro::Operation<crate::model::Project, crate::model::MoveProjectMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_destination_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.destination_parent = v.into();
self
}
}
impl gax::options::RequestBuilder for MoveProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteProject(RequestBuilder<crate::model::DeleteProjectRequest>);
impl DeleteProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_project(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Project, crate::model::DeleteProjectMetadata> {
type Operation =
lro::Operation<crate::model::Project, crate::model::DeleteProjectMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UndeleteProject(RequestBuilder<crate::model::UndeleteProjectRequest>);
impl UndeleteProject {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UndeleteProjectRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.undelete_project(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::Project, crate::model::UndeleteProjectMetadata>
{
type Operation =
lro::Operation<crate::model::Project, crate::model::UndeleteProjectMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for UndeleteProject {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
mut self,
v: T,
) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_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.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::Projects>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod tag_bindings {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::TagBindings>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListTagBindings(RequestBuilder<crate::model::ListTagBindingsRequest>);
impl ListTagBindings {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListTagBindingsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListTagBindingsResponse> {
(*self.0.stub)
.list_tag_bindings(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListTagBindingsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
impl gax::options::RequestBuilder for ListTagBindings {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateTagBinding(RequestBuilder<crate::model::CreateTagBindingRequest>);
impl CreateTagBinding {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateTagBindingRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_tag_binding(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagBinding, crate::model::CreateTagBindingMetadata>
{
type Operation =
lro::Operation<crate::model::TagBinding, crate::model::CreateTagBindingMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_tag_binding<T: Into<std::option::Option<crate::model::TagBinding>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_binding = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateTagBinding {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteTagBinding(RequestBuilder<crate::model::DeleteTagBindingRequest>);
impl DeleteTagBinding {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteTagBindingRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_tag_binding(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<wkt::Empty, crate::model::DeleteTagBindingMetadata> {
type Operation = lro::Operation<wkt::Empty, crate::model::DeleteTagBindingMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteTagBinding {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct ListEffectiveTags(RequestBuilder<crate::model::ListEffectiveTagsRequest>);
impl ListEffectiveTags {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListEffectiveTagsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListEffectiveTagsResponse> {
(*self.0.stub)
.list_effective_tags(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListEffectiveTagsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
impl gax::options::RequestBuilder for ListEffectiveTags {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagBindings>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod tag_holds {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::TagHolds>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagHolds>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct CreateTagHold(RequestBuilder<crate::model::CreateTagHoldRequest>);
impl CreateTagHold {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagHolds>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateTagHoldRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_tag_hold(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagHold, crate::model::CreateTagHoldMetadata> {
type Operation =
lro::Operation<crate::model::TagHold, crate::model::CreateTagHoldMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_tag_hold<T: Into<std::option::Option<crate::model::TagHold>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_hold = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateTagHold {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteTagHold(RequestBuilder<crate::model::DeleteTagHoldRequest>);
impl DeleteTagHold {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagHolds>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteTagHoldRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_tag_hold(self.0.request, self.0.options)
.await
}
pub fn poller(self) -> impl lro::Poller<wkt::Empty, crate::model::DeleteTagHoldMetadata> {
type Operation = lro::Operation<wkt::Empty, crate::model::DeleteTagHoldMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteTagHold {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct ListTagHolds(RequestBuilder<crate::model::ListTagHoldsRequest>);
impl ListTagHolds {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagHolds>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListTagHoldsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListTagHoldsResponse> {
(*self.0.stub)
.list_tag_holds(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListTagHoldsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
impl gax::options::RequestBuilder for ListTagHolds {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagHolds>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod tag_keys {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::TagKeys>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListTagKeys(RequestBuilder<crate::model::ListTagKeysRequest>);
impl ListTagKeys {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListTagKeysRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListTagKeysResponse> {
(*self.0.stub)
.list_tag_keys(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListTagKeysResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
impl gax::options::RequestBuilder for ListTagKeys {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetTagKey(RequestBuilder<crate::model::GetTagKeyRequest>);
impl GetTagKey {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetTagKeyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::TagKey> {
(*self.0.stub)
.get_tag_key(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetTagKey {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetNamespacedTagKey(RequestBuilder<crate::model::GetNamespacedTagKeyRequest>);
impl GetNamespacedTagKey {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetNamespacedTagKeyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::TagKey> {
(*self.0.stub)
.get_namespaced_tag_key(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetNamespacedTagKey {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateTagKey(RequestBuilder<crate::model::CreateTagKeyRequest>);
impl CreateTagKey {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateTagKeyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_tag_key(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagKey, crate::model::CreateTagKeyMetadata> {
type Operation =
lro::Operation<crate::model::TagKey, crate::model::CreateTagKeyMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_tag_key<T: Into<std::option::Option<crate::model::TagKey>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_key = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateTagKey {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UpdateTagKey(RequestBuilder<crate::model::UpdateTagKeyRequest>);
impl UpdateTagKey {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UpdateTagKeyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.update_tag_key(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagKey, crate::model::UpdateTagKeyMetadata> {
type Operation =
lro::Operation<crate::model::TagKey, crate::model::UpdateTagKeyMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_tag_key<T: Into<std::option::Option<crate::model::TagKey>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_key = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for UpdateTagKey {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteTagKey(RequestBuilder<crate::model::DeleteTagKeyRequest>);
impl DeleteTagKey {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteTagKeyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_tag_key(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagKey, crate::model::DeleteTagKeyMetadata> {
type Operation =
lro::Operation<crate::model::TagKey, crate::model::DeleteTagKeyMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteTagKey {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
mut self,
v: T,
) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_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.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagKeys>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}
pub mod tag_values {
use crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct RequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::stubs::dynamic::TagValues>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListTagValues(RequestBuilder<crate::model::ListTagValuesRequest>);
impl ListTagValues {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListTagValuesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListTagValuesResponse> {
(*self.0.stub)
.list_tag_values(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListTagValuesResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
impl gax::options::RequestBuilder for ListTagValues {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetTagValue(RequestBuilder<crate::model::GetTagValueRequest>);
impl GetTagValue {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetTagValueRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::TagValue> {
(*self.0.stub)
.get_tag_value(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetTagValue {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetNamespacedTagValue(RequestBuilder<crate::model::GetNamespacedTagValueRequest>);
impl GetNamespacedTagValue {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetNamespacedTagValueRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<crate::model::TagValue> {
(*self.0.stub)
.get_namespaced_tag_value(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetNamespacedTagValue {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateTagValue(RequestBuilder<crate::model::CreateTagValueRequest>);
impl CreateTagValue {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateTagValueRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.create_tag_value(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagValue, crate::model::CreateTagValueMetadata>
{
type Operation =
lro::Operation<crate::model::TagValue, crate::model::CreateTagValueMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_tag_value<T: Into<std::option::Option<crate::model::TagValue>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_value = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateTagValue {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UpdateTagValue(RequestBuilder<crate::model::UpdateTagValueRequest>);
impl UpdateTagValue {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UpdateTagValueRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.update_tag_value(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagValue, crate::model::UpdateTagValueMetadata>
{
type Operation =
lro::Operation<crate::model::TagValue, crate::model::UpdateTagValueMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_tag_value<T: Into<std::option::Option<crate::model::TagValue>>>(
mut self,
v: T,
) -> Self {
self.0.request.tag_value = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
}
impl gax::options::RequestBuilder for UpdateTagValue {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteTagValue(RequestBuilder<crate::model::DeleteTagValueRequest>);
impl DeleteTagValue {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteTagValueRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.delete_tag_value(self.0.request, self.0.options)
.await
}
pub fn poller(
self,
) -> impl lro::Poller<crate::model::TagValue, crate::model::DeleteTagValueMetadata>
{
type Operation =
lro::Operation<crate::model::TagValue, crate::model::DeleteTagValueMetadata>;
let polling_policy = self.0.stub.get_polling_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(gax::retry_policy::NeverRetry);
let query = move |name| {
let stub = stub.clone();
let options = options.clone();
async {
let op = GetOperation::new(stub)
.set_name(name)
.with_options(options)
.send()
.await?;
Ok(Operation::new(op))
}
};
let start = move || async {
let op = self.send().await?;
Ok(Operation::new(op))
};
lro::new_poller(polling_policy, polling_backoff_policy, start, query)
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.validate_only = v.into();
self
}
pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteTagValue {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<std::option::Option<iam_v1::model::GetPolicyOptions>>>(
mut self,
v: T,
) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<std::option::Option<iam_v1::model::Policy>>>(
mut self,
v: T,
) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<std::option::Option<wkt::FieldMask>>>(
mut self,
v: T,
) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_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.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(stub: Arc<dyn crate::stubs::dynamic::TagValues>) -> Self {
Self(RequestBuilder::new(stub))
}
pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
pub async fn send(self) -> Result<longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
}