// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
/// Request and client builders for [DataFoundryService][crate::client::DataFoundryService].
#[cfg(feature = "data-foundry-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "data-foundry-service")))]
pub mod data_foundry_service {
use crate::Result;
/// A builder for [DataFoundryService][crate::client::DataFoundryService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::data_foundry_service::ClientBuilder;
/// # use client::DataFoundryService;
/// let builder : ClientBuilder = DataFoundryService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::DataFoundryService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = DataFoundryService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::DataFoundryService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [DataFoundryService::generate_synthetic_data][crate::client::DataFoundryService::generate_synthetic_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::GenerateSyntheticData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GenerateSyntheticData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GenerateSyntheticData(RequestBuilder<crate::model::GenerateSyntheticDataRequest>);
impl GenerateSyntheticData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GenerateSyntheticDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::GenerateSyntheticDataResponse> {
(*self.0.stub)
.generate_synthetic_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [location][crate::model::GenerateSyntheticDataRequest::location].
///
/// This is a **required** field for requests.
pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.location = v.into();
self
}
/// Sets the value of [count][crate::model::GenerateSyntheticDataRequest::count].
///
/// This is a **required** field for requests.
pub fn set_count<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.count = v.into();
self
}
/// Sets the value of [output_field_specs][crate::model::GenerateSyntheticDataRequest::output_field_specs].
///
/// This is a **required** field for requests.
pub fn set_output_field_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::OutputFieldSpec>,
{
use std::iter::Iterator;
self.0.request.output_field_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [examples][crate::model::GenerateSyntheticDataRequest::examples].
pub fn set_examples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SyntheticExample>,
{
use std::iter::Iterator;
self.0.request.examples = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [strategy][crate::model::GenerateSyntheticDataRequest::strategy].
///
/// Note that all the setters affecting `strategy` are
/// mutually exclusive.
pub fn set_strategy<
T: Into<Option<crate::model::generate_synthetic_data_request::Strategy>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.strategy = v.into();
self
}
/// Sets the value of [strategy][crate::model::GenerateSyntheticDataRequest::strategy]
/// to hold a `TaskDescription`.
///
/// Note that all the setters affecting `strategy` are
/// mutually exclusive.
pub fn set_task_description<
T: std::convert::Into<std::boxed::Box<crate::model::TaskDescriptionStrategy>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_task_description(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GenerateSyntheticData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::list_locations][crate::client::DataFoundryService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::get_location][crate::client::DataFoundryService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::set_iam_policy][crate::client::DataFoundryService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::get_iam_policy][crate::client::DataFoundryService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::test_iam_permissions][crate::client::DataFoundryService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::list_operations][crate::client::DataFoundryService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::get_operation][crate::client::DataFoundryService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::delete_operation][crate::client::DataFoundryService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::cancel_operation][crate::client::DataFoundryService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DataFoundryService::wait_operation][crate::client::DataFoundryService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::data_foundry_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DataFoundryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [DatasetService][crate::client::DatasetService].
#[cfg(feature = "dataset-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "dataset-service")))]
pub mod dataset_service {
use crate::Result;
/// A builder for [DatasetService][crate::client::DatasetService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::dataset_service::ClientBuilder;
/// # use client::DatasetService;
/// let builder : ClientBuilder = DatasetService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::DatasetService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = DatasetService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::DatasetService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [DatasetService::create_dataset][crate::client::DatasetService::create_dataset] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::CreateDataset;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateDataset {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateDataset(RequestBuilder<crate::model::CreateDatasetRequest>);
impl CreateDataset {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateDatasetRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_dataset][crate::client::DatasetService::create_dataset].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_dataset(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_dataset`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Dataset,
crate::model::CreateDatasetOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Dataset,
crate::model::CreateDatasetOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::create_dataset::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateDatasetRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [dataset][crate::model::CreateDatasetRequest::dataset].
///
/// This is a **required** field for requests.
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.0.request.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::CreateDatasetRequest::dataset].
///
/// This is a **required** field for requests.
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.0.request.dataset = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateDataset {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_dataset][crate::client::DatasetService::get_dataset] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetDataset;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetDataset {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetDataset(RequestBuilder<crate::model::GetDatasetRequest>);
impl GetDataset {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetDatasetRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Dataset> {
(*self.0.stub)
.get_dataset(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetDatasetRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [read_mask][crate::model::GetDatasetRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::GetDatasetRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetDataset {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::update_dataset][crate::client::DatasetService::update_dataset] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::UpdateDataset;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateDataset {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateDataset(RequestBuilder<crate::model::UpdateDatasetRequest>);
impl UpdateDataset {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateDatasetRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Dataset> {
(*self.0.stub)
.update_dataset(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [dataset][crate::model::UpdateDatasetRequest::dataset].
///
/// This is a **required** field for requests.
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.0.request.dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset][crate::model::UpdateDatasetRequest::dataset].
///
/// This is a **required** field for requests.
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.0.request.dataset = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateDatasetRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateDatasetRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateDataset {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_datasets][crate::client::DatasetService::list_datasets] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListDatasets;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListDatasets {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListDatasets(RequestBuilder<crate::model::ListDatasetsRequest>);
impl ListDatasets {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListDatasetsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListDatasetsResponse> {
(*self.0.stub)
.list_datasets(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDatasetsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListDatasetsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListDatasetsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDatasetsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDatasetsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListDatasetsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListDatasetsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListDatasetsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListDatasets {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::delete_dataset][crate::client::DatasetService::delete_dataset] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::DeleteDataset;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteDataset {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteDataset(RequestBuilder<crate::model::DeleteDatasetRequest>);
impl DeleteDataset {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteDatasetRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_dataset][crate::client::DatasetService::delete_dataset].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_dataset(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_dataset`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::delete_dataset::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteDatasetRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteDataset {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::import_data][crate::client::DatasetService::import_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ImportData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ImportData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ImportData(RequestBuilder<crate::model::ImportDataRequest>);
impl ImportData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ImportDataRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [import_data][crate::client::DatasetService::import_data].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.import_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `import_data`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ImportDataResponse,
crate::model::ImportDataOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ImportDataResponse,
crate::model::ImportDataOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::DatasetService::import_data::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::ImportDataRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [import_configs][crate::model::ImportDataRequest::import_configs].
///
/// This is a **required** field for requests.
pub fn set_import_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ImportDataConfig>,
{
use std::iter::Iterator;
self.0.request.import_configs = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ImportData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::export_data][crate::client::DatasetService::export_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ExportData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ExportData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ExportData(RequestBuilder<crate::model::ExportDataRequest>);
impl ExportData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ExportDataRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [export_data][crate::client::DatasetService::export_data].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.export_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `export_data`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ExportDataResponse,
crate::model::ExportDataOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ExportDataResponse,
crate::model::ExportDataOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::DatasetService::export_data::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::ExportDataRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [export_config][crate::model::ExportDataRequest::export_config].
///
/// This is a **required** field for requests.
pub fn set_export_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExportDataConfig>,
{
self.0.request.export_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [export_config][crate::model::ExportDataRequest::export_config].
///
/// This is a **required** field for requests.
pub fn set_or_clear_export_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ExportDataConfig>,
{
self.0.request.export_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ExportData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::create_dataset_version][crate::client::DatasetService::create_dataset_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::CreateDatasetVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateDatasetVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateDatasetVersion(RequestBuilder<crate::model::CreateDatasetVersionRequest>);
impl CreateDatasetVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateDatasetVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_dataset_version][crate::client::DatasetService::create_dataset_version].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_dataset_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_dataset_version`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DatasetVersion,
crate::model::CreateDatasetVersionOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DatasetVersion,
crate::model::CreateDatasetVersionOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::create_dataset_version::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateDatasetVersionRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [dataset_version][crate::model::CreateDatasetVersionRequest::dataset_version].
///
/// This is a **required** field for requests.
pub fn set_dataset_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetVersion>,
{
self.0.request.dataset_version = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset_version][crate::model::CreateDatasetVersionRequest::dataset_version].
///
/// This is a **required** field for requests.
pub fn set_or_clear_dataset_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetVersion>,
{
self.0.request.dataset_version = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateDatasetVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::update_dataset_version][crate::client::DatasetService::update_dataset_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::UpdateDatasetVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateDatasetVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateDatasetVersion(RequestBuilder<crate::model::UpdateDatasetVersionRequest>);
impl UpdateDatasetVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateDatasetVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DatasetVersion> {
(*self.0.stub)
.update_dataset_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [dataset_version][crate::model::UpdateDatasetVersionRequest::dataset_version].
///
/// This is a **required** field for requests.
pub fn set_dataset_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DatasetVersion>,
{
self.0.request.dataset_version = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dataset_version][crate::model::UpdateDatasetVersionRequest::dataset_version].
///
/// This is a **required** field for requests.
pub fn set_or_clear_dataset_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DatasetVersion>,
{
self.0.request.dataset_version = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateDatasetVersionRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateDatasetVersionRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateDatasetVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::delete_dataset_version][crate::client::DatasetService::delete_dataset_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::DeleteDatasetVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteDatasetVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteDatasetVersion(RequestBuilder<crate::model::DeleteDatasetVersionRequest>);
impl DeleteDatasetVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteDatasetVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_dataset_version][crate::client::DatasetService::delete_dataset_version].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_dataset_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_dataset_version`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::delete_dataset_version::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteDatasetVersionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteDatasetVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_dataset_version][crate::client::DatasetService::get_dataset_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetDatasetVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetDatasetVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetDatasetVersion(RequestBuilder<crate::model::GetDatasetVersionRequest>);
impl GetDatasetVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetDatasetVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DatasetVersion> {
(*self.0.stub)
.get_dataset_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetDatasetVersionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [read_mask][crate::model::GetDatasetVersionRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::GetDatasetVersionRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetDatasetVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_dataset_versions][crate::client::DatasetService::list_dataset_versions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListDatasetVersions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListDatasetVersions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListDatasetVersions(RequestBuilder<crate::model::ListDatasetVersionsRequest>);
impl ListDatasetVersions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListDatasetVersionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListDatasetVersionsResponse> {
(*self.0.stub)
.list_dataset_versions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListDatasetVersionsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListDatasetVersionsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListDatasetVersionsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDatasetVersionsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDatasetVersionsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDatasetVersionsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListDatasetVersionsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListDatasetVersionsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListDatasetVersionsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListDatasetVersions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::restore_dataset_version][crate::client::DatasetService::restore_dataset_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::RestoreDatasetVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RestoreDatasetVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RestoreDatasetVersion(RequestBuilder<crate::model::RestoreDatasetVersionRequest>);
impl RestoreDatasetVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RestoreDatasetVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [restore_dataset_version][crate::client::DatasetService::restore_dataset_version].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.restore_dataset_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `restore_dataset_version`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DatasetVersion,
crate::model::RestoreDatasetVersionOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DatasetVersion,
crate::model::RestoreDatasetVersionOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::restore_dataset_version::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::RestoreDatasetVersionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RestoreDatasetVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_data_items][crate::client::DatasetService::list_data_items] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListDataItems;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListDataItems {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListDataItems(RequestBuilder<crate::model::ListDataItemsRequest>);
impl ListDataItems {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListDataItemsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListDataItemsResponse> {
(*self.0.stub)
.list_data_items(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDataItemsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListDataItemsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListDataItemsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDataItemsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDataItemsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDataItemsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListDataItemsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListDataItemsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListDataItemsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListDataItems {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::search_data_items][crate::client::DatasetService::search_data_items] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::SearchDataItems;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SearchDataItems {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SearchDataItems(RequestBuilder<crate::model::SearchDataItemsRequest>);
impl SearchDataItems {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SearchDataItemsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SearchDataItemsResponse> {
(*self.0.stub)
.search_data_items(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::SearchDataItemsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::SearchDataItemsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [dataset][crate::model::SearchDataItemsRequest::dataset].
///
/// This is a **required** field for requests.
pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.dataset = v.into();
self
}
/// Sets the value of [saved_query][crate::model::SearchDataItemsRequest::saved_query].
#[deprecated]
pub fn set_saved_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.saved_query = v.into();
self
}
/// Sets the value of [data_labeling_job][crate::model::SearchDataItemsRequest::data_labeling_job].
pub fn set_data_labeling_job<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.data_labeling_job = v.into();
self
}
/// Sets the value of [data_item_filter][crate::model::SearchDataItemsRequest::data_item_filter].
pub fn set_data_item_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.data_item_filter = v.into();
self
}
/// Sets the value of [annotations_filter][crate::model::SearchDataItemsRequest::annotations_filter].
#[deprecated]
pub fn set_annotations_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.annotations_filter = v.into();
self
}
/// Sets the value of [annotation_filters][crate::model::SearchDataItemsRequest::annotation_filters].
pub fn set_annotation_filters<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.annotation_filters = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [field_mask][crate::model::SearchDataItemsRequest::field_mask].
pub fn set_field_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.field_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [field_mask][crate::model::SearchDataItemsRequest::field_mask].
pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.field_mask = v.map(|x| x.into());
self
}
/// Sets the value of [annotations_limit][crate::model::SearchDataItemsRequest::annotations_limit].
pub fn set_annotations_limit<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.annotations_limit = v.into();
self
}
/// Sets the value of [page_size][crate::model::SearchDataItemsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [order_by][crate::model::SearchDataItemsRequest::order_by].
#[deprecated]
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [page_token][crate::model::SearchDataItemsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order][crate::model::SearchDataItemsRequest::order].
///
/// Note that all the setters affecting `order` are
/// mutually exclusive.
pub fn set_order<T: Into<Option<crate::model::search_data_items_request::Order>>>(
mut self,
v: T,
) -> Self {
self.0.request.order = v.into();
self
}
/// Sets the value of [order][crate::model::SearchDataItemsRequest::order]
/// to hold a `OrderByDataItem`.
///
/// Note that all the setters affecting `order` are
/// mutually exclusive.
pub fn set_order_by_data_item<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_order_by_data_item(v);
self
}
/// Sets the value of [order][crate::model::SearchDataItemsRequest::order]
/// to hold a `OrderByAnnotation`.
///
/// Note that all the setters affecting `order` are
/// mutually exclusive.
pub fn set_order_by_annotation<
T: std::convert::Into<
std::boxed::Box<crate::model::search_data_items_request::OrderByAnnotation>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_order_by_annotation(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SearchDataItems {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_saved_queries][crate::client::DatasetService::list_saved_queries] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListSavedQueries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListSavedQueries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListSavedQueries(RequestBuilder<crate::model::ListSavedQueriesRequest>);
impl ListSavedQueries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListSavedQueriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListSavedQueriesResponse> {
(*self.0.stub)
.list_saved_queries(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListSavedQueriesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListSavedQueriesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListSavedQueriesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListSavedQueriesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSavedQueriesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSavedQueriesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListSavedQueriesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListSavedQueriesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListSavedQueriesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListSavedQueries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::delete_saved_query][crate::client::DatasetService::delete_saved_query] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::DeleteSavedQuery;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteSavedQuery {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteSavedQuery(RequestBuilder<crate::model::DeleteSavedQueryRequest>);
impl DeleteSavedQuery {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteSavedQueryRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_saved_query][crate::client::DatasetService::delete_saved_query].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_saved_query(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_saved_query`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DatasetService::delete_saved_query::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteSavedQueryRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteSavedQuery {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_annotation_spec][crate::client::DatasetService::get_annotation_spec] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetAnnotationSpec;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetAnnotationSpec {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetAnnotationSpec(RequestBuilder<crate::model::GetAnnotationSpecRequest>);
impl GetAnnotationSpec {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetAnnotationSpecRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AnnotationSpec> {
(*self.0.stub)
.get_annotation_spec(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetAnnotationSpecRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [read_mask][crate::model::GetAnnotationSpecRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::GetAnnotationSpecRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetAnnotationSpec {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_annotations][crate::client::DatasetService::list_annotations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListAnnotations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListAnnotations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListAnnotations(RequestBuilder<crate::model::ListAnnotationsRequest>);
impl ListAnnotations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListAnnotationsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListAnnotationsResponse> {
(*self.0.stub)
.list_annotations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListAnnotationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListAnnotationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListAnnotationsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListAnnotationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListAnnotationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListAnnotationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListAnnotationsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListAnnotationsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListAnnotationsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListAnnotations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_locations][crate::client::DatasetService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_location][crate::client::DatasetService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::set_iam_policy][crate::client::DatasetService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_iam_policy][crate::client::DatasetService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::test_iam_permissions][crate::client::DatasetService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::list_operations][crate::client::DatasetService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::get_operation][crate::client::DatasetService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::delete_operation][crate::client::DatasetService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::cancel_operation][crate::client::DatasetService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DatasetService::wait_operation][crate::client::DatasetService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::dataset_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DatasetService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [DeploymentResourcePoolService][crate::client::DeploymentResourcePoolService].
#[cfg(feature = "deployment-resource-pool-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "deployment-resource-pool-service")))]
pub mod deployment_resource_pool_service {
use crate::Result;
/// A builder for [DeploymentResourcePoolService][crate::client::DeploymentResourcePoolService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::deployment_resource_pool_service::ClientBuilder;
/// # use client::DeploymentResourcePoolService;
/// let builder : ClientBuilder = DeploymentResourcePoolService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::DeploymentResourcePoolService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = DeploymentResourcePoolService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::DeploymentResourcePoolService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [DeploymentResourcePoolService::create_deployment_resource_pool][crate::client::DeploymentResourcePoolService::create_deployment_resource_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::CreateDeploymentResourcePool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateDeploymentResourcePool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateDeploymentResourcePool(
RequestBuilder<crate::model::CreateDeploymentResourcePoolRequest>,
);
impl CreateDeploymentResourcePool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateDeploymentResourcePoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_deployment_resource_pool][crate::client::DeploymentResourcePoolService::create_deployment_resource_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_deployment_resource_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_deployment_resource_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeploymentResourcePool,
crate::model::CreateDeploymentResourcePoolOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeploymentResourcePool,
crate::model::CreateDeploymentResourcePoolOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DeploymentResourcePoolService::create_deployment_resource_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateDeploymentResourcePoolRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [deployment_resource_pool][crate::model::CreateDeploymentResourcePoolRequest::deployment_resource_pool].
///
/// This is a **required** field for requests.
pub fn set_deployment_resource_pool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeploymentResourcePool>,
{
self.0.request.deployment_resource_pool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployment_resource_pool][crate::model::CreateDeploymentResourcePoolRequest::deployment_resource_pool].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployment_resource_pool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeploymentResourcePool>,
{
self.0.request.deployment_resource_pool = v.map(|x| x.into());
self
}
/// Sets the value of [deployment_resource_pool_id][crate::model::CreateDeploymentResourcePoolRequest::deployment_resource_pool_id].
///
/// This is a **required** field for requests.
pub fn set_deployment_resource_pool_id<T: Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request.deployment_resource_pool_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateDeploymentResourcePool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::get_deployment_resource_pool][crate::client::DeploymentResourcePoolService::get_deployment_resource_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::GetDeploymentResourcePool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetDeploymentResourcePool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetDeploymentResourcePool(
RequestBuilder<crate::model::GetDeploymentResourcePoolRequest>,
);
impl GetDeploymentResourcePool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetDeploymentResourcePoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DeploymentResourcePool> {
(*self.0.stub)
.get_deployment_resource_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetDeploymentResourcePoolRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetDeploymentResourcePool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::list_deployment_resource_pools][crate::client::DeploymentResourcePoolService::list_deployment_resource_pools] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::ListDeploymentResourcePools;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListDeploymentResourcePools {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListDeploymentResourcePools(
RequestBuilder<crate::model::ListDeploymentResourcePoolsRequest>,
);
impl ListDeploymentResourcePools {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListDeploymentResourcePoolsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListDeploymentResourcePoolsResponse> {
(*self.0.stub)
.list_deployment_resource_pools(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListDeploymentResourcePoolsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListDeploymentResourcePoolsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListDeploymentResourcePoolsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDeploymentResourcePoolsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDeploymentResourcePoolsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListDeploymentResourcePools {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::update_deployment_resource_pool][crate::client::DeploymentResourcePoolService::update_deployment_resource_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::UpdateDeploymentResourcePool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateDeploymentResourcePool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateDeploymentResourcePool(
RequestBuilder<crate::model::UpdateDeploymentResourcePoolRequest>,
);
impl UpdateDeploymentResourcePool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateDeploymentResourcePoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_deployment_resource_pool][crate::client::DeploymentResourcePoolService::update_deployment_resource_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_deployment_resource_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_deployment_resource_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeploymentResourcePool,
crate::model::UpdateDeploymentResourcePoolOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeploymentResourcePool,
crate::model::UpdateDeploymentResourcePoolOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DeploymentResourcePoolService::update_deployment_resource_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [deployment_resource_pool][crate::model::UpdateDeploymentResourcePoolRequest::deployment_resource_pool].
///
/// This is a **required** field for requests.
pub fn set_deployment_resource_pool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeploymentResourcePool>,
{
self.0.request.deployment_resource_pool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployment_resource_pool][crate::model::UpdateDeploymentResourcePoolRequest::deployment_resource_pool].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployment_resource_pool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeploymentResourcePool>,
{
self.0.request.deployment_resource_pool = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateDeploymentResourcePoolRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateDeploymentResourcePoolRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateDeploymentResourcePool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::delete_deployment_resource_pool][crate::client::DeploymentResourcePoolService::delete_deployment_resource_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::DeleteDeploymentResourcePool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteDeploymentResourcePool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteDeploymentResourcePool(
RequestBuilder<crate::model::DeleteDeploymentResourcePoolRequest>,
);
impl DeleteDeploymentResourcePool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteDeploymentResourcePoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_deployment_resource_pool][crate::client::DeploymentResourcePoolService::delete_deployment_resource_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_deployment_resource_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_deployment_resource_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::DeploymentResourcePoolService::delete_deployment_resource_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteDeploymentResourcePoolRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteDeploymentResourcePool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::query_deployed_models][crate::client::DeploymentResourcePoolService::query_deployed_models] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::QueryDeployedModels;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> QueryDeployedModels {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct QueryDeployedModels(RequestBuilder<crate::model::QueryDeployedModelsRequest>);
impl QueryDeployedModels {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::QueryDeployedModelsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::QueryDeployedModelsResponse> {
(*self.0.stub)
.query_deployed_models(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::QueryDeployedModelsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::QueryDeployedModelsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [deployment_resource_pool][crate::model::QueryDeployedModelsRequest::deployment_resource_pool].
///
/// This is a **required** field for requests.
pub fn set_deployment_resource_pool<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployment_resource_pool = v.into();
self
}
/// Sets the value of [page_size][crate::model::QueryDeployedModelsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::QueryDeployedModelsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for QueryDeployedModels {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::list_locations][crate::client::DeploymentResourcePoolService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::get_location][crate::client::DeploymentResourcePoolService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::set_iam_policy][crate::client::DeploymentResourcePoolService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::get_iam_policy][crate::client::DeploymentResourcePoolService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::test_iam_permissions][crate::client::DeploymentResourcePoolService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::list_operations][crate::client::DeploymentResourcePoolService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::get_operation][crate::client::DeploymentResourcePoolService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::delete_operation][crate::client::DeploymentResourcePoolService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::cancel_operation][crate::client::DeploymentResourcePoolService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [DeploymentResourcePoolService::wait_operation][crate::client::DeploymentResourcePoolService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::deployment_resource_pool_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::DeploymentResourcePoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [EndpointService][crate::client::EndpointService].
#[cfg(feature = "endpoint-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "endpoint-service")))]
pub mod endpoint_service {
use crate::Result;
/// A builder for [EndpointService][crate::client::EndpointService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::endpoint_service::ClientBuilder;
/// # use client::EndpointService;
/// let builder : ClientBuilder = EndpointService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::EndpointService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = EndpointService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::EndpointService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [EndpointService::create_endpoint][crate::client::EndpointService::create_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::CreateEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateEndpoint(RequestBuilder<crate::model::CreateEndpointRequest>);
impl CreateEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateEndpointRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_endpoint][crate::client::EndpointService::create_endpoint].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_endpoint`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Endpoint,
crate::model::CreateEndpointOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Endpoint,
crate::model::CreateEndpointOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::EndpointService::create_endpoint::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateEndpointRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = v.map(|x| x.into());
self
}
/// Sets the value of [endpoint_id][crate::model::CreateEndpointRequest::endpoint_id].
pub fn set_endpoint_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::get_endpoint][crate::client::EndpointService::get_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::GetEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetEndpoint(RequestBuilder<crate::model::GetEndpointRequest>);
impl GetEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetEndpointRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Endpoint> {
(*self.0.stub)
.get_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetEndpointRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::list_endpoints][crate::client::EndpointService::list_endpoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::ListEndpoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListEndpoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListEndpoints(RequestBuilder<crate::model::ListEndpointsRequest>);
impl ListEndpoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListEndpointsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListEndpointsResponse> {
(*self.0.stub)
.list_endpoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEndpointsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListEndpointsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListEndpointsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListEndpointsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListEndpointsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListEndpointsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListEndpointsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListEndpointsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListEndpointsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListEndpoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::update_endpoint][crate::client::EndpointService::update_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::UpdateEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateEndpoint(RequestBuilder<crate::model::UpdateEndpointRequest>);
impl UpdateEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateEndpointRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Endpoint> {
(*self.0.stub)
.update_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::UpdateEndpointRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpoint][crate::model::UpdateEndpointRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateEndpointRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateEndpointRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::update_endpoint_long_running][crate::client::EndpointService::update_endpoint_long_running] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::UpdateEndpointLongRunning;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateEndpointLongRunning {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateEndpointLongRunning(
RequestBuilder<crate::model::UpdateEndpointLongRunningRequest>,
);
impl UpdateEndpointLongRunning {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateEndpointLongRunningRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_endpoint_long_running][crate::client::EndpointService::update_endpoint_long_running].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_endpoint_long_running(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_endpoint_long_running`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Endpoint,
crate::model::UpdateEndpointOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Endpoint,
crate::model::UpdateEndpointOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::EndpointService::update_endpoint_long_running::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [endpoint][crate::model::UpdateEndpointLongRunningRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpoint][crate::model::UpdateEndpointLongRunningRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Endpoint>,
{
self.0.request.endpoint = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateEndpointLongRunning {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::delete_endpoint][crate::client::EndpointService::delete_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::DeleteEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteEndpoint(RequestBuilder<crate::model::DeleteEndpointRequest>);
impl DeleteEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteEndpointRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_endpoint][crate::client::EndpointService::delete_endpoint].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_endpoint`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::EndpointService::delete_endpoint::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteEndpointRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::deploy_model][crate::client::EndpointService::deploy_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::DeployModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeployModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeployModel(RequestBuilder<crate::model::DeployModelRequest>);
impl DeployModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeployModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [deploy_model][crate::client::EndpointService::deploy_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.deploy_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `deploy_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeployModelResponse,
crate::model::DeployModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeployModelResponse,
crate::model::DeployModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::EndpointService::deploy_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [endpoint][crate::model::DeployModelRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [deployed_model][crate::model::DeployModelRequest::deployed_model].
///
/// This is a **required** field for requests.
pub fn set_deployed_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeployedModel>,
{
self.0.request.deployed_model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployed_model][crate::model::DeployModelRequest::deployed_model].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployed_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeployedModel>,
{
self.0.request.deployed_model = v.map(|x| x.into());
self
}
/// Sets the value of [traffic_split][crate::model::DeployModelRequest::traffic_split].
pub fn set_traffic_split<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<i32>,
{
self.0.request.traffic_split =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeployModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::undeploy_model][crate::client::EndpointService::undeploy_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::UndeployModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UndeployModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UndeployModel(RequestBuilder<crate::model::UndeployModelRequest>);
impl UndeployModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UndeployModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [undeploy_model][crate::client::EndpointService::undeploy_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.undeploy_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `undeploy_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::UndeployModelResponse,
crate::model::UndeployModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::UndeployModelResponse,
crate::model::UndeployModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::EndpointService::undeploy_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [endpoint][crate::model::UndeployModelRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [deployed_model_id][crate::model::UndeployModelRequest::deployed_model_id].
///
/// This is a **required** field for requests.
pub fn set_deployed_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_model_id = v.into();
self
}
/// Sets the value of [traffic_split][crate::model::UndeployModelRequest::traffic_split].
pub fn set_traffic_split<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<i32>,
{
self.0.request.traffic_split =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UndeployModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::mutate_deployed_model][crate::client::EndpointService::mutate_deployed_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::MutateDeployedModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> MutateDeployedModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct MutateDeployedModel(RequestBuilder<crate::model::MutateDeployedModelRequest>);
impl MutateDeployedModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::MutateDeployedModelRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [mutate_deployed_model][crate::client::EndpointService::mutate_deployed_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.mutate_deployed_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `mutate_deployed_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::MutateDeployedModelResponse,
crate::model::MutateDeployedModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::MutateDeployedModelResponse,
crate::model::MutateDeployedModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::EndpointService::mutate_deployed_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [endpoint][crate::model::MutateDeployedModelRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [deployed_model][crate::model::MutateDeployedModelRequest::deployed_model].
///
/// This is a **required** field for requests.
pub fn set_deployed_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeployedModel>,
{
self.0.request.deployed_model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployed_model][crate::model::MutateDeployedModelRequest::deployed_model].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployed_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeployedModel>,
{
self.0.request.deployed_model = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::MutateDeployedModelRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::MutateDeployedModelRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for MutateDeployedModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::list_locations][crate::client::EndpointService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::get_location][crate::client::EndpointService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::set_iam_policy][crate::client::EndpointService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::get_iam_policy][crate::client::EndpointService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::test_iam_permissions][crate::client::EndpointService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::list_operations][crate::client::EndpointService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::get_operation][crate::client::EndpointService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::delete_operation][crate::client::EndpointService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::cancel_operation][crate::client::EndpointService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EndpointService::wait_operation][crate::client::EndpointService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::endpoint_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [EvaluationService][crate::client::EvaluationService].
#[cfg(feature = "evaluation-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "evaluation-service")))]
pub mod evaluation_service {
use crate::Result;
/// A builder for [EvaluationService][crate::client::EvaluationService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::evaluation_service::ClientBuilder;
/// # use client::EvaluationService;
/// let builder : ClientBuilder = EvaluationService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::EvaluationService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = EvaluationService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::EvaluationService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [EvaluationService::evaluate_instances][crate::client::EvaluationService::evaluate_instances] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::EvaluateInstances;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> EvaluateInstances {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct EvaluateInstances(RequestBuilder<crate::model::EvaluateInstancesRequest>);
impl EvaluateInstances {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::EvaluateInstancesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::EvaluateInstancesResponse> {
(*self.0.stub)
.evaluate_instances(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [location][crate::model::EvaluateInstancesRequest::location].
///
/// This is a **required** field for requests.
pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.location = v.into();
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs].
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_metric_inputs<
T: Into<Option<crate::model::evaluate_instances_request::MetricInputs>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.metric_inputs = v.into();
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `ExactMatchInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_exact_match_input<
T: std::convert::Into<std::boxed::Box<crate::model::ExactMatchInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_exact_match_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `BleuInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_bleu_input<T: std::convert::Into<std::boxed::Box<crate::model::BleuInput>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_bleu_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `RougeInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_rouge_input<T: std::convert::Into<std::boxed::Box<crate::model::RougeInput>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_rouge_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `FluencyInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_fluency_input<
T: std::convert::Into<std::boxed::Box<crate::model::FluencyInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_fluency_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `CoherenceInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_coherence_input<
T: std::convert::Into<std::boxed::Box<crate::model::CoherenceInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_coherence_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `SafetyInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_safety_input<
T: std::convert::Into<std::boxed::Box<crate::model::SafetyInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_safety_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `GroundednessInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_groundedness_input<
T: std::convert::Into<std::boxed::Box<crate::model::GroundednessInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_groundedness_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `FulfillmentInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_fulfillment_input<
T: std::convert::Into<std::boxed::Box<crate::model::FulfillmentInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_fulfillment_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `SummarizationQualityInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_summarization_quality_input<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationQualityInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_summarization_quality_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `PairwiseSummarizationQualityInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_pairwise_summarization_quality_input<
T: std::convert::Into<std::boxed::Box<crate::model::PairwiseSummarizationQualityInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_pairwise_summarization_quality_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `SummarizationHelpfulnessInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_summarization_helpfulness_input<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationHelpfulnessInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_summarization_helpfulness_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `SummarizationVerbosityInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_summarization_verbosity_input<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationVerbosityInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_summarization_verbosity_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `QuestionAnsweringQualityInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_question_answering_quality_input<
T: std::convert::Into<std::boxed::Box<crate::model::QuestionAnsweringQualityInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_question_answering_quality_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `PairwiseQuestionAnsweringQualityInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_pairwise_question_answering_quality_input<
T: std::convert::Into<
std::boxed::Box<crate::model::PairwiseQuestionAnsweringQualityInput>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self
.0
.request
.set_pairwise_question_answering_quality_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `QuestionAnsweringRelevanceInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_question_answering_relevance_input<
T: std::convert::Into<std::boxed::Box<crate::model::QuestionAnsweringRelevanceInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_question_answering_relevance_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `QuestionAnsweringHelpfulnessInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_question_answering_helpfulness_input<
T: std::convert::Into<std::boxed::Box<crate::model::QuestionAnsweringHelpfulnessInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_question_answering_helpfulness_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `QuestionAnsweringCorrectnessInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_question_answering_correctness_input<
T: std::convert::Into<std::boxed::Box<crate::model::QuestionAnsweringCorrectnessInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_question_answering_correctness_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `PointwiseMetricInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_pointwise_metric_input<
T: std::convert::Into<std::boxed::Box<crate::model::PointwiseMetricInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_pointwise_metric_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `PairwiseMetricInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_pairwise_metric_input<
T: std::convert::Into<std::boxed::Box<crate::model::PairwiseMetricInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_pairwise_metric_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `ToolCallValidInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_tool_call_valid_input<
T: std::convert::Into<std::boxed::Box<crate::model::ToolCallValidInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_tool_call_valid_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `ToolNameMatchInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_tool_name_match_input<
T: std::convert::Into<std::boxed::Box<crate::model::ToolNameMatchInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_tool_name_match_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `ToolParameterKeyMatchInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_tool_parameter_key_match_input<
T: std::convert::Into<std::boxed::Box<crate::model::ToolParameterKeyMatchInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_tool_parameter_key_match_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `ToolParameterKvMatchInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_tool_parameter_kv_match_input<
T: std::convert::Into<std::boxed::Box<crate::model::ToolParameterKVMatchInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_tool_parameter_kv_match_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `CometInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_comet_input<T: std::convert::Into<std::boxed::Box<crate::model::CometInput>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_comet_input(v);
self
}
/// Sets the value of [metric_inputs][crate::model::EvaluateInstancesRequest::metric_inputs]
/// to hold a `MetricxInput`.
///
/// Note that all the setters affecting `metric_inputs` are
/// mutually exclusive.
pub fn set_metricx_input<
T: std::convert::Into<std::boxed::Box<crate::model::MetricxInput>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_metricx_input(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for EvaluateInstances {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::list_locations][crate::client::EvaluationService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::get_location][crate::client::EvaluationService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::set_iam_policy][crate::client::EvaluationService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::get_iam_policy][crate::client::EvaluationService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::test_iam_permissions][crate::client::EvaluationService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::list_operations][crate::client::EvaluationService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::get_operation][crate::client::EvaluationService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::delete_operation][crate::client::EvaluationService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::cancel_operation][crate::client::EvaluationService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [EvaluationService::wait_operation][crate::client::EvaluationService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::evaluation_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::EvaluationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [FeatureOnlineStoreAdminService][crate::client::FeatureOnlineStoreAdminService].
#[cfg(feature = "feature-online-store-admin-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-admin-service")))]
pub mod feature_online_store_admin_service {
use crate::Result;
/// A builder for [FeatureOnlineStoreAdminService][crate::client::FeatureOnlineStoreAdminService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::feature_online_store_admin_service::ClientBuilder;
/// # use client::FeatureOnlineStoreAdminService;
/// let builder : ClientBuilder = FeatureOnlineStoreAdminService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::FeatureOnlineStoreAdminService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = FeatureOnlineStoreAdminService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::FeatureOnlineStoreAdminService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [FeatureOnlineStoreAdminService::create_feature_online_store][crate::client::FeatureOnlineStoreAdminService::create_feature_online_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::CreateFeatureOnlineStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeatureOnlineStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeatureOnlineStore(
RequestBuilder<crate::model::CreateFeatureOnlineStoreRequest>,
);
impl CreateFeatureOnlineStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeatureOnlineStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_feature_online_store][crate::client::FeatureOnlineStoreAdminService::create_feature_online_store].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_feature_online_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_feature_online_store`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureOnlineStore,
crate::model::CreateFeatureOnlineStoreOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureOnlineStore,
crate::model::CreateFeatureOnlineStoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::create_feature_online_store::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeatureOnlineStoreRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [feature_online_store][crate::model::CreateFeatureOnlineStoreRequest::feature_online_store].
///
/// This is a **required** field for requests.
pub fn set_feature_online_store<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureOnlineStore>,
{
self.0.request.feature_online_store = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_online_store][crate::model::CreateFeatureOnlineStoreRequest::feature_online_store].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_online_store<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureOnlineStore>,
{
self.0.request.feature_online_store = v.map(|x| x.into());
self
}
/// Sets the value of [feature_online_store_id][crate::model::CreateFeatureOnlineStoreRequest::feature_online_store_id].
///
/// This is a **required** field for requests.
pub fn set_feature_online_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_online_store_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeatureOnlineStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_feature_online_store][crate::client::FeatureOnlineStoreAdminService::get_feature_online_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetFeatureOnlineStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeatureOnlineStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeatureOnlineStore(RequestBuilder<crate::model::GetFeatureOnlineStoreRequest>);
impl GetFeatureOnlineStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureOnlineStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FeatureOnlineStore> {
(*self.0.stub)
.get_feature_online_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureOnlineStoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeatureOnlineStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::list_feature_online_stores][crate::client::FeatureOnlineStoreAdminService::list_feature_online_stores] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::ListFeatureOnlineStores;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatureOnlineStores {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatureOnlineStores(
RequestBuilder<crate::model::ListFeatureOnlineStoresRequest>,
);
impl ListFeatureOnlineStores {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeatureOnlineStoresRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeatureOnlineStoresResponse> {
(*self.0.stub)
.list_feature_online_stores(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListFeatureOnlineStoresResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeatureOnlineStoresResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeatureOnlineStoresRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeatureOnlineStoresRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeatureOnlineStoresRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeatureOnlineStoresRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeatureOnlineStoresRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatureOnlineStores {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::update_feature_online_store][crate::client::FeatureOnlineStoreAdminService::update_feature_online_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::UpdateFeatureOnlineStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeatureOnlineStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeatureOnlineStore(
RequestBuilder<crate::model::UpdateFeatureOnlineStoreRequest>,
);
impl UpdateFeatureOnlineStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeatureOnlineStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_feature_online_store][crate::client::FeatureOnlineStoreAdminService::update_feature_online_store].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_feature_online_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_feature_online_store`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureOnlineStore,
crate::model::UpdateFeatureOnlineStoreOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureOnlineStore,
crate::model::UpdateFeatureOnlineStoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::update_feature_online_store::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [feature_online_store][crate::model::UpdateFeatureOnlineStoreRequest::feature_online_store].
///
/// This is a **required** field for requests.
pub fn set_feature_online_store<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureOnlineStore>,
{
self.0.request.feature_online_store = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_online_store][crate::model::UpdateFeatureOnlineStoreRequest::feature_online_store].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_online_store<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureOnlineStore>,
{
self.0.request.feature_online_store = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeatureOnlineStoreRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeatureOnlineStoreRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeatureOnlineStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::delete_feature_online_store][crate::client::FeatureOnlineStoreAdminService::delete_feature_online_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::DeleteFeatureOnlineStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeatureOnlineStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeatureOnlineStore(
RequestBuilder<crate::model::DeleteFeatureOnlineStoreRequest>,
);
impl DeleteFeatureOnlineStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureOnlineStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature_online_store][crate::client::FeatureOnlineStoreAdminService::delete_feature_online_store].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature_online_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature_online_store`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::delete_feature_online_store::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeatureOnlineStoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteFeatureOnlineStoreRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeatureOnlineStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::create_feature_view][crate::client::FeatureOnlineStoreAdminService::create_feature_view] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::CreateFeatureView;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeatureView {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeatureView(RequestBuilder<crate::model::CreateFeatureViewRequest>);
impl CreateFeatureView {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeatureViewRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_feature_view][crate::client::FeatureOnlineStoreAdminService::create_feature_view].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_feature_view(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_feature_view`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureView,
crate::model::CreateFeatureViewOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureView,
crate::model::CreateFeatureViewOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::create_feature_view::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeatureViewRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [feature_view][crate::model::CreateFeatureViewRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_feature_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureView>,
{
self.0.request.feature_view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_view][crate::model::CreateFeatureViewRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureView>,
{
self.0.request.feature_view = v.map(|x| x.into());
self
}
/// Sets the value of [feature_view_id][crate::model::CreateFeatureViewRequest::feature_view_id].
///
/// This is a **required** field for requests.
pub fn set_feature_view_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_view_id = v.into();
self
}
/// Sets the value of [run_sync_immediately][crate::model::CreateFeatureViewRequest::run_sync_immediately].
pub fn set_run_sync_immediately<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.run_sync_immediately = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeatureView {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_feature_view][crate::client::FeatureOnlineStoreAdminService::get_feature_view] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetFeatureView;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeatureView {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeatureView(RequestBuilder<crate::model::GetFeatureViewRequest>);
impl GetFeatureView {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureViewRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FeatureView> {
(*self.0.stub)
.get_feature_view(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureViewRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeatureView {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::list_feature_views][crate::client::FeatureOnlineStoreAdminService::list_feature_views] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::ListFeatureViews;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatureViews {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatureViews(RequestBuilder<crate::model::ListFeatureViewsRequest>);
impl ListFeatureViews {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeatureViewsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeatureViewsResponse> {
(*self.0.stub)
.list_feature_views(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListFeatureViewsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeatureViewsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeatureViewsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeatureViewsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeatureViewsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeatureViewsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeatureViewsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatureViews {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::update_feature_view][crate::client::FeatureOnlineStoreAdminService::update_feature_view] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::UpdateFeatureView;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeatureView {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeatureView(RequestBuilder<crate::model::UpdateFeatureViewRequest>);
impl UpdateFeatureView {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeatureViewRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_feature_view][crate::client::FeatureOnlineStoreAdminService::update_feature_view].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_feature_view(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_feature_view`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureView,
crate::model::UpdateFeatureViewOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureView,
crate::model::UpdateFeatureViewOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::update_feature_view::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [feature_view][crate::model::UpdateFeatureViewRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_feature_view<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureView>,
{
self.0.request.feature_view = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_view][crate::model::UpdateFeatureViewRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_view<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureView>,
{
self.0.request.feature_view = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeatureViewRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeatureViewRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeatureView {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::delete_feature_view][crate::client::FeatureOnlineStoreAdminService::delete_feature_view] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::DeleteFeatureView;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeatureView {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeatureView(RequestBuilder<crate::model::DeleteFeatureViewRequest>);
impl DeleteFeatureView {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureViewRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature_view][crate::client::FeatureOnlineStoreAdminService::delete_feature_view].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature_view(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature_view`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureOnlineStoreAdminService::delete_feature_view::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeatureViewRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeatureView {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::sync_feature_view][crate::client::FeatureOnlineStoreAdminService::sync_feature_view] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::SyncFeatureView;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SyncFeatureView {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SyncFeatureView(RequestBuilder<crate::model::SyncFeatureViewRequest>);
impl SyncFeatureView {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SyncFeatureViewRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SyncFeatureViewResponse> {
(*self.0.stub)
.sync_feature_view(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [feature_view][crate::model::SyncFeatureViewRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_feature_view<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_view = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SyncFeatureView {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_feature_view_sync][crate::client::FeatureOnlineStoreAdminService::get_feature_view_sync] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetFeatureViewSync;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeatureViewSync {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeatureViewSync(RequestBuilder<crate::model::GetFeatureViewSyncRequest>);
impl GetFeatureViewSync {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureViewSyncRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FeatureViewSync> {
(*self.0.stub)
.get_feature_view_sync(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureViewSyncRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeatureViewSync {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::list_feature_view_syncs][crate::client::FeatureOnlineStoreAdminService::list_feature_view_syncs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::ListFeatureViewSyncs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatureViewSyncs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatureViewSyncs(RequestBuilder<crate::model::ListFeatureViewSyncsRequest>);
impl ListFeatureViewSyncs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeatureViewSyncsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeatureViewSyncsResponse> {
(*self.0.stub)
.list_feature_view_syncs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListFeatureViewSyncsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeatureViewSyncsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeatureViewSyncsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeatureViewSyncsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeatureViewSyncsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeatureViewSyncsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeatureViewSyncsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatureViewSyncs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::list_locations][crate::client::FeatureOnlineStoreAdminService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_location][crate::client::FeatureOnlineStoreAdminService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::set_iam_policy][crate::client::FeatureOnlineStoreAdminService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_iam_policy][crate::client::FeatureOnlineStoreAdminService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::test_iam_permissions][crate::client::FeatureOnlineStoreAdminService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::list_operations][crate::client::FeatureOnlineStoreAdminService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::get_operation][crate::client::FeatureOnlineStoreAdminService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::delete_operation][crate::client::FeatureOnlineStoreAdminService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::cancel_operation][crate::client::FeatureOnlineStoreAdminService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreAdminService::wait_operation][crate::client::FeatureOnlineStoreAdminService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_admin_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreAdminService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [FeatureOnlineStoreService][crate::client::FeatureOnlineStoreService].
#[cfg(feature = "feature-online-store-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-online-store-service")))]
pub mod feature_online_store_service {
use crate::Result;
/// A builder for [FeatureOnlineStoreService][crate::client::FeatureOnlineStoreService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::feature_online_store_service::ClientBuilder;
/// # use client::FeatureOnlineStoreService;
/// let builder : ClientBuilder = FeatureOnlineStoreService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::FeatureOnlineStoreService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = FeatureOnlineStoreService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::FeatureOnlineStoreService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [FeatureOnlineStoreService::fetch_feature_values][crate::client::FeatureOnlineStoreService::fetch_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::FetchFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> FetchFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct FetchFeatureValues(RequestBuilder<crate::model::FetchFeatureValuesRequest>);
impl FetchFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::FetchFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FetchFeatureValuesResponse> {
(*self.0.stub)
.fetch_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [feature_view][crate::model::FetchFeatureValuesRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_feature_view<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_view = v.into();
self
}
/// Sets the value of [data_key][crate::model::FetchFeatureValuesRequest::data_key].
pub fn set_data_key<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureViewDataKey>,
{
self.0.request.data_key = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_key][crate::model::FetchFeatureValuesRequest::data_key].
pub fn set_or_clear_data_key<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureViewDataKey>,
{
self.0.request.data_key = v.map(|x| x.into());
self
}
/// Sets the value of [data_format][crate::model::FetchFeatureValuesRequest::data_format].
pub fn set_data_format<T: Into<crate::model::FeatureViewDataFormat>>(
mut self,
v: T,
) -> Self {
self.0.request.data_format = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for FetchFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::search_nearest_entities][crate::client::FeatureOnlineStoreService::search_nearest_entities] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::SearchNearestEntities;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SearchNearestEntities {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SearchNearestEntities(RequestBuilder<crate::model::SearchNearestEntitiesRequest>);
impl SearchNearestEntities {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SearchNearestEntitiesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SearchNearestEntitiesResponse> {
(*self.0.stub)
.search_nearest_entities(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [feature_view][crate::model::SearchNearestEntitiesRequest::feature_view].
///
/// This is a **required** field for requests.
pub fn set_feature_view<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_view = v.into();
self
}
/// Sets the value of [query][crate::model::SearchNearestEntitiesRequest::query].
///
/// This is a **required** field for requests.
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NearestNeighborQuery>,
{
self.0.request.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::SearchNearestEntitiesRequest::query].
///
/// This is a **required** field for requests.
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NearestNeighborQuery>,
{
self.0.request.query = v.map(|x| x.into());
self
}
/// Sets the value of [return_full_entity][crate::model::SearchNearestEntitiesRequest::return_full_entity].
pub fn set_return_full_entity<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_full_entity = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SearchNearestEntities {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::generate_fetch_access_token][crate::client::FeatureOnlineStoreService::generate_fetch_access_token] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::GenerateFetchAccessToken;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GenerateFetchAccessToken {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GenerateFetchAccessToken(
RequestBuilder<crate::model::GenerateFetchAccessTokenRequest>,
);
impl GenerateFetchAccessToken {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GenerateFetchAccessTokenRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::GenerateFetchAccessTokenResponse> {
(*self.0.stub)
.generate_fetch_access_token(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [feature_view][crate::model::GenerateFetchAccessTokenRequest::feature_view].
pub fn set_feature_view<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_view = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GenerateFetchAccessToken {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::list_locations][crate::client::FeatureOnlineStoreService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::get_location][crate::client::FeatureOnlineStoreService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::set_iam_policy][crate::client::FeatureOnlineStoreService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::get_iam_policy][crate::client::FeatureOnlineStoreService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::test_iam_permissions][crate::client::FeatureOnlineStoreService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::list_operations][crate::client::FeatureOnlineStoreService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::get_operation][crate::client::FeatureOnlineStoreService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::delete_operation][crate::client::FeatureOnlineStoreService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::cancel_operation][crate::client::FeatureOnlineStoreService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureOnlineStoreService::wait_operation][crate::client::FeatureOnlineStoreService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_online_store_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureOnlineStoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [FeatureRegistryService][crate::client::FeatureRegistryService].
#[cfg(feature = "feature-registry-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "feature-registry-service")))]
pub mod feature_registry_service {
use crate::Result;
/// A builder for [FeatureRegistryService][crate::client::FeatureRegistryService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::feature_registry_service::ClientBuilder;
/// # use client::FeatureRegistryService;
/// let builder : ClientBuilder = FeatureRegistryService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::FeatureRegistryService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = FeatureRegistryService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::FeatureRegistryService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [FeatureRegistryService::create_feature_group][crate::client::FeatureRegistryService::create_feature_group] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::CreateFeatureGroup;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeatureGroup {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeatureGroup(RequestBuilder<crate::model::CreateFeatureGroupRequest>);
impl CreateFeatureGroup {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeatureGroupRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_feature_group][crate::client::FeatureRegistryService::create_feature_group].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_feature_group(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_feature_group`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureGroup,
crate::model::CreateFeatureGroupOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureGroup,
crate::model::CreateFeatureGroupOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::create_feature_group::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeatureGroupRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [feature_group][crate::model::CreateFeatureGroupRequest::feature_group].
///
/// This is a **required** field for requests.
pub fn set_feature_group<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureGroup>,
{
self.0.request.feature_group = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_group][crate::model::CreateFeatureGroupRequest::feature_group].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_group<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureGroup>,
{
self.0.request.feature_group = v.map(|x| x.into());
self
}
/// Sets the value of [feature_group_id][crate::model::CreateFeatureGroupRequest::feature_group_id].
///
/// This is a **required** field for requests.
pub fn set_feature_group_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_group_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeatureGroup {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::get_feature_group][crate::client::FeatureRegistryService::get_feature_group] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::GetFeatureGroup;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeatureGroup {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeatureGroup(RequestBuilder<crate::model::GetFeatureGroupRequest>);
impl GetFeatureGroup {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureGroupRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FeatureGroup> {
(*self.0.stub)
.get_feature_group(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureGroupRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeatureGroup {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::list_feature_groups][crate::client::FeatureRegistryService::list_feature_groups] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::ListFeatureGroups;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatureGroups {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatureGroups(RequestBuilder<crate::model::ListFeatureGroupsRequest>);
impl ListFeatureGroups {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeatureGroupsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeatureGroupsResponse> {
(*self.0.stub)
.list_feature_groups(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListFeatureGroupsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeatureGroupsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeatureGroupsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeatureGroupsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeatureGroupsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeatureGroupsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeatureGroupsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatureGroups {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::update_feature_group][crate::client::FeatureRegistryService::update_feature_group] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::UpdateFeatureGroup;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeatureGroup {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeatureGroup(RequestBuilder<crate::model::UpdateFeatureGroupRequest>);
impl UpdateFeatureGroup {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeatureGroupRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_feature_group][crate::client::FeatureRegistryService::update_feature_group].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_feature_group(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_feature_group`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::FeatureGroup,
crate::model::UpdateFeatureGroupOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::FeatureGroup,
crate::model::UpdateFeatureGroupOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::update_feature_group::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [feature_group][crate::model::UpdateFeatureGroupRequest::feature_group].
///
/// This is a **required** field for requests.
pub fn set_feature_group<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureGroup>,
{
self.0.request.feature_group = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_group][crate::model::UpdateFeatureGroupRequest::feature_group].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_group<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureGroup>,
{
self.0.request.feature_group = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeatureGroupRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeatureGroupRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeatureGroup {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::delete_feature_group][crate::client::FeatureRegistryService::delete_feature_group] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::DeleteFeatureGroup;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeatureGroup {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeatureGroup(RequestBuilder<crate::model::DeleteFeatureGroupRequest>);
impl DeleteFeatureGroup {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureGroupRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature_group][crate::client::FeatureRegistryService::delete_feature_group].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature_group(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature_group`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::delete_feature_group::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeatureGroupRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteFeatureGroupRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeatureGroup {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::create_feature][crate::client::FeatureRegistryService::create_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::CreateFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeature(RequestBuilder<crate::model::CreateFeatureRequest>);
impl CreateFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_feature][crate::client::FeatureRegistryService::create_feature].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_feature`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Feature,
crate::model::CreateFeatureOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Feature,
crate::model::CreateFeatureOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::create_feature::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeatureRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [feature][crate::model::CreateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_feature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature][crate::model::CreateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = v.map(|x| x.into());
self
}
/// Sets the value of [feature_id][crate::model::CreateFeatureRequest::feature_id].
///
/// This is a **required** field for requests.
pub fn set_feature_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::batch_create_features][crate::client::FeatureRegistryService::batch_create_features] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::BatchCreateFeatures;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchCreateFeatures {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchCreateFeatures(RequestBuilder<crate::model::BatchCreateFeaturesRequest>);
impl BatchCreateFeatures {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchCreateFeaturesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_create_features][crate::client::FeatureRegistryService::batch_create_features].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_create_features(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_features`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchCreateFeaturesResponse,
crate::model::BatchCreateFeaturesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchCreateFeaturesResponse,
crate::model::BatchCreateFeaturesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::batch_create_features::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::BatchCreateFeaturesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [requests][crate::model::BatchCreateFeaturesRequest::requests].
///
/// This is a **required** field for requests.
pub fn set_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CreateFeatureRequest>,
{
use std::iter::Iterator;
self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchCreateFeatures {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::get_feature][crate::client::FeatureRegistryService::get_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::GetFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeature(RequestBuilder<crate::model::GetFeatureRequest>);
impl GetFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Feature> {
(*self.0.stub)
.get_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::list_features][crate::client::FeatureRegistryService::list_features] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::ListFeatures;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatures {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatures(RequestBuilder<crate::model::ListFeaturesRequest>);
impl ListFeatures {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeaturesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeaturesResponse> {
(*self.0.stub)
.list_features(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListFeaturesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeaturesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeaturesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeaturesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeaturesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeaturesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeaturesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListFeaturesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListFeaturesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [latest_stats_count][crate::model::ListFeaturesRequest::latest_stats_count].
pub fn set_latest_stats_count<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.latest_stats_count = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatures {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::update_feature][crate::client::FeatureRegistryService::update_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::UpdateFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeature(RequestBuilder<crate::model::UpdateFeatureRequest>);
impl UpdateFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_feature][crate::client::FeatureRegistryService::update_feature].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_feature`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Feature,
crate::model::UpdateFeatureOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Feature,
crate::model::UpdateFeatureOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::update_feature::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [feature][crate::model::UpdateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_feature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature][crate::model::UpdateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeatureRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeatureRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::delete_feature][crate::client::FeatureRegistryService::delete_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::DeleteFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeature(RequestBuilder<crate::model::DeleteFeatureRequest>);
impl DeleteFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature][crate::client::FeatureRegistryService::delete_feature].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeatureRegistryService::delete_feature::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeatureRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::list_locations][crate::client::FeatureRegistryService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::get_location][crate::client::FeatureRegistryService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::set_iam_policy][crate::client::FeatureRegistryService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::get_iam_policy][crate::client::FeatureRegistryService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::test_iam_permissions][crate::client::FeatureRegistryService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::list_operations][crate::client::FeatureRegistryService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::get_operation][crate::client::FeatureRegistryService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::delete_operation][crate::client::FeatureRegistryService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::cancel_operation][crate::client::FeatureRegistryService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeatureRegistryService::wait_operation][crate::client::FeatureRegistryService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::feature_registry_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeatureRegistryService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [FeaturestoreOnlineServingService][crate::client::FeaturestoreOnlineServingService].
#[cfg(feature = "featurestore-online-serving-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-online-serving-service")))]
pub mod featurestore_online_serving_service {
use crate::Result;
/// A builder for [FeaturestoreOnlineServingService][crate::client::FeaturestoreOnlineServingService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::featurestore_online_serving_service::ClientBuilder;
/// # use client::FeaturestoreOnlineServingService;
/// let builder : ClientBuilder = FeaturestoreOnlineServingService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::FeaturestoreOnlineServingService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = FeaturestoreOnlineServingService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::FeaturestoreOnlineServingService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [FeaturestoreOnlineServingService::read_feature_values][crate::client::FeaturestoreOnlineServingService::read_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::ReadFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ReadFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ReadFeatureValues(RequestBuilder<crate::model::ReadFeatureValuesRequest>);
impl ReadFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReadFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReadFeatureValuesResponse> {
(*self.0.stub)
.read_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [entity_type][crate::model::ReadFeatureValuesRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type = v.into();
self
}
/// Sets the value of [entity_id][crate::model::ReadFeatureValuesRequest::entity_id].
///
/// This is a **required** field for requests.
pub fn set_entity_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_id = v.into();
self
}
/// Sets the value of [feature_selector][crate::model::ReadFeatureValuesRequest::feature_selector].
///
/// This is a **required** field for requests.
pub fn set_feature_selector<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureSelector>,
{
self.0.request.feature_selector = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_selector][crate::model::ReadFeatureValuesRequest::feature_selector].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_selector<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureSelector>,
{
self.0.request.feature_selector = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ReadFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::write_feature_values][crate::client::FeaturestoreOnlineServingService::write_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::WriteFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WriteFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WriteFeatureValues(RequestBuilder<crate::model::WriteFeatureValuesRequest>);
impl WriteFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::WriteFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::WriteFeatureValuesResponse> {
(*self.0.stub)
.write_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [entity_type][crate::model::WriteFeatureValuesRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type = v.into();
self
}
/// Sets the value of [payloads][crate::model::WriteFeatureValuesRequest::payloads].
///
/// This is a **required** field for requests.
pub fn set_payloads<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::WriteFeatureValuesPayload>,
{
use std::iter::Iterator;
self.0.request.payloads = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WriteFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::list_locations][crate::client::FeaturestoreOnlineServingService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::get_location][crate::client::FeaturestoreOnlineServingService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::set_iam_policy][crate::client::FeaturestoreOnlineServingService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::get_iam_policy][crate::client::FeaturestoreOnlineServingService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::test_iam_permissions][crate::client::FeaturestoreOnlineServingService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::list_operations][crate::client::FeaturestoreOnlineServingService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::get_operation][crate::client::FeaturestoreOnlineServingService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::delete_operation][crate::client::FeaturestoreOnlineServingService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::cancel_operation][crate::client::FeaturestoreOnlineServingService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreOnlineServingService::wait_operation][crate::client::FeaturestoreOnlineServingService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_online_serving_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreOnlineServingService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [FeaturestoreService][crate::client::FeaturestoreService].
#[cfg(feature = "featurestore-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "featurestore-service")))]
pub mod featurestore_service {
use crate::Result;
/// A builder for [FeaturestoreService][crate::client::FeaturestoreService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::featurestore_service::ClientBuilder;
/// # use client::FeaturestoreService;
/// let builder : ClientBuilder = FeaturestoreService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::FeaturestoreService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = FeaturestoreService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::FeaturestoreService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [FeaturestoreService::create_featurestore][crate::client::FeaturestoreService::create_featurestore] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::CreateFeaturestore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeaturestore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeaturestore(RequestBuilder<crate::model::CreateFeaturestoreRequest>);
impl CreateFeaturestore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeaturestoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_featurestore][crate::client::FeaturestoreService::create_featurestore].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_featurestore(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_featurestore`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Featurestore,
crate::model::CreateFeaturestoreOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Featurestore,
crate::model::CreateFeaturestoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::create_featurestore::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeaturestoreRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [featurestore][crate::model::CreateFeaturestoreRequest::featurestore].
///
/// This is a **required** field for requests.
pub fn set_featurestore<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Featurestore>,
{
self.0.request.featurestore = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [featurestore][crate::model::CreateFeaturestoreRequest::featurestore].
///
/// This is a **required** field for requests.
pub fn set_or_clear_featurestore<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Featurestore>,
{
self.0.request.featurestore = v.map(|x| x.into());
self
}
/// Sets the value of [featurestore_id][crate::model::CreateFeaturestoreRequest::featurestore_id].
///
/// This is a **required** field for requests.
pub fn set_featurestore_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.featurestore_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeaturestore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_featurestore][crate::client::FeaturestoreService::get_featurestore] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetFeaturestore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeaturestore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeaturestore(RequestBuilder<crate::model::GetFeaturestoreRequest>);
impl GetFeaturestore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeaturestoreRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Featurestore> {
(*self.0.stub)
.get_featurestore(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeaturestoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeaturestore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::list_featurestores][crate::client::FeaturestoreService::list_featurestores] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ListFeaturestores;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeaturestores {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeaturestores(RequestBuilder<crate::model::ListFeaturestoresRequest>);
impl ListFeaturestores {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeaturestoresRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeaturestoresResponse> {
(*self.0.stub)
.list_featurestores(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListFeaturestoresResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeaturestoresResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeaturestoresRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeaturestoresRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeaturestoresRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeaturestoresRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeaturestoresRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListFeaturestoresRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListFeaturestoresRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeaturestores {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::update_featurestore][crate::client::FeaturestoreService::update_featurestore] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::UpdateFeaturestore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeaturestore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeaturestore(RequestBuilder<crate::model::UpdateFeaturestoreRequest>);
impl UpdateFeaturestore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeaturestoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_featurestore][crate::client::FeaturestoreService::update_featurestore].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_featurestore(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_featurestore`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Featurestore,
crate::model::UpdateFeaturestoreOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Featurestore,
crate::model::UpdateFeaturestoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::update_featurestore::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [featurestore][crate::model::UpdateFeaturestoreRequest::featurestore].
///
/// This is a **required** field for requests.
pub fn set_featurestore<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Featurestore>,
{
self.0.request.featurestore = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [featurestore][crate::model::UpdateFeaturestoreRequest::featurestore].
///
/// This is a **required** field for requests.
pub fn set_or_clear_featurestore<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Featurestore>,
{
self.0.request.featurestore = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeaturestoreRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeaturestoreRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeaturestore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::delete_featurestore][crate::client::FeaturestoreService::delete_featurestore] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::DeleteFeaturestore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeaturestore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeaturestore(RequestBuilder<crate::model::DeleteFeaturestoreRequest>);
impl DeleteFeaturestore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeaturestoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_featurestore][crate::client::FeaturestoreService::delete_featurestore].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_featurestore(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_featurestore`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::delete_featurestore::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeaturestoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteFeaturestoreRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeaturestore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::create_entity_type][crate::client::FeaturestoreService::create_entity_type] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::CreateEntityType;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateEntityType {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateEntityType(RequestBuilder<crate::model::CreateEntityTypeRequest>);
impl CreateEntityType {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateEntityTypeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_entity_type][crate::client::FeaturestoreService::create_entity_type].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_entity_type(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_entity_type`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::EntityType,
crate::model::CreateEntityTypeOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::EntityType,
crate::model::CreateEntityTypeOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::create_entity_type::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateEntityTypeRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [entity_type][crate::model::CreateEntityTypeRequest::entity_type].
pub fn set_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.0.request.entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [entity_type][crate::model::CreateEntityTypeRequest::entity_type].
pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.0.request.entity_type = v.map(|x| x.into());
self
}
/// Sets the value of [entity_type_id][crate::model::CreateEntityTypeRequest::entity_type_id].
///
/// This is a **required** field for requests.
pub fn set_entity_type_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateEntityType {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_entity_type][crate::client::FeaturestoreService::get_entity_type] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetEntityType;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetEntityType {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetEntityType(RequestBuilder<crate::model::GetEntityTypeRequest>);
impl GetEntityType {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetEntityTypeRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::EntityType> {
(*self.0.stub)
.get_entity_type(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetEntityTypeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetEntityType {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::list_entity_types][crate::client::FeaturestoreService::list_entity_types] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ListEntityTypes;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListEntityTypes {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListEntityTypes(RequestBuilder<crate::model::ListEntityTypesRequest>);
impl ListEntityTypes {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListEntityTypesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListEntityTypesResponse> {
(*self.0.stub)
.list_entity_types(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListEntityTypesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListEntityTypesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListEntityTypesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListEntityTypesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListEntityTypesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListEntityTypesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListEntityTypesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListEntityTypesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListEntityTypesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListEntityTypes {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::update_entity_type][crate::client::FeaturestoreService::update_entity_type] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::UpdateEntityType;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateEntityType {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateEntityType(RequestBuilder<crate::model::UpdateEntityTypeRequest>);
impl UpdateEntityType {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateEntityTypeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::EntityType> {
(*self.0.stub)
.update_entity_type(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [entity_type][crate::model::UpdateEntityTypeRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.0.request.entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [entity_type][crate::model::UpdateEntityTypeRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.0.request.entity_type = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateEntityTypeRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateEntityTypeRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateEntityType {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::delete_entity_type][crate::client::FeaturestoreService::delete_entity_type] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::DeleteEntityType;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteEntityType {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteEntityType(RequestBuilder<crate::model::DeleteEntityTypeRequest>);
impl DeleteEntityType {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteEntityTypeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_entity_type][crate::client::FeaturestoreService::delete_entity_type].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_entity_type(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_entity_type`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::delete_entity_type::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteEntityTypeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteEntityTypeRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteEntityType {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::create_feature][crate::client::FeaturestoreService::create_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::CreateFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateFeature(RequestBuilder<crate::model::CreateFeatureRequest>);
impl CreateFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_feature][crate::client::FeaturestoreService::create_feature].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_feature`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Feature,
crate::model::CreateFeatureOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Feature,
crate::model::CreateFeatureOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::create_feature::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateFeatureRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [feature][crate::model::CreateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_feature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature][crate::model::CreateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = v.map(|x| x.into());
self
}
/// Sets the value of [feature_id][crate::model::CreateFeatureRequest::feature_id].
///
/// This is a **required** field for requests.
pub fn set_feature_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::batch_create_features][crate::client::FeaturestoreService::batch_create_features] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::BatchCreateFeatures;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchCreateFeatures {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchCreateFeatures(RequestBuilder<crate::model::BatchCreateFeaturesRequest>);
impl BatchCreateFeatures {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchCreateFeaturesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_create_features][crate::client::FeaturestoreService::batch_create_features].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_create_features(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_create_features`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchCreateFeaturesResponse,
crate::model::BatchCreateFeaturesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchCreateFeaturesResponse,
crate::model::BatchCreateFeaturesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::batch_create_features::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::BatchCreateFeaturesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [requests][crate::model::BatchCreateFeaturesRequest::requests].
///
/// This is a **required** field for requests.
pub fn set_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CreateFeatureRequest>,
{
use std::iter::Iterator;
self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchCreateFeatures {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_feature][crate::client::FeaturestoreService::get_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetFeature(RequestBuilder<crate::model::GetFeatureRequest>);
impl GetFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Feature> {
(*self.0.stub)
.get_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetFeatureRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::list_features][crate::client::FeaturestoreService::list_features] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ListFeatures;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListFeatures {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListFeatures(RequestBuilder<crate::model::ListFeaturesRequest>);
impl ListFeatures {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListFeaturesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListFeaturesResponse> {
(*self.0.stub)
.list_features(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListFeaturesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListFeaturesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListFeaturesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListFeaturesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListFeaturesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListFeaturesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListFeaturesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListFeaturesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListFeaturesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [latest_stats_count][crate::model::ListFeaturesRequest::latest_stats_count].
pub fn set_latest_stats_count<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.latest_stats_count = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListFeatures {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::update_feature][crate::client::FeaturestoreService::update_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::UpdateFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateFeature(RequestBuilder<crate::model::UpdateFeatureRequest>);
impl UpdateFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Feature> {
(*self.0.stub)
.update_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [feature][crate::model::UpdateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_feature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature][crate::model::UpdateFeatureRequest::feature].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Feature>,
{
self.0.request.feature = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFeatureRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFeatureRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::delete_feature][crate::client::FeaturestoreService::delete_feature] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::DeleteFeature;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeature {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeature(RequestBuilder<crate::model::DeleteFeatureRequest>);
impl DeleteFeature {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature][crate::client::FeaturestoreService::delete_feature].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::delete_feature::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteFeatureRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeature {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::import_feature_values][crate::client::FeaturestoreService::import_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ImportFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ImportFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ImportFeatureValues(RequestBuilder<crate::model::ImportFeatureValuesRequest>);
impl ImportFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ImportFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [import_feature_values][crate::client::FeaturestoreService::import_feature_values].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.import_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `import_feature_values`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ImportFeatureValuesResponse,
crate::model::ImportFeatureValuesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ImportFeatureValuesResponse,
crate::model::ImportFeatureValuesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::import_feature_values::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [entity_type][crate::model::ImportFeatureValuesRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type = v.into();
self
}
/// Sets the value of [entity_id_field][crate::model::ImportFeatureValuesRequest::entity_id_field].
pub fn set_entity_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_id_field = v.into();
self
}
/// Sets the value of [feature_specs][crate::model::ImportFeatureValuesRequest::feature_specs].
///
/// This is a **required** field for requests.
pub fn set_feature_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::import_feature_values_request::FeatureSpec>,
{
use std::iter::Iterator;
self.0.request.feature_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [disable_online_serving][crate::model::ImportFeatureValuesRequest::disable_online_serving].
pub fn set_disable_online_serving<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.disable_online_serving = v.into();
self
}
/// Sets the value of [worker_count][crate::model::ImportFeatureValuesRequest::worker_count].
pub fn set_worker_count<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.worker_count = v.into();
self
}
/// Sets the value of [disable_ingestion_analysis][crate::model::ImportFeatureValuesRequest::disable_ingestion_analysis].
pub fn set_disable_ingestion_analysis<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.disable_ingestion_analysis = v.into();
self
}
/// Sets the value of [source][crate::model::ImportFeatureValuesRequest::source].
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
pub fn set_source<T: Into<Option<crate::model::import_feature_values_request::Source>>>(
mut self,
v: T,
) -> Self {
self.0.request.source = v.into();
self
}
/// Sets the value of [source][crate::model::ImportFeatureValuesRequest::source]
/// to hold a `AvroSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
pub fn set_avro_source<T: std::convert::Into<std::boxed::Box<crate::model::AvroSource>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_avro_source(v);
self
}
/// Sets the value of [source][crate::model::ImportFeatureValuesRequest::source]
/// to hold a `BigquerySource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
pub fn set_bigquery_source<
T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_bigquery_source(v);
self
}
/// Sets the value of [source][crate::model::ImportFeatureValuesRequest::source]
/// to hold a `CsvSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
pub fn set_csv_source<T: std::convert::Into<std::boxed::Box<crate::model::CsvSource>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_csv_source(v);
self
}
/// Sets the value of [feature_time_source][crate::model::ImportFeatureValuesRequest::feature_time_source].
///
/// Note that all the setters affecting `feature_time_source` are
/// mutually exclusive.
pub fn set_feature_time_source<
T: Into<Option<crate::model::import_feature_values_request::FeatureTimeSource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.feature_time_source = v.into();
self
}
/// Sets the value of [feature_time_source][crate::model::ImportFeatureValuesRequest::feature_time_source]
/// to hold a `FeatureTimeField`.
///
/// Note that all the setters affecting `feature_time_source` are
/// mutually exclusive.
pub fn set_feature_time_field<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_feature_time_field(v);
self
}
/// Sets the value of [feature_time_source][crate::model::ImportFeatureValuesRequest::feature_time_source]
/// to hold a `FeatureTime`.
///
/// Note that all the setters affecting `feature_time_source` are
/// mutually exclusive.
pub fn set_feature_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_feature_time(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ImportFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::batch_read_feature_values][crate::client::FeaturestoreService::batch_read_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::BatchReadFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchReadFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchReadFeatureValues(RequestBuilder<crate::model::BatchReadFeatureValuesRequest>);
impl BatchReadFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchReadFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_read_feature_values][crate::client::FeaturestoreService::batch_read_feature_values].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_read_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_read_feature_values`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchReadFeatureValuesResponse,
crate::model::BatchReadFeatureValuesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchReadFeatureValuesResponse,
crate::model::BatchReadFeatureValuesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::batch_read_feature_values::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [featurestore][crate::model::BatchReadFeatureValuesRequest::featurestore].
///
/// This is a **required** field for requests.
pub fn set_featurestore<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.featurestore = v.into();
self
}
/// Sets the value of [destination][crate::model::BatchReadFeatureValuesRequest::destination].
///
/// This is a **required** field for requests.
pub fn set_destination<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureValueDestination>,
{
self.0.request.destination = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination][crate::model::BatchReadFeatureValuesRequest::destination].
///
/// This is a **required** field for requests.
pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureValueDestination>,
{
self.0.request.destination = v.map(|x| x.into());
self
}
/// Sets the value of [pass_through_fields][crate::model::BatchReadFeatureValuesRequest::pass_through_fields].
pub fn set_pass_through_fields<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::batch_read_feature_values_request::PassThroughField,
>,
{
use std::iter::Iterator;
self.0.request.pass_through_fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [entity_type_specs][crate::model::BatchReadFeatureValuesRequest::entity_type_specs].
///
/// This is a **required** field for requests.
pub fn set_entity_type_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::batch_read_feature_values_request::EntityTypeSpec>,
{
use std::iter::Iterator;
self.0.request.entity_type_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [start_time][crate::model::BatchReadFeatureValuesRequest::start_time].
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_time][crate::model::BatchReadFeatureValuesRequest::start_time].
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = v.map(|x| x.into());
self
}
/// Sets the value of [read_option][crate::model::BatchReadFeatureValuesRequest::read_option].
///
/// Note that all the setters affecting `read_option` are
/// mutually exclusive.
pub fn set_read_option<
T: Into<Option<crate::model::batch_read_feature_values_request::ReadOption>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.read_option = v.into();
self
}
/// Sets the value of [read_option][crate::model::BatchReadFeatureValuesRequest::read_option]
/// to hold a `CsvReadInstances`.
///
/// Note that all the setters affecting `read_option` are
/// mutually exclusive.
pub fn set_csv_read_instances<
T: std::convert::Into<std::boxed::Box<crate::model::CsvSource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_csv_read_instances(v);
self
}
/// Sets the value of [read_option][crate::model::BatchReadFeatureValuesRequest::read_option]
/// to hold a `BigqueryReadInstances`.
///
/// Note that all the setters affecting `read_option` are
/// mutually exclusive.
pub fn set_bigquery_read_instances<
T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_bigquery_read_instances(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchReadFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::export_feature_values][crate::client::FeaturestoreService::export_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ExportFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ExportFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ExportFeatureValues(RequestBuilder<crate::model::ExportFeatureValuesRequest>);
impl ExportFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ExportFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [export_feature_values][crate::client::FeaturestoreService::export_feature_values].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.export_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `export_feature_values`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ExportFeatureValuesResponse,
crate::model::ExportFeatureValuesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ExportFeatureValuesResponse,
crate::model::ExportFeatureValuesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::export_feature_values::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [entity_type][crate::model::ExportFeatureValuesRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type = v.into();
self
}
/// Sets the value of [destination][crate::model::ExportFeatureValuesRequest::destination].
///
/// This is a **required** field for requests.
pub fn set_destination<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureValueDestination>,
{
self.0.request.destination = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [destination][crate::model::ExportFeatureValuesRequest::destination].
///
/// This is a **required** field for requests.
pub fn set_or_clear_destination<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureValueDestination>,
{
self.0.request.destination = v.map(|x| x.into());
self
}
/// Sets the value of [feature_selector][crate::model::ExportFeatureValuesRequest::feature_selector].
///
/// This is a **required** field for requests.
pub fn set_feature_selector<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FeatureSelector>,
{
self.0.request.feature_selector = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [feature_selector][crate::model::ExportFeatureValuesRequest::feature_selector].
///
/// This is a **required** field for requests.
pub fn set_or_clear_feature_selector<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FeatureSelector>,
{
self.0.request.feature_selector = v.map(|x| x.into());
self
}
/// Sets the value of [settings][crate::model::ExportFeatureValuesRequest::settings].
pub fn set_settings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::DestinationFeatureSetting>,
{
use std::iter::Iterator;
self.0.request.settings = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [mode][crate::model::ExportFeatureValuesRequest::mode].
///
/// Note that all the setters affecting `mode` are
/// mutually exclusive.
pub fn set_mode<T: Into<Option<crate::model::export_feature_values_request::Mode>>>(
mut self,
v: T,
) -> Self {
self.0.request.mode = v.into();
self
}
/// Sets the value of [mode][crate::model::ExportFeatureValuesRequest::mode]
/// to hold a `SnapshotExport`.
///
/// Note that all the setters affecting `mode` are
/// mutually exclusive.
pub fn set_snapshot_export<
T: std::convert::Into<
std::boxed::Box<crate::model::export_feature_values_request::SnapshotExport>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_snapshot_export(v);
self
}
/// Sets the value of [mode][crate::model::ExportFeatureValuesRequest::mode]
/// to hold a `FullExport`.
///
/// Note that all the setters affecting `mode` are
/// mutually exclusive.
pub fn set_full_export<
T: std::convert::Into<
std::boxed::Box<crate::model::export_feature_values_request::FullExport>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_full_export(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ExportFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::delete_feature_values][crate::client::FeaturestoreService::delete_feature_values] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::DeleteFeatureValues;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteFeatureValues {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteFeatureValues(RequestBuilder<crate::model::DeleteFeatureValuesRequest>);
impl DeleteFeatureValues {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteFeatureValuesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_feature_values][crate::client::FeaturestoreService::delete_feature_values].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_feature_values(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_feature_values`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeleteFeatureValuesResponse,
crate::model::DeleteFeatureValuesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeleteFeatureValuesResponse,
crate::model::DeleteFeatureValuesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::FeaturestoreService::delete_feature_values::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [entity_type][crate::model::DeleteFeatureValuesRequest::entity_type].
///
/// This is a **required** field for requests.
pub fn set_entity_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.entity_type = v.into();
self
}
/// Sets the value of [delete_option][crate::model::DeleteFeatureValuesRequest::delete_option].
///
/// Note that all the setters affecting `delete_option` are
/// mutually exclusive.
pub fn set_delete_option<
T: Into<Option<crate::model::delete_feature_values_request::DeleteOption>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.delete_option = v.into();
self
}
/// Sets the value of [delete_option][crate::model::DeleteFeatureValuesRequest::delete_option]
/// to hold a `SelectEntity`.
///
/// Note that all the setters affecting `delete_option` are
/// mutually exclusive.
pub fn set_select_entity<
T: std::convert::Into<
std::boxed::Box<crate::model::delete_feature_values_request::SelectEntity>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_select_entity(v);
self
}
/// Sets the value of [delete_option][crate::model::DeleteFeatureValuesRequest::delete_option]
/// to hold a `SelectTimeRangeAndFeature`.
///
/// Note that all the setters affecting `delete_option` are
/// mutually exclusive.
pub fn set_select_time_range_and_feature<
T: std::convert::Into<
std::boxed::Box<
crate::model::delete_feature_values_request::SelectTimeRangeAndFeature,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_select_time_range_and_feature(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteFeatureValues {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::search_features][crate::client::FeaturestoreService::search_features] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::SearchFeatures;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SearchFeatures {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SearchFeatures(RequestBuilder<crate::model::SearchFeaturesRequest>);
impl SearchFeatures {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SearchFeaturesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SearchFeaturesResponse> {
(*self.0.stub)
.search_features(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::SearchFeaturesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::SearchFeaturesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [location][crate::model::SearchFeaturesRequest::location].
///
/// This is a **required** field for requests.
pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.location = v.into();
self
}
/// Sets the value of [query][crate::model::SearchFeaturesRequest::query].
pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.query = v.into();
self
}
/// Sets the value of [page_size][crate::model::SearchFeaturesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::SearchFeaturesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SearchFeatures {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::list_locations][crate::client::FeaturestoreService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_location][crate::client::FeaturestoreService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::set_iam_policy][crate::client::FeaturestoreService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_iam_policy][crate::client::FeaturestoreService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::test_iam_permissions][crate::client::FeaturestoreService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::list_operations][crate::client::FeaturestoreService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::get_operation][crate::client::FeaturestoreService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::delete_operation][crate::client::FeaturestoreService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::cancel_operation][crate::client::FeaturestoreService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [FeaturestoreService::wait_operation][crate::client::FeaturestoreService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::featurestore_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::FeaturestoreService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [GenAiCacheService][crate::client::GenAiCacheService].
#[cfg(feature = "gen-ai-cache-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-cache-service")))]
pub mod gen_ai_cache_service {
use crate::Result;
/// A builder for [GenAiCacheService][crate::client::GenAiCacheService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::gen_ai_cache_service::ClientBuilder;
/// # use client::GenAiCacheService;
/// let builder : ClientBuilder = GenAiCacheService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::GenAiCacheService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = GenAiCacheService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::GenAiCacheService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [GenAiCacheService::create_cached_content][crate::client::GenAiCacheService::create_cached_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::CreateCachedContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateCachedContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateCachedContent(RequestBuilder<crate::model::CreateCachedContentRequest>);
impl CreateCachedContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateCachedContentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CachedContent> {
(*self.0.stub)
.create_cached_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateCachedContentRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [cached_content][crate::model::CreateCachedContentRequest::cached_content].
///
/// This is a **required** field for requests.
pub fn set_cached_content<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CachedContent>,
{
self.0.request.cached_content = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cached_content][crate::model::CreateCachedContentRequest::cached_content].
///
/// This is a **required** field for requests.
pub fn set_or_clear_cached_content<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CachedContent>,
{
self.0.request.cached_content = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateCachedContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::get_cached_content][crate::client::GenAiCacheService::get_cached_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::GetCachedContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetCachedContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetCachedContent(RequestBuilder<crate::model::GetCachedContentRequest>);
impl GetCachedContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetCachedContentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CachedContent> {
(*self.0.stub)
.get_cached_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetCachedContentRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetCachedContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::update_cached_content][crate::client::GenAiCacheService::update_cached_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::UpdateCachedContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateCachedContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateCachedContent(RequestBuilder<crate::model::UpdateCachedContentRequest>);
impl UpdateCachedContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateCachedContentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CachedContent> {
(*self.0.stub)
.update_cached_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [cached_content][crate::model::UpdateCachedContentRequest::cached_content].
///
/// This is a **required** field for requests.
pub fn set_cached_content<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CachedContent>,
{
self.0.request.cached_content = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cached_content][crate::model::UpdateCachedContentRequest::cached_content].
///
/// This is a **required** field for requests.
pub fn set_or_clear_cached_content<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CachedContent>,
{
self.0.request.cached_content = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateCachedContentRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateCachedContentRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateCachedContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::delete_cached_content][crate::client::GenAiCacheService::delete_cached_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::DeleteCachedContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteCachedContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteCachedContent(RequestBuilder<crate::model::DeleteCachedContentRequest>);
impl DeleteCachedContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteCachedContentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_cached_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::DeleteCachedContentRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteCachedContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::list_cached_contents][crate::client::GenAiCacheService::list_cached_contents] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::ListCachedContents;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListCachedContents {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListCachedContents(RequestBuilder<crate::model::ListCachedContentsRequest>);
impl ListCachedContents {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListCachedContentsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListCachedContentsResponse> {
(*self.0.stub)
.list_cached_contents(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListCachedContentsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListCachedContentsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListCachedContentsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListCachedContentsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListCachedContentsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListCachedContents {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::list_locations][crate::client::GenAiCacheService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::get_location][crate::client::GenAiCacheService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::set_iam_policy][crate::client::GenAiCacheService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::get_iam_policy][crate::client::GenAiCacheService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::test_iam_permissions][crate::client::GenAiCacheService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::list_operations][crate::client::GenAiCacheService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::get_operation][crate::client::GenAiCacheService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::delete_operation][crate::client::GenAiCacheService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::cancel_operation][crate::client::GenAiCacheService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiCacheService::wait_operation][crate::client::GenAiCacheService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_cache_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiCacheService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [GenAiTuningService][crate::client::GenAiTuningService].
#[cfg(feature = "gen-ai-tuning-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "gen-ai-tuning-service")))]
pub mod gen_ai_tuning_service {
use crate::Result;
/// A builder for [GenAiTuningService][crate::client::GenAiTuningService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::gen_ai_tuning_service::ClientBuilder;
/// # use client::GenAiTuningService;
/// let builder : ClientBuilder = GenAiTuningService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::GenAiTuningService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = GenAiTuningService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::GenAiTuningService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [GenAiTuningService::create_tuning_job][crate::client::GenAiTuningService::create_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::CreateTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTuningJob(RequestBuilder<crate::model::CreateTuningJobRequest>);
impl CreateTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTuningJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TuningJob> {
(*self.0.stub)
.create_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTuningJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tuning_job][crate::model::CreateTuningJobRequest::tuning_job].
///
/// This is a **required** field for requests.
pub fn set_tuning_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TuningJob>,
{
self.0.request.tuning_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tuning_job][crate::model::CreateTuningJobRequest::tuning_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tuning_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TuningJob>,
{
self.0.request.tuning_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::get_tuning_job][crate::client::GenAiTuningService::get_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::GetTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTuningJob(RequestBuilder<crate::model::GetTuningJobRequest>);
impl GetTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTuningJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TuningJob> {
(*self.0.stub)
.get_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTuningJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::list_tuning_jobs][crate::client::GenAiTuningService::list_tuning_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::ListTuningJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTuningJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTuningJobs(RequestBuilder<crate::model::ListTuningJobsRequest>);
impl ListTuningJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTuningJobsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTuningJobsResponse> {
(*self.0.stub)
.list_tuning_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTuningJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTuningJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTuningJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTuningJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTuningJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTuningJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTuningJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::cancel_tuning_job][crate::client::GenAiTuningService::cancel_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::CancelTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelTuningJob(RequestBuilder<crate::model::CancelTuningJobRequest>);
impl CancelTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelTuningJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelTuningJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::rebase_tuned_model][crate::client::GenAiTuningService::rebase_tuned_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::RebaseTunedModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RebaseTunedModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RebaseTunedModel(RequestBuilder<crate::model::RebaseTunedModelRequest>);
impl RebaseTunedModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RebaseTunedModelRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [rebase_tuned_model][crate::client::GenAiTuningService::rebase_tuned_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.rebase_tuned_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `rebase_tuned_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::TuningJob,
crate::model::RebaseTunedModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::TuningJob,
crate::model::RebaseTunedModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::GenAiTuningService::rebase_tuned_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::RebaseTunedModelRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tuned_model_ref][crate::model::RebaseTunedModelRequest::tuned_model_ref].
///
/// This is a **required** field for requests.
pub fn set_tuned_model_ref<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TunedModelRef>,
{
self.0.request.tuned_model_ref = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tuned_model_ref][crate::model::RebaseTunedModelRequest::tuned_model_ref].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tuned_model_ref<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TunedModelRef>,
{
self.0.request.tuned_model_ref = v.map(|x| x.into());
self
}
/// Sets the value of [tuning_job][crate::model::RebaseTunedModelRequest::tuning_job].
pub fn set_tuning_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TuningJob>,
{
self.0.request.tuning_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tuning_job][crate::model::RebaseTunedModelRequest::tuning_job].
pub fn set_or_clear_tuning_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TuningJob>,
{
self.0.request.tuning_job = v.map(|x| x.into());
self
}
/// Sets the value of [artifact_destination][crate::model::RebaseTunedModelRequest::artifact_destination].
pub fn set_artifact_destination<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GcsDestination>,
{
self.0.request.artifact_destination = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [artifact_destination][crate::model::RebaseTunedModelRequest::artifact_destination].
pub fn set_or_clear_artifact_destination<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GcsDestination>,
{
self.0.request.artifact_destination = v.map(|x| x.into());
self
}
/// Sets the value of [deploy_to_same_endpoint][crate::model::RebaseTunedModelRequest::deploy_to_same_endpoint].
pub fn set_deploy_to_same_endpoint<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.deploy_to_same_endpoint = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RebaseTunedModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::list_locations][crate::client::GenAiTuningService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::get_location][crate::client::GenAiTuningService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::set_iam_policy][crate::client::GenAiTuningService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::get_iam_policy][crate::client::GenAiTuningService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::test_iam_permissions][crate::client::GenAiTuningService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::list_operations][crate::client::GenAiTuningService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::get_operation][crate::client::GenAiTuningService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::delete_operation][crate::client::GenAiTuningService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::cancel_operation][crate::client::GenAiTuningService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [GenAiTuningService::wait_operation][crate::client::GenAiTuningService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::gen_ai_tuning_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::GenAiTuningService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [IndexEndpointService][crate::client::IndexEndpointService].
#[cfg(feature = "index-endpoint-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "index-endpoint-service")))]
pub mod index_endpoint_service {
use crate::Result;
/// A builder for [IndexEndpointService][crate::client::IndexEndpointService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::index_endpoint_service::ClientBuilder;
/// # use client::IndexEndpointService;
/// let builder : ClientBuilder = IndexEndpointService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::IndexEndpointService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = IndexEndpointService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::IndexEndpointService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [IndexEndpointService::create_index_endpoint][crate::client::IndexEndpointService::create_index_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::CreateIndexEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateIndexEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateIndexEndpoint(RequestBuilder<crate::model::CreateIndexEndpointRequest>);
impl CreateIndexEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateIndexEndpointRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_index_endpoint][crate::client::IndexEndpointService::create_index_endpoint].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_index_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_index_endpoint`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::IndexEndpoint,
crate::model::CreateIndexEndpointOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::IndexEndpoint,
crate::model::CreateIndexEndpointOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::IndexEndpointService::create_index_endpoint::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateIndexEndpointRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [index_endpoint][crate::model::CreateIndexEndpointRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::IndexEndpoint>,
{
self.0.request.index_endpoint = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index_endpoint][crate::model::CreateIndexEndpointRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_or_clear_index_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::IndexEndpoint>,
{
self.0.request.index_endpoint = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateIndexEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::get_index_endpoint][crate::client::IndexEndpointService::get_index_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::GetIndexEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIndexEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIndexEndpoint(RequestBuilder<crate::model::GetIndexEndpointRequest>);
impl GetIndexEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetIndexEndpointRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::IndexEndpoint> {
(*self.0.stub)
.get_index_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetIndexEndpointRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIndexEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::list_index_endpoints][crate::client::IndexEndpointService::list_index_endpoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::ListIndexEndpoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListIndexEndpoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListIndexEndpoints(RequestBuilder<crate::model::ListIndexEndpointsRequest>);
impl ListIndexEndpoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListIndexEndpointsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListIndexEndpointsResponse> {
(*self.0.stub)
.list_index_endpoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListIndexEndpointsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListIndexEndpointsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListIndexEndpointsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListIndexEndpointsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListIndexEndpointsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListIndexEndpointsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListIndexEndpointsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListIndexEndpointsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListIndexEndpoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::update_index_endpoint][crate::client::IndexEndpointService::update_index_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::UpdateIndexEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateIndexEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateIndexEndpoint(RequestBuilder<crate::model::UpdateIndexEndpointRequest>);
impl UpdateIndexEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateIndexEndpointRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::IndexEndpoint> {
(*self.0.stub)
.update_index_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [index_endpoint][crate::model::UpdateIndexEndpointRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::IndexEndpoint>,
{
self.0.request.index_endpoint = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index_endpoint][crate::model::UpdateIndexEndpointRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_or_clear_index_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::IndexEndpoint>,
{
self.0.request.index_endpoint = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateIndexEndpointRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateIndexEndpointRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateIndexEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::delete_index_endpoint][crate::client::IndexEndpointService::delete_index_endpoint] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::DeleteIndexEndpoint;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteIndexEndpoint {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteIndexEndpoint(RequestBuilder<crate::model::DeleteIndexEndpointRequest>);
impl DeleteIndexEndpoint {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteIndexEndpointRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_index_endpoint][crate::client::IndexEndpointService::delete_index_endpoint].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_index_endpoint(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_index_endpoint`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::IndexEndpointService::delete_index_endpoint::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteIndexEndpointRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteIndexEndpoint {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::deploy_index][crate::client::IndexEndpointService::deploy_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::DeployIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeployIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeployIndex(RequestBuilder<crate::model::DeployIndexRequest>);
impl DeployIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeployIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [deploy_index][crate::client::IndexEndpointService::deploy_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.deploy_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `deploy_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeployIndexResponse,
crate::model::DeployIndexOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeployIndexResponse,
crate::model::DeployIndexOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::IndexEndpointService::deploy_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [index_endpoint][crate::model::DeployIndexRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index_endpoint = v.into();
self
}
/// Sets the value of [deployed_index][crate::model::DeployIndexRequest::deployed_index].
///
/// This is a **required** field for requests.
pub fn set_deployed_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeployedIndex>,
{
self.0.request.deployed_index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployed_index][crate::model::DeployIndexRequest::deployed_index].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployed_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeployedIndex>,
{
self.0.request.deployed_index = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeployIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::undeploy_index][crate::client::IndexEndpointService::undeploy_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::UndeployIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UndeployIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UndeployIndex(RequestBuilder<crate::model::UndeployIndexRequest>);
impl UndeployIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UndeployIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [undeploy_index][crate::client::IndexEndpointService::undeploy_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.undeploy_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `undeploy_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::UndeployIndexResponse,
crate::model::UndeployIndexOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::UndeployIndexResponse,
crate::model::UndeployIndexOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::IndexEndpointService::undeploy_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [index_endpoint][crate::model::UndeployIndexRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index_endpoint = v.into();
self
}
/// Sets the value of [deployed_index_id][crate::model::UndeployIndexRequest::deployed_index_id].
///
/// This is a **required** field for requests.
pub fn set_deployed_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_index_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UndeployIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::mutate_deployed_index][crate::client::IndexEndpointService::mutate_deployed_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::MutateDeployedIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> MutateDeployedIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct MutateDeployedIndex(RequestBuilder<crate::model::MutateDeployedIndexRequest>);
impl MutateDeployedIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::MutateDeployedIndexRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [mutate_deployed_index][crate::client::IndexEndpointService::mutate_deployed_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.mutate_deployed_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `mutate_deployed_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::MutateDeployedIndexResponse,
crate::model::MutateDeployedIndexOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::MutateDeployedIndexResponse,
crate::model::MutateDeployedIndexOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::IndexEndpointService::mutate_deployed_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [index_endpoint][crate::model::MutateDeployedIndexRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index_endpoint = v.into();
self
}
/// Sets the value of [deployed_index][crate::model::MutateDeployedIndexRequest::deployed_index].
///
/// This is a **required** field for requests.
pub fn set_deployed_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DeployedIndex>,
{
self.0.request.deployed_index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deployed_index][crate::model::MutateDeployedIndexRequest::deployed_index].
///
/// This is a **required** field for requests.
pub fn set_or_clear_deployed_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DeployedIndex>,
{
self.0.request.deployed_index = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for MutateDeployedIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::list_locations][crate::client::IndexEndpointService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::get_location][crate::client::IndexEndpointService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::set_iam_policy][crate::client::IndexEndpointService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::get_iam_policy][crate::client::IndexEndpointService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::test_iam_permissions][crate::client::IndexEndpointService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::list_operations][crate::client::IndexEndpointService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::get_operation][crate::client::IndexEndpointService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::delete_operation][crate::client::IndexEndpointService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::cancel_operation][crate::client::IndexEndpointService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexEndpointService::wait_operation][crate::client::IndexEndpointService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_endpoint_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexEndpointService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [IndexService][crate::client::IndexService].
#[cfg(feature = "index-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "index-service")))]
pub mod index_service {
use crate::Result;
/// A builder for [IndexService][crate::client::IndexService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::index_service::ClientBuilder;
/// # use client::IndexService;
/// let builder : ClientBuilder = IndexService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::IndexService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = IndexService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::IndexService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [IndexService::create_index][crate::client::IndexService::create_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::CreateIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateIndex(RequestBuilder<crate::model::CreateIndexRequest>);
impl CreateIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_index][crate::client::IndexService::create_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<crate::model::Index, crate::model::CreateIndexOperationMetadata>
{
type Operation = google_cloud_lro::internal::Operation<
crate::model::Index,
crate::model::CreateIndexOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::IndexService::create_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateIndexRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [index][crate::model::CreateIndexRequest::index].
///
/// This is a **required** field for requests.
pub fn set_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.0.request.index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index][crate::model::CreateIndexRequest::index].
///
/// This is a **required** field for requests.
pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.0.request.index = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::get_index][crate::client::IndexService::get_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::GetIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIndex(RequestBuilder<crate::model::GetIndexRequest>);
impl GetIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Index> {
(*self.0.stub)
.get_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetIndexRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::list_indexes][crate::client::IndexService::list_indexes] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::ListIndexes;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListIndexes {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListIndexes(RequestBuilder<crate::model::ListIndexesRequest>);
impl ListIndexes {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListIndexesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListIndexesResponse> {
(*self.0.stub)
.list_indexes(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListIndexesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListIndexesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListIndexesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListIndexesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListIndexesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListIndexesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListIndexesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListIndexesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListIndexes {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::update_index][crate::client::IndexService::update_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::UpdateIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateIndex(RequestBuilder<crate::model::UpdateIndexRequest>);
impl UpdateIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_index][crate::client::IndexService::update_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<crate::model::Index, crate::model::UpdateIndexOperationMetadata>
{
type Operation = google_cloud_lro::internal::Operation<
crate::model::Index,
crate::model::UpdateIndexOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::IndexService::update_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [index][crate::model::UpdateIndexRequest::index].
///
/// This is a **required** field for requests.
pub fn set_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.0.request.index = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [index][crate::model::UpdateIndexRequest::index].
///
/// This is a **required** field for requests.
pub fn set_or_clear_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Index>,
{
self.0.request.index = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateIndexRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateIndexRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::delete_index][crate::client::IndexService::delete_index] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::DeleteIndex;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteIndex {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteIndex(RequestBuilder<crate::model::DeleteIndexRequest>);
impl DeleteIndex {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteIndexRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_index][crate::client::IndexService::delete_index].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_index(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_index`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::IndexService::delete_index::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteIndexRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteIndex {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::upsert_datapoints][crate::client::IndexService::upsert_datapoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::UpsertDatapoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpsertDatapoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpsertDatapoints(RequestBuilder<crate::model::UpsertDatapointsRequest>);
impl UpsertDatapoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpsertDatapointsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::UpsertDatapointsResponse> {
(*self.0.stub)
.upsert_datapoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [index][crate::model::UpsertDatapointsRequest::index].
///
/// This is a **required** field for requests.
pub fn set_index<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index = v.into();
self
}
/// Sets the value of [datapoints][crate::model::UpsertDatapointsRequest::datapoints].
pub fn set_datapoints<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::IndexDatapoint>,
{
use std::iter::Iterator;
self.0.request.datapoints = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [update_mask][crate::model::UpsertDatapointsRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpsertDatapointsRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpsertDatapoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::remove_datapoints][crate::client::IndexService::remove_datapoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::RemoveDatapoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RemoveDatapoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RemoveDatapoints(RequestBuilder<crate::model::RemoveDatapointsRequest>);
impl RemoveDatapoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RemoveDatapointsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RemoveDatapointsResponse> {
(*self.0.stub)
.remove_datapoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [index][crate::model::RemoveDatapointsRequest::index].
///
/// This is a **required** field for requests.
pub fn set_index<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index = v.into();
self
}
/// Sets the value of [datapoint_ids][crate::model::RemoveDatapointsRequest::datapoint_ids].
pub fn set_datapoint_ids<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.datapoint_ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RemoveDatapoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::list_locations][crate::client::IndexService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::get_location][crate::client::IndexService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::set_iam_policy][crate::client::IndexService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::get_iam_policy][crate::client::IndexService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::test_iam_permissions][crate::client::IndexService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::list_operations][crate::client::IndexService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::get_operation][crate::client::IndexService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::delete_operation][crate::client::IndexService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::cancel_operation][crate::client::IndexService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [IndexService::wait_operation][crate::client::IndexService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::index_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::IndexService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [JobService][crate::client::JobService].
#[cfg(feature = "job-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "job-service")))]
pub mod job_service {
use crate::Result;
/// A builder for [JobService][crate::client::JobService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::job_service::ClientBuilder;
/// # use client::JobService;
/// let builder : ClientBuilder = JobService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::JobService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = JobService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::JobService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [JobService::create_custom_job][crate::client::JobService::create_custom_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateCustomJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateCustomJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateCustomJob(RequestBuilder<crate::model::CreateCustomJobRequest>);
impl CreateCustomJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateCustomJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CustomJob> {
(*self.0.stub)
.create_custom_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateCustomJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [custom_job][crate::model::CreateCustomJobRequest::custom_job].
///
/// This is a **required** field for requests.
pub fn set_custom_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CustomJob>,
{
self.0.request.custom_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [custom_job][crate::model::CreateCustomJobRequest::custom_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_custom_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CustomJob>,
{
self.0.request.custom_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateCustomJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_custom_job][crate::client::JobService::get_custom_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetCustomJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetCustomJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetCustomJob(RequestBuilder<crate::model::GetCustomJobRequest>);
impl GetCustomJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetCustomJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CustomJob> {
(*self.0.stub)
.get_custom_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetCustomJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetCustomJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_custom_jobs][crate::client::JobService::list_custom_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListCustomJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListCustomJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListCustomJobs(RequestBuilder<crate::model::ListCustomJobsRequest>);
impl ListCustomJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListCustomJobsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListCustomJobsResponse> {
(*self.0.stub)
.list_custom_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListCustomJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListCustomJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListCustomJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListCustomJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListCustomJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListCustomJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListCustomJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListCustomJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListCustomJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_custom_job][crate::client::JobService::delete_custom_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteCustomJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteCustomJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteCustomJob(RequestBuilder<crate::model::DeleteCustomJobRequest>);
impl DeleteCustomJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteCustomJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_custom_job][crate::client::JobService::delete_custom_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_custom_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_custom_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::JobService::delete_custom_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteCustomJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteCustomJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_custom_job][crate::client::JobService::cancel_custom_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelCustomJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelCustomJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelCustomJob(RequestBuilder<crate::model::CancelCustomJobRequest>);
impl CancelCustomJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelCustomJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_custom_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelCustomJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelCustomJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::create_data_labeling_job][crate::client::JobService::create_data_labeling_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateDataLabelingJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateDataLabelingJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateDataLabelingJob(RequestBuilder<crate::model::CreateDataLabelingJobRequest>);
impl CreateDataLabelingJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateDataLabelingJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DataLabelingJob> {
(*self.0.stub)
.create_data_labeling_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateDataLabelingJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [data_labeling_job][crate::model::CreateDataLabelingJobRequest::data_labeling_job].
///
/// This is a **required** field for requests.
pub fn set_data_labeling_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataLabelingJob>,
{
self.0.request.data_labeling_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [data_labeling_job][crate::model::CreateDataLabelingJobRequest::data_labeling_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_data_labeling_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataLabelingJob>,
{
self.0.request.data_labeling_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateDataLabelingJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_data_labeling_job][crate::client::JobService::get_data_labeling_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetDataLabelingJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetDataLabelingJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetDataLabelingJob(RequestBuilder<crate::model::GetDataLabelingJobRequest>);
impl GetDataLabelingJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetDataLabelingJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DataLabelingJob> {
(*self.0.stub)
.get_data_labeling_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetDataLabelingJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetDataLabelingJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_data_labeling_jobs][crate::client::JobService::list_data_labeling_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListDataLabelingJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListDataLabelingJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListDataLabelingJobs(RequestBuilder<crate::model::ListDataLabelingJobsRequest>);
impl ListDataLabelingJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListDataLabelingJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListDataLabelingJobsResponse> {
(*self.0.stub)
.list_data_labeling_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListDataLabelingJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListDataLabelingJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListDataLabelingJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDataLabelingJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDataLabelingJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDataLabelingJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListDataLabelingJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListDataLabelingJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListDataLabelingJobsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListDataLabelingJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_data_labeling_job][crate::client::JobService::delete_data_labeling_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteDataLabelingJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteDataLabelingJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteDataLabelingJob(RequestBuilder<crate::model::DeleteDataLabelingJobRequest>);
impl DeleteDataLabelingJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteDataLabelingJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_data_labeling_job][crate::client::JobService::delete_data_labeling_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_data_labeling_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_data_labeling_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::JobService::delete_data_labeling_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteDataLabelingJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteDataLabelingJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_data_labeling_job][crate::client::JobService::cancel_data_labeling_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelDataLabelingJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelDataLabelingJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelDataLabelingJob(RequestBuilder<crate::model::CancelDataLabelingJobRequest>);
impl CancelDataLabelingJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelDataLabelingJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_data_labeling_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelDataLabelingJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelDataLabelingJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::create_hyperparameter_tuning_job][crate::client::JobService::create_hyperparameter_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateHyperparameterTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateHyperparameterTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateHyperparameterTuningJob(
RequestBuilder<crate::model::CreateHyperparameterTuningJobRequest>,
);
impl CreateHyperparameterTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateHyperparameterTuningJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::HyperparameterTuningJob> {
(*self.0.stub)
.create_hyperparameter_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateHyperparameterTuningJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [hyperparameter_tuning_job][crate::model::CreateHyperparameterTuningJobRequest::hyperparameter_tuning_job].
///
/// This is a **required** field for requests.
pub fn set_hyperparameter_tuning_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::HyperparameterTuningJob>,
{
self.0.request.hyperparameter_tuning_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [hyperparameter_tuning_job][crate::model::CreateHyperparameterTuningJobRequest::hyperparameter_tuning_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_hyperparameter_tuning_job<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::HyperparameterTuningJob>,
{
self.0.request.hyperparameter_tuning_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateHyperparameterTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_hyperparameter_tuning_job][crate::client::JobService::get_hyperparameter_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetHyperparameterTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetHyperparameterTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetHyperparameterTuningJob(
RequestBuilder<crate::model::GetHyperparameterTuningJobRequest>,
);
impl GetHyperparameterTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetHyperparameterTuningJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::HyperparameterTuningJob> {
(*self.0.stub)
.get_hyperparameter_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetHyperparameterTuningJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetHyperparameterTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_hyperparameter_tuning_jobs][crate::client::JobService::list_hyperparameter_tuning_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListHyperparameterTuningJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListHyperparameterTuningJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListHyperparameterTuningJobs(
RequestBuilder<crate::model::ListHyperparameterTuningJobsRequest>,
);
impl ListHyperparameterTuningJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListHyperparameterTuningJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListHyperparameterTuningJobsResponse> {
(*self.0.stub)
.list_hyperparameter_tuning_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListHyperparameterTuningJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListHyperparameterTuningJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListHyperparameterTuningJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListHyperparameterTuningJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListHyperparameterTuningJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListHyperparameterTuningJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListHyperparameterTuningJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListHyperparameterTuningJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListHyperparameterTuningJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_hyperparameter_tuning_job][crate::client::JobService::delete_hyperparameter_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteHyperparameterTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteHyperparameterTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteHyperparameterTuningJob(
RequestBuilder<crate::model::DeleteHyperparameterTuningJobRequest>,
);
impl DeleteHyperparameterTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteHyperparameterTuningJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_hyperparameter_tuning_job][crate::client::JobService::delete_hyperparameter_tuning_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_hyperparameter_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_hyperparameter_tuning_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::JobService::delete_hyperparameter_tuning_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteHyperparameterTuningJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteHyperparameterTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_hyperparameter_tuning_job][crate::client::JobService::cancel_hyperparameter_tuning_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelHyperparameterTuningJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelHyperparameterTuningJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelHyperparameterTuningJob(
RequestBuilder<crate::model::CancelHyperparameterTuningJobRequest>,
);
impl CancelHyperparameterTuningJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelHyperparameterTuningJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_hyperparameter_tuning_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelHyperparameterTuningJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelHyperparameterTuningJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::create_nas_job][crate::client::JobService::create_nas_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateNasJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateNasJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateNasJob(RequestBuilder<crate::model::CreateNasJobRequest>);
impl CreateNasJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateNasJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NasJob> {
(*self.0.stub)
.create_nas_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateNasJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [nas_job][crate::model::CreateNasJobRequest::nas_job].
///
/// This is a **required** field for requests.
pub fn set_nas_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NasJob>,
{
self.0.request.nas_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [nas_job][crate::model::CreateNasJobRequest::nas_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_nas_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NasJob>,
{
self.0.request.nas_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateNasJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_nas_job][crate::client::JobService::get_nas_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetNasJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetNasJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetNasJob(RequestBuilder<crate::model::GetNasJobRequest>);
impl GetNasJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetNasJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NasJob> {
(*self.0.stub)
.get_nas_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetNasJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetNasJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_nas_jobs][crate::client::JobService::list_nas_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListNasJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListNasJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListNasJobs(RequestBuilder<crate::model::ListNasJobsRequest>);
impl ListNasJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListNasJobsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListNasJobsResponse> {
(*self.0.stub)
.list_nas_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListNasJobsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListNasJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListNasJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListNasJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListNasJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListNasJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListNasJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListNasJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListNasJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_nas_job][crate::client::JobService::delete_nas_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteNasJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteNasJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteNasJob(RequestBuilder<crate::model::DeleteNasJobRequest>);
impl DeleteNasJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteNasJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_nas_job][crate::client::JobService::delete_nas_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_nas_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_nas_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::JobService::delete_nas_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteNasJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteNasJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_nas_job][crate::client::JobService::cancel_nas_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelNasJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelNasJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelNasJob(RequestBuilder<crate::model::CancelNasJobRequest>);
impl CancelNasJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelNasJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_nas_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelNasJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelNasJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_nas_trial_detail][crate::client::JobService::get_nas_trial_detail] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetNasTrialDetail;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetNasTrialDetail {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetNasTrialDetail(RequestBuilder<crate::model::GetNasTrialDetailRequest>);
impl GetNasTrialDetail {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetNasTrialDetailRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NasTrialDetail> {
(*self.0.stub)
.get_nas_trial_detail(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetNasTrialDetailRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetNasTrialDetail {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_nas_trial_details][crate::client::JobService::list_nas_trial_details] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListNasTrialDetails;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListNasTrialDetails {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListNasTrialDetails(RequestBuilder<crate::model::ListNasTrialDetailsRequest>);
impl ListNasTrialDetails {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListNasTrialDetailsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListNasTrialDetailsResponse> {
(*self.0.stub)
.list_nas_trial_details(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListNasTrialDetailsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListNasTrialDetailsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListNasTrialDetailsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListNasTrialDetailsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListNasTrialDetailsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListNasTrialDetails {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::create_batch_prediction_job][crate::client::JobService::create_batch_prediction_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateBatchPredictionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateBatchPredictionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateBatchPredictionJob(
RequestBuilder<crate::model::CreateBatchPredictionJobRequest>,
);
impl CreateBatchPredictionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateBatchPredictionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchPredictionJob> {
(*self.0.stub)
.create_batch_prediction_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateBatchPredictionJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [batch_prediction_job][crate::model::CreateBatchPredictionJobRequest::batch_prediction_job].
///
/// This is a **required** field for requests.
pub fn set_batch_prediction_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BatchPredictionJob>,
{
self.0.request.batch_prediction_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [batch_prediction_job][crate::model::CreateBatchPredictionJobRequest::batch_prediction_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_batch_prediction_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BatchPredictionJob>,
{
self.0.request.batch_prediction_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateBatchPredictionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_batch_prediction_job][crate::client::JobService::get_batch_prediction_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetBatchPredictionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetBatchPredictionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetBatchPredictionJob(RequestBuilder<crate::model::GetBatchPredictionJobRequest>);
impl GetBatchPredictionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetBatchPredictionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchPredictionJob> {
(*self.0.stub)
.get_batch_prediction_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetBatchPredictionJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetBatchPredictionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_batch_prediction_jobs][crate::client::JobService::list_batch_prediction_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListBatchPredictionJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListBatchPredictionJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListBatchPredictionJobs(
RequestBuilder<crate::model::ListBatchPredictionJobsRequest>,
);
impl ListBatchPredictionJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListBatchPredictionJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListBatchPredictionJobsResponse> {
(*self.0.stub)
.list_batch_prediction_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListBatchPredictionJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListBatchPredictionJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListBatchPredictionJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListBatchPredictionJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListBatchPredictionJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListBatchPredictionJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListBatchPredictionJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListBatchPredictionJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListBatchPredictionJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_batch_prediction_job][crate::client::JobService::delete_batch_prediction_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteBatchPredictionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteBatchPredictionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteBatchPredictionJob(
RequestBuilder<crate::model::DeleteBatchPredictionJobRequest>,
);
impl DeleteBatchPredictionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteBatchPredictionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_batch_prediction_job][crate::client::JobService::delete_batch_prediction_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_batch_prediction_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_batch_prediction_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::JobService::delete_batch_prediction_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteBatchPredictionJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteBatchPredictionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_batch_prediction_job][crate::client::JobService::cancel_batch_prediction_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelBatchPredictionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelBatchPredictionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelBatchPredictionJob(
RequestBuilder<crate::model::CancelBatchPredictionJobRequest>,
);
impl CancelBatchPredictionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelBatchPredictionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_batch_prediction_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelBatchPredictionJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelBatchPredictionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::create_model_deployment_monitoring_job][crate::client::JobService::create_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CreateModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateModelDeploymentMonitoringJob(
RequestBuilder<crate::model::CreateModelDeploymentMonitoringJobRequest>,
);
impl CreateModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ModelDeploymentMonitoringJob> {
(*self.0.stub)
.create_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateModelDeploymentMonitoringJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [model_deployment_monitoring_job][crate::model::CreateModelDeploymentMonitoringJobRequest::model_deployment_monitoring_job].
///
/// This is a **required** field for requests.
pub fn set_model_deployment_monitoring_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ModelDeploymentMonitoringJob>,
{
self.0.request.model_deployment_monitoring_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_deployment_monitoring_job][crate::model::CreateModelDeploymentMonitoringJobRequest::model_deployment_monitoring_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_model_deployment_monitoring_job<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ModelDeploymentMonitoringJob>,
{
self.0.request.model_deployment_monitoring_job = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::search_model_deployment_monitoring_stats_anomalies][crate::client::JobService::search_model_deployment_monitoring_stats_anomalies] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::SearchModelDeploymentMonitoringStatsAnomalies;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SearchModelDeploymentMonitoringStatsAnomalies {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SearchModelDeploymentMonitoringStatsAnomalies(
RequestBuilder<crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest>,
);
impl SearchModelDeploymentMonitoringStatsAnomalies {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<
V: Into<crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest>,
>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(
self,
) -> Result<crate::model::SearchModelDeploymentMonitoringStatsAnomaliesResponse> {
(*self.0.stub)
.search_model_deployment_monitoring_stats_anomalies(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::SearchModelDeploymentMonitoringStatsAnomaliesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::SearchModelDeploymentMonitoringStatsAnomaliesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [model_deployment_monitoring_job][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::model_deployment_monitoring_job].
///
/// This is a **required** field for requests.
pub fn set_model_deployment_monitoring_job<T: Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request.model_deployment_monitoring_job = v.into();
self
}
/// Sets the value of [deployed_model_id][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::deployed_model_id].
///
/// This is a **required** field for requests.
pub fn set_deployed_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_model_id = v.into();
self
}
/// Sets the value of [feature_display_name][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::feature_display_name].
pub fn set_feature_display_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.feature_display_name = v.into();
self
}
/// Sets the value of [objectives][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::objectives].
///
/// This is a **required** field for requests.
pub fn set_objectives<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_model_deployment_monitoring_stats_anomalies_request::StatsAnomaliesObjective>
{
use std::iter::Iterator;
self.0.request.objectives = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [page_size][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [start_time][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::start_time].
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_time][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::start_time].
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.start_time = v.map(|x| x.into());
self
}
/// Sets the value of [end_time][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::end_time].
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.end_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [end_time][crate::model::SearchModelDeploymentMonitoringStatsAnomaliesRequest::end_time].
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.0.request.end_time = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SearchModelDeploymentMonitoringStatsAnomalies {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_model_deployment_monitoring_job][crate::client::JobService::get_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetModelDeploymentMonitoringJob(
RequestBuilder<crate::model::GetModelDeploymentMonitoringJobRequest>,
);
impl GetModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ModelDeploymentMonitoringJob> {
(*self.0.stub)
.get_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetModelDeploymentMonitoringJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_model_deployment_monitoring_jobs][crate::client::JobService::list_model_deployment_monitoring_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListModelDeploymentMonitoringJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModelDeploymentMonitoringJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModelDeploymentMonitoringJobs(
RequestBuilder<crate::model::ListModelDeploymentMonitoringJobsRequest>,
);
impl ListModelDeploymentMonitoringJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelDeploymentMonitoringJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelDeploymentMonitoringJobsResponse> {
(*self.0.stub)
.list_model_deployment_monitoring_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListModelDeploymentMonitoringJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelDeploymentMonitoringJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListModelDeploymentMonitoringJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListModelDeploymentMonitoringJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelDeploymentMonitoringJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelDeploymentMonitoringJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListModelDeploymentMonitoringJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListModelDeploymentMonitoringJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModelDeploymentMonitoringJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::update_model_deployment_monitoring_job][crate::client::JobService::update_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::UpdateModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateModelDeploymentMonitoringJob(
RequestBuilder<crate::model::UpdateModelDeploymentMonitoringJobRequest>,
);
impl UpdateModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_model_deployment_monitoring_job][crate::client::JobService::update_model_deployment_monitoring_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_model_deployment_monitoring_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ModelDeploymentMonitoringJob,
crate::model::UpdateModelDeploymentMonitoringJobOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ModelDeploymentMonitoringJob,
crate::model::UpdateModelDeploymentMonitoringJobOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::JobService::update_model_deployment_monitoring_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [model_deployment_monitoring_job][crate::model::UpdateModelDeploymentMonitoringJobRequest::model_deployment_monitoring_job].
///
/// This is a **required** field for requests.
pub fn set_model_deployment_monitoring_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ModelDeploymentMonitoringJob>,
{
self.0.request.model_deployment_monitoring_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_deployment_monitoring_job][crate::model::UpdateModelDeploymentMonitoringJobRequest::model_deployment_monitoring_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_model_deployment_monitoring_job<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ModelDeploymentMonitoringJob>,
{
self.0.request.model_deployment_monitoring_job = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateModelDeploymentMonitoringJobRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateModelDeploymentMonitoringJobRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_model_deployment_monitoring_job][crate::client::JobService::delete_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteModelDeploymentMonitoringJob(
RequestBuilder<crate::model::DeleteModelDeploymentMonitoringJobRequest>,
);
impl DeleteModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_model_deployment_monitoring_job][crate::client::JobService::delete_model_deployment_monitoring_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_model_deployment_monitoring_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::JobService::delete_model_deployment_monitoring_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteModelDeploymentMonitoringJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::pause_model_deployment_monitoring_job][crate::client::JobService::pause_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::PauseModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> PauseModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct PauseModelDeploymentMonitoringJob(
RequestBuilder<crate::model::PauseModelDeploymentMonitoringJobRequest>,
);
impl PauseModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PauseModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.pause_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::PauseModelDeploymentMonitoringJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PauseModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::resume_model_deployment_monitoring_job][crate::client::JobService::resume_model_deployment_monitoring_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ResumeModelDeploymentMonitoringJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ResumeModelDeploymentMonitoringJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ResumeModelDeploymentMonitoringJob(
RequestBuilder<crate::model::ResumeModelDeploymentMonitoringJobRequest>,
);
impl ResumeModelDeploymentMonitoringJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ResumeModelDeploymentMonitoringJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.resume_model_deployment_monitoring_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::ResumeModelDeploymentMonitoringJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ResumeModelDeploymentMonitoringJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_locations][crate::client::JobService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_location][crate::client::JobService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::set_iam_policy][crate::client::JobService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_iam_policy][crate::client::JobService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::test_iam_permissions][crate::client::JobService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::list_operations][crate::client::JobService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::get_operation][crate::client::JobService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::delete_operation][crate::client::JobService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::cancel_operation][crate::client::JobService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [JobService::wait_operation][crate::client::JobService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::job_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::JobService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [LlmUtilityService][crate::client::LlmUtilityService].
#[cfg(feature = "llm-utility-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "llm-utility-service")))]
pub mod llm_utility_service {
use crate::Result;
/// A builder for [LlmUtilityService][crate::client::LlmUtilityService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::llm_utility_service::ClientBuilder;
/// # use client::LlmUtilityService;
/// let builder : ClientBuilder = LlmUtilityService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::LlmUtilityService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = LlmUtilityService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::LlmUtilityService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [LlmUtilityService::count_tokens][crate::client::LlmUtilityService::count_tokens] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::CountTokens;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CountTokens {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CountTokens(RequestBuilder<crate::model::CountTokensRequest>);
impl CountTokens {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CountTokensRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CountTokensResponse> {
(*self.0.stub)
.count_tokens(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::CountTokensRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [model][crate::model::CountTokensRequest::model].
pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.model = v.into();
self
}
/// Sets the value of [instances][crate::model::CountTokensRequest::instances].
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.0.request.instances = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [contents][crate::model::CountTokensRequest::contents].
pub fn set_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Content>,
{
use std::iter::Iterator;
self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [system_instruction][crate::model::CountTokensRequest::system_instruction].
pub fn set_system_instruction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.system_instruction = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [system_instruction][crate::model::CountTokensRequest::system_instruction].
pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.system_instruction = v.map(|x| x.into());
self
}
/// Sets the value of [tools][crate::model::CountTokensRequest::tools].
pub fn set_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tool>,
{
use std::iter::Iterator;
self.0.request.tools = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [generation_config][crate::model::CountTokensRequest::generation_config].
pub fn set_generation_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenerationConfig>,
{
self.0.request.generation_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generation_config][crate::model::CountTokensRequest::generation_config].
pub fn set_or_clear_generation_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenerationConfig>,
{
self.0.request.generation_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CountTokens {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::compute_tokens][crate::client::LlmUtilityService::compute_tokens] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::ComputeTokens;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ComputeTokens {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ComputeTokens(RequestBuilder<crate::model::ComputeTokensRequest>);
impl ComputeTokens {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ComputeTokensRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ComputeTokensResponse> {
(*self.0.stub)
.compute_tokens(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::ComputeTokensRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [instances][crate::model::ComputeTokensRequest::instances].
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.0.request.instances = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model][crate::model::ComputeTokensRequest::model].
pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.model = v.into();
self
}
/// Sets the value of [contents][crate::model::ComputeTokensRequest::contents].
pub fn set_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Content>,
{
use std::iter::Iterator;
self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ComputeTokens {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::list_locations][crate::client::LlmUtilityService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::get_location][crate::client::LlmUtilityService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::set_iam_policy][crate::client::LlmUtilityService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::get_iam_policy][crate::client::LlmUtilityService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::test_iam_permissions][crate::client::LlmUtilityService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::list_operations][crate::client::LlmUtilityService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::get_operation][crate::client::LlmUtilityService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::delete_operation][crate::client::LlmUtilityService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::cancel_operation][crate::client::LlmUtilityService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [LlmUtilityService::wait_operation][crate::client::LlmUtilityService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::llm_utility_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::LlmUtilityService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [MatchService][crate::client::MatchService].
#[cfg(feature = "match-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "match-service")))]
pub mod match_service {
use crate::Result;
/// A builder for [MatchService][crate::client::MatchService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::match_service::ClientBuilder;
/// # use client::MatchService;
/// let builder : ClientBuilder = MatchService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::MatchService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = MatchService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::MatchService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [MatchService::find_neighbors][crate::client::MatchService::find_neighbors] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::FindNeighbors;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> FindNeighbors {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct FindNeighbors(RequestBuilder<crate::model::FindNeighborsRequest>);
impl FindNeighbors {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::FindNeighborsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::FindNeighborsResponse> {
(*self.0.stub)
.find_neighbors(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [index_endpoint][crate::model::FindNeighborsRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index_endpoint = v.into();
self
}
/// Sets the value of [deployed_index_id][crate::model::FindNeighborsRequest::deployed_index_id].
pub fn set_deployed_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_index_id = v.into();
self
}
/// Sets the value of [queries][crate::model::FindNeighborsRequest::queries].
pub fn set_queries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::find_neighbors_request::Query>,
{
use std::iter::Iterator;
self.0.request.queries = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [return_full_datapoint][crate::model::FindNeighborsRequest::return_full_datapoint].
pub fn set_return_full_datapoint<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_full_datapoint = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for FindNeighbors {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::read_index_datapoints][crate::client::MatchService::read_index_datapoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::ReadIndexDatapoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ReadIndexDatapoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ReadIndexDatapoints(RequestBuilder<crate::model::ReadIndexDatapointsRequest>);
impl ReadIndexDatapoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReadIndexDatapointsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReadIndexDatapointsResponse> {
(*self.0.stub)
.read_index_datapoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [index_endpoint][crate::model::ReadIndexDatapointsRequest::index_endpoint].
///
/// This is a **required** field for requests.
pub fn set_index_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.index_endpoint = v.into();
self
}
/// Sets the value of [deployed_index_id][crate::model::ReadIndexDatapointsRequest::deployed_index_id].
pub fn set_deployed_index_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_index_id = v.into();
self
}
/// Sets the value of [ids][crate::model::ReadIndexDatapointsRequest::ids].
pub fn set_ids<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.ids = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ReadIndexDatapoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::list_locations][crate::client::MatchService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::get_location][crate::client::MatchService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::set_iam_policy][crate::client::MatchService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::get_iam_policy][crate::client::MatchService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::test_iam_permissions][crate::client::MatchService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::list_operations][crate::client::MatchService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::get_operation][crate::client::MatchService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::delete_operation][crate::client::MatchService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::cancel_operation][crate::client::MatchService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MatchService::wait_operation][crate::client::MatchService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::match_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MatchService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [MetadataService][crate::client::MetadataService].
#[cfg(feature = "metadata-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "metadata-service")))]
pub mod metadata_service {
use crate::Result;
/// A builder for [MetadataService][crate::client::MetadataService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::metadata_service::ClientBuilder;
/// # use client::MetadataService;
/// let builder : ClientBuilder = MetadataService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::MetadataService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = MetadataService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::MetadataService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [MetadataService::create_metadata_store][crate::client::MetadataService::create_metadata_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CreateMetadataStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateMetadataStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateMetadataStore(RequestBuilder<crate::model::CreateMetadataStoreRequest>);
impl CreateMetadataStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateMetadataStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_metadata_store][crate::client::MetadataService::create_metadata_store].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_metadata_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_metadata_store`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::MetadataStore,
crate::model::CreateMetadataStoreOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::MetadataStore,
crate::model::CreateMetadataStoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::create_metadata_store::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateMetadataStoreRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [metadata_store][crate::model::CreateMetadataStoreRequest::metadata_store].
///
/// This is a **required** field for requests.
pub fn set_metadata_store<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MetadataStore>,
{
self.0.request.metadata_store = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata_store][crate::model::CreateMetadataStoreRequest::metadata_store].
///
/// This is a **required** field for requests.
pub fn set_or_clear_metadata_store<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MetadataStore>,
{
self.0.request.metadata_store = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_store_id][crate::model::CreateMetadataStoreRequest::metadata_store_id].
pub fn set_metadata_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.metadata_store_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateMetadataStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_metadata_store][crate::client::MetadataService::get_metadata_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetMetadataStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetMetadataStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetMetadataStore(RequestBuilder<crate::model::GetMetadataStoreRequest>);
impl GetMetadataStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetMetadataStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::MetadataStore> {
(*self.0.stub)
.get_metadata_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetMetadataStoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetMetadataStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_metadata_stores][crate::client::MetadataService::list_metadata_stores] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListMetadataStores;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListMetadataStores {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListMetadataStores(RequestBuilder<crate::model::ListMetadataStoresRequest>);
impl ListMetadataStores {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListMetadataStoresRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListMetadataStoresResponse> {
(*self.0.stub)
.list_metadata_stores(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListMetadataStoresResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListMetadataStoresResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListMetadataStoresRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListMetadataStoresRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListMetadataStoresRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListMetadataStores {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::delete_metadata_store][crate::client::MetadataService::delete_metadata_store] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::DeleteMetadataStore;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteMetadataStore {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteMetadataStore(RequestBuilder<crate::model::DeleteMetadataStoreRequest>);
impl DeleteMetadataStore {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteMetadataStoreRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_metadata_store][crate::client::MetadataService::delete_metadata_store].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_metadata_store(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_metadata_store`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteMetadataStoreOperationMetadata>
{
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteMetadataStoreOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::delete_metadata_store::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteMetadataStoreRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteMetadataStoreRequest::force].
#[deprecated]
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteMetadataStore {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::create_artifact][crate::client::MetadataService::create_artifact] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CreateArtifact;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateArtifact {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateArtifact(RequestBuilder<crate::model::CreateArtifactRequest>);
impl CreateArtifact {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateArtifactRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Artifact> {
(*self.0.stub)
.create_artifact(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateArtifactRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [artifact][crate::model::CreateArtifactRequest::artifact].
///
/// This is a **required** field for requests.
pub fn set_artifact<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Artifact>,
{
self.0.request.artifact = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [artifact][crate::model::CreateArtifactRequest::artifact].
///
/// This is a **required** field for requests.
pub fn set_or_clear_artifact<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Artifact>,
{
self.0.request.artifact = v.map(|x| x.into());
self
}
/// Sets the value of [artifact_id][crate::model::CreateArtifactRequest::artifact_id].
pub fn set_artifact_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.artifact_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateArtifact {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_artifact][crate::client::MetadataService::get_artifact] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetArtifact;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetArtifact {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetArtifact(RequestBuilder<crate::model::GetArtifactRequest>);
impl GetArtifact {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetArtifactRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Artifact> {
(*self.0.stub)
.get_artifact(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetArtifactRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetArtifact {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_artifacts][crate::client::MetadataService::list_artifacts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListArtifacts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListArtifacts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListArtifacts(RequestBuilder<crate::model::ListArtifactsRequest>);
impl ListArtifacts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListArtifactsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListArtifactsResponse> {
(*self.0.stub)
.list_artifacts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListArtifactsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListArtifactsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListArtifactsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListArtifactsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListArtifactsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListArtifactsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListArtifactsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListArtifacts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::update_artifact][crate::client::MetadataService::update_artifact] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::UpdateArtifact;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateArtifact {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateArtifact(RequestBuilder<crate::model::UpdateArtifactRequest>);
impl UpdateArtifact {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateArtifactRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Artifact> {
(*self.0.stub)
.update_artifact(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [artifact][crate::model::UpdateArtifactRequest::artifact].
///
/// This is a **required** field for requests.
pub fn set_artifact<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Artifact>,
{
self.0.request.artifact = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [artifact][crate::model::UpdateArtifactRequest::artifact].
///
/// This is a **required** field for requests.
pub fn set_or_clear_artifact<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Artifact>,
{
self.0.request.artifact = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateArtifactRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateArtifactRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [allow_missing][crate::model::UpdateArtifactRequest::allow_missing].
pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.allow_missing = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateArtifact {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::delete_artifact][crate::client::MetadataService::delete_artifact] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::DeleteArtifact;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteArtifact {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteArtifact(RequestBuilder<crate::model::DeleteArtifactRequest>);
impl DeleteArtifact {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteArtifactRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_artifact][crate::client::MetadataService::delete_artifact].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_artifact(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_artifact`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::delete_artifact::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteArtifactRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [etag][crate::model::DeleteArtifactRequest::etag].
pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteArtifact {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::purge_artifacts][crate::client::MetadataService::purge_artifacts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::PurgeArtifacts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> PurgeArtifacts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct PurgeArtifacts(RequestBuilder<crate::model::PurgeArtifactsRequest>);
impl PurgeArtifacts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PurgeArtifactsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [purge_artifacts][crate::client::MetadataService::purge_artifacts].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.purge_artifacts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_artifacts`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PurgeArtifactsResponse,
crate::model::PurgeArtifactsMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PurgeArtifactsResponse,
crate::model::PurgeArtifactsMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::purge_artifacts::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::PurgeArtifactsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::PurgeArtifactsRequest::filter].
///
/// This is a **required** field for requests.
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [force][crate::model::PurgeArtifactsRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PurgeArtifacts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::create_context][crate::client::MetadataService::create_context] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CreateContext;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateContext {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateContext(RequestBuilder<crate::model::CreateContextRequest>);
impl CreateContext {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateContextRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Context> {
(*self.0.stub)
.create_context(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateContextRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [context][crate::model::CreateContextRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.0.request.context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [context][crate::model::CreateContextRequest::context].
///
/// This is a **required** field for requests.
pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.0.request.context = v.map(|x| x.into());
self
}
/// Sets the value of [context_id][crate::model::CreateContextRequest::context_id].
pub fn set_context_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.context_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateContext {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_context][crate::client::MetadataService::get_context] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetContext;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetContext {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetContext(RequestBuilder<crate::model::GetContextRequest>);
impl GetContext {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetContextRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Context> {
(*self.0.stub)
.get_context(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetContextRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetContext {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_contexts][crate::client::MetadataService::list_contexts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListContexts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListContexts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListContexts(RequestBuilder<crate::model::ListContextsRequest>);
impl ListContexts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListContextsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListContextsResponse> {
(*self.0.stub)
.list_contexts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListContextsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListContextsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListContextsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListContextsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListContextsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListContextsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListContextsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListContexts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::update_context][crate::client::MetadataService::update_context] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::UpdateContext;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateContext {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateContext(RequestBuilder<crate::model::UpdateContextRequest>);
impl UpdateContext {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateContextRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Context> {
(*self.0.stub)
.update_context(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [context][crate::model::UpdateContextRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.0.request.context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [context][crate::model::UpdateContextRequest::context].
///
/// This is a **required** field for requests.
pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.0.request.context = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateContextRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateContextRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [allow_missing][crate::model::UpdateContextRequest::allow_missing].
pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.allow_missing = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateContext {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::delete_context][crate::client::MetadataService::delete_context] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::DeleteContext;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteContext {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteContext(RequestBuilder<crate::model::DeleteContextRequest>);
impl DeleteContext {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteContextRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_context][crate::client::MetadataService::delete_context].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_context(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_context`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::delete_context::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteContextRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteContextRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
/// Sets the value of [etag][crate::model::DeleteContextRequest::etag].
pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteContext {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::purge_contexts][crate::client::MetadataService::purge_contexts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::PurgeContexts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> PurgeContexts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct PurgeContexts(RequestBuilder<crate::model::PurgeContextsRequest>);
impl PurgeContexts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PurgeContextsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [purge_contexts][crate::client::MetadataService::purge_contexts].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.purge_contexts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_contexts`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PurgeContextsResponse,
crate::model::PurgeContextsMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PurgeContextsResponse,
crate::model::PurgeContextsMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::purge_contexts::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::PurgeContextsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::PurgeContextsRequest::filter].
///
/// This is a **required** field for requests.
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [force][crate::model::PurgeContextsRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PurgeContexts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::add_context_artifacts_and_executions][crate::client::MetadataService::add_context_artifacts_and_executions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::AddContextArtifactsAndExecutions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AddContextArtifactsAndExecutions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AddContextArtifactsAndExecutions(
RequestBuilder<crate::model::AddContextArtifactsAndExecutionsRequest>,
);
impl AddContextArtifactsAndExecutions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AddContextArtifactsAndExecutionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AddContextArtifactsAndExecutionsResponse> {
(*self.0.stub)
.add_context_artifacts_and_executions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [context][crate::model::AddContextArtifactsAndExecutionsRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.context = v.into();
self
}
/// Sets the value of [artifacts][crate::model::AddContextArtifactsAndExecutionsRequest::artifacts].
pub fn set_artifacts<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.artifacts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [executions][crate::model::AddContextArtifactsAndExecutionsRequest::executions].
pub fn set_executions<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.executions = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AddContextArtifactsAndExecutions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::add_context_children][crate::client::MetadataService::add_context_children] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::AddContextChildren;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AddContextChildren {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AddContextChildren(RequestBuilder<crate::model::AddContextChildrenRequest>);
impl AddContextChildren {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AddContextChildrenRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AddContextChildrenResponse> {
(*self.0.stub)
.add_context_children(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [context][crate::model::AddContextChildrenRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.context = v.into();
self
}
/// Sets the value of [child_contexts][crate::model::AddContextChildrenRequest::child_contexts].
pub fn set_child_contexts<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.child_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AddContextChildren {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::remove_context_children][crate::client::MetadataService::remove_context_children] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::RemoveContextChildren;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RemoveContextChildren {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RemoveContextChildren(RequestBuilder<crate::model::RemoveContextChildrenRequest>);
impl RemoveContextChildren {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RemoveContextChildrenRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RemoveContextChildrenResponse> {
(*self.0.stub)
.remove_context_children(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [context][crate::model::RemoveContextChildrenRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.context = v.into();
self
}
/// Sets the value of [child_contexts][crate::model::RemoveContextChildrenRequest::child_contexts].
pub fn set_child_contexts<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.child_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RemoveContextChildren {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::query_context_lineage_subgraph][crate::client::MetadataService::query_context_lineage_subgraph] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::QueryContextLineageSubgraph;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> QueryContextLineageSubgraph {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct QueryContextLineageSubgraph(
RequestBuilder<crate::model::QueryContextLineageSubgraphRequest>,
);
impl QueryContextLineageSubgraph {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::QueryContextLineageSubgraphRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::LineageSubgraph> {
(*self.0.stub)
.query_context_lineage_subgraph(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [context][crate::model::QueryContextLineageSubgraphRequest::context].
///
/// This is a **required** field for requests.
pub fn set_context<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.context = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for QueryContextLineageSubgraph {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::create_execution][crate::client::MetadataService::create_execution] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CreateExecution;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateExecution {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateExecution(RequestBuilder<crate::model::CreateExecutionRequest>);
impl CreateExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateExecutionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Execution> {
(*self.0.stub)
.create_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateExecutionRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [execution][crate::model::CreateExecutionRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_execution<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [execution][crate::model::CreateExecutionRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_or_clear_execution<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = v.map(|x| x.into());
self
}
/// Sets the value of [execution_id][crate::model::CreateExecutionRequest::execution_id].
pub fn set_execution_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.execution_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_execution][crate::client::MetadataService::get_execution] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetExecution;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetExecution {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetExecution(RequestBuilder<crate::model::GetExecutionRequest>);
impl GetExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetExecutionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Execution> {
(*self.0.stub)
.get_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetExecutionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_executions][crate::client::MetadataService::list_executions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListExecutions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListExecutions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListExecutions(RequestBuilder<crate::model::ListExecutionsRequest>);
impl ListExecutions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListExecutionsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListExecutionsResponse> {
(*self.0.stub)
.list_executions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListExecutionsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListExecutionsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListExecutionsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListExecutionsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListExecutionsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListExecutionsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListExecutionsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListExecutions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::update_execution][crate::client::MetadataService::update_execution] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::UpdateExecution;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateExecution {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateExecution(RequestBuilder<crate::model::UpdateExecutionRequest>);
impl UpdateExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateExecutionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Execution> {
(*self.0.stub)
.update_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [execution][crate::model::UpdateExecutionRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_execution<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [execution][crate::model::UpdateExecutionRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_or_clear_execution<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Execution>,
{
self.0.request.execution = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateExecutionRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateExecutionRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [allow_missing][crate::model::UpdateExecutionRequest::allow_missing].
pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.allow_missing = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::delete_execution][crate::client::MetadataService::delete_execution] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::DeleteExecution;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteExecution {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteExecution(RequestBuilder<crate::model::DeleteExecutionRequest>);
impl DeleteExecution {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteExecutionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_execution][crate::client::MetadataService::delete_execution].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_execution(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_execution`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::delete_execution::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteExecutionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [etag][crate::model::DeleteExecutionRequest::etag].
pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteExecution {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::purge_executions][crate::client::MetadataService::purge_executions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::PurgeExecutions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> PurgeExecutions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct PurgeExecutions(RequestBuilder<crate::model::PurgeExecutionsRequest>);
impl PurgeExecutions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PurgeExecutionsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [purge_executions][crate::client::MetadataService::purge_executions].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.purge_executions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `purge_executions`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PurgeExecutionsResponse,
crate::model::PurgeExecutionsMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PurgeExecutionsResponse,
crate::model::PurgeExecutionsMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MetadataService::purge_executions::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::PurgeExecutionsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::PurgeExecutionsRequest::filter].
///
/// This is a **required** field for requests.
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [force][crate::model::PurgeExecutionsRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PurgeExecutions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::add_execution_events][crate::client::MetadataService::add_execution_events] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::AddExecutionEvents;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AddExecutionEvents {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AddExecutionEvents(RequestBuilder<crate::model::AddExecutionEventsRequest>);
impl AddExecutionEvents {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AddExecutionEventsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AddExecutionEventsResponse> {
(*self.0.stub)
.add_execution_events(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [execution][crate::model::AddExecutionEventsRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_execution<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.execution = v.into();
self
}
/// Sets the value of [events][crate::model::AddExecutionEventsRequest::events].
pub fn set_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Event>,
{
use std::iter::Iterator;
self.0.request.events = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AddExecutionEvents {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::query_execution_inputs_and_outputs][crate::client::MetadataService::query_execution_inputs_and_outputs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::QueryExecutionInputsAndOutputs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> QueryExecutionInputsAndOutputs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct QueryExecutionInputsAndOutputs(
RequestBuilder<crate::model::QueryExecutionInputsAndOutputsRequest>,
);
impl QueryExecutionInputsAndOutputs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::QueryExecutionInputsAndOutputsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::LineageSubgraph> {
(*self.0.stub)
.query_execution_inputs_and_outputs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [execution][crate::model::QueryExecutionInputsAndOutputsRequest::execution].
///
/// This is a **required** field for requests.
pub fn set_execution<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.execution = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for QueryExecutionInputsAndOutputs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::create_metadata_schema][crate::client::MetadataService::create_metadata_schema] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CreateMetadataSchema;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateMetadataSchema {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateMetadataSchema(RequestBuilder<crate::model::CreateMetadataSchemaRequest>);
impl CreateMetadataSchema {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateMetadataSchemaRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::MetadataSchema> {
(*self.0.stub)
.create_metadata_schema(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateMetadataSchemaRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [metadata_schema][crate::model::CreateMetadataSchemaRequest::metadata_schema].
///
/// This is a **required** field for requests.
pub fn set_metadata_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MetadataSchema>,
{
self.0.request.metadata_schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata_schema][crate::model::CreateMetadataSchemaRequest::metadata_schema].
///
/// This is a **required** field for requests.
pub fn set_or_clear_metadata_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MetadataSchema>,
{
self.0.request.metadata_schema = v.map(|x| x.into());
self
}
/// Sets the value of [metadata_schema_id][crate::model::CreateMetadataSchemaRequest::metadata_schema_id].
pub fn set_metadata_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.metadata_schema_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateMetadataSchema {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_metadata_schema][crate::client::MetadataService::get_metadata_schema] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetMetadataSchema;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetMetadataSchema {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetMetadataSchema(RequestBuilder<crate::model::GetMetadataSchemaRequest>);
impl GetMetadataSchema {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetMetadataSchemaRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::MetadataSchema> {
(*self.0.stub)
.get_metadata_schema(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetMetadataSchemaRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetMetadataSchema {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_metadata_schemas][crate::client::MetadataService::list_metadata_schemas] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListMetadataSchemas;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListMetadataSchemas {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListMetadataSchemas(RequestBuilder<crate::model::ListMetadataSchemasRequest>);
impl ListMetadataSchemas {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListMetadataSchemasRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListMetadataSchemasResponse> {
(*self.0.stub)
.list_metadata_schemas(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListMetadataSchemasResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListMetadataSchemasResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListMetadataSchemasRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListMetadataSchemasRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListMetadataSchemasRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListMetadataSchemasRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListMetadataSchemas {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::query_artifact_lineage_subgraph][crate::client::MetadataService::query_artifact_lineage_subgraph] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::QueryArtifactLineageSubgraph;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> QueryArtifactLineageSubgraph {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct QueryArtifactLineageSubgraph(
RequestBuilder<crate::model::QueryArtifactLineageSubgraphRequest>,
);
impl QueryArtifactLineageSubgraph {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::QueryArtifactLineageSubgraphRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::LineageSubgraph> {
(*self.0.stub)
.query_artifact_lineage_subgraph(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [artifact][crate::model::QueryArtifactLineageSubgraphRequest::artifact].
///
/// This is a **required** field for requests.
pub fn set_artifact<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.artifact = v.into();
self
}
/// Sets the value of [max_hops][crate::model::QueryArtifactLineageSubgraphRequest::max_hops].
pub fn set_max_hops<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.max_hops = v.into();
self
}
/// Sets the value of [filter][crate::model::QueryArtifactLineageSubgraphRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for QueryArtifactLineageSubgraph {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_locations][crate::client::MetadataService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_location][crate::client::MetadataService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::set_iam_policy][crate::client::MetadataService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_iam_policy][crate::client::MetadataService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::test_iam_permissions][crate::client::MetadataService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::list_operations][crate::client::MetadataService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::get_operation][crate::client::MetadataService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::delete_operation][crate::client::MetadataService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::cancel_operation][crate::client::MetadataService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MetadataService::wait_operation][crate::client::MetadataService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::metadata_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MetadataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [MigrationService][crate::client::MigrationService].
#[cfg(feature = "migration-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "migration-service")))]
pub mod migration_service {
use crate::Result;
/// A builder for [MigrationService][crate::client::MigrationService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::migration_service::ClientBuilder;
/// # use client::MigrationService;
/// let builder : ClientBuilder = MigrationService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::MigrationService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = MigrationService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::MigrationService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [MigrationService::search_migratable_resources][crate::client::MigrationService::search_migratable_resources] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::SearchMigratableResources;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SearchMigratableResources {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SearchMigratableResources(
RequestBuilder<crate::model::SearchMigratableResourcesRequest>,
);
impl SearchMigratableResources {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SearchMigratableResourcesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SearchMigratableResourcesResponse> {
(*self.0.stub)
.search_migratable_resources(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::SearchMigratableResourcesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::SearchMigratableResourcesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::SearchMigratableResourcesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::SearchMigratableResourcesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::SearchMigratableResourcesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::SearchMigratableResourcesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SearchMigratableResources {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::batch_migrate_resources][crate::client::MigrationService::batch_migrate_resources] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::BatchMigrateResources;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchMigrateResources {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchMigrateResources(RequestBuilder<crate::model::BatchMigrateResourcesRequest>);
impl BatchMigrateResources {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchMigrateResourcesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_migrate_resources][crate::client::MigrationService::batch_migrate_resources].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_migrate_resources(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_migrate_resources`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchMigrateResourcesResponse,
crate::model::BatchMigrateResourcesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchMigrateResourcesResponse,
crate::model::BatchMigrateResourcesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::MigrationService::batch_migrate_resources::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::BatchMigrateResourcesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [migrate_resource_requests][crate::model::BatchMigrateResourcesRequest::migrate_resource_requests].
///
/// This is a **required** field for requests.
pub fn set_migrate_resource_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MigrateResourceRequest>,
{
use std::iter::Iterator;
self.0.request.migrate_resource_requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchMigrateResources {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::list_locations][crate::client::MigrationService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::get_location][crate::client::MigrationService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::set_iam_policy][crate::client::MigrationService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::get_iam_policy][crate::client::MigrationService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::test_iam_permissions][crate::client::MigrationService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::list_operations][crate::client::MigrationService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::get_operation][crate::client::MigrationService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::delete_operation][crate::client::MigrationService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::cancel_operation][crate::client::MigrationService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [MigrationService::wait_operation][crate::client::MigrationService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::migration_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::MigrationService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [ModelGardenService][crate::client::ModelGardenService].
#[cfg(feature = "model-garden-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "model-garden-service")))]
pub mod model_garden_service {
use crate::Result;
/// A builder for [ModelGardenService][crate::client::ModelGardenService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::model_garden_service::ClientBuilder;
/// # use client::ModelGardenService;
/// let builder : ClientBuilder = ModelGardenService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ModelGardenService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ModelGardenService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ModelGardenService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ModelGardenService::get_publisher_model][crate::client::ModelGardenService::get_publisher_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::GetPublisherModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetPublisherModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetPublisherModel(RequestBuilder<crate::model::GetPublisherModelRequest>);
impl GetPublisherModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetPublisherModelRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::PublisherModel> {
(*self.0.stub)
.get_publisher_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetPublisherModelRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [language_code][crate::model::GetPublisherModelRequest::language_code].
pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.language_code = v.into();
self
}
/// Sets the value of [view][crate::model::GetPublisherModelRequest::view].
pub fn set_view<T: Into<crate::model::PublisherModelView>>(mut self, v: T) -> Self {
self.0.request.view = v.into();
self
}
/// Sets the value of [is_hugging_face_model][crate::model::GetPublisherModelRequest::is_hugging_face_model].
pub fn set_is_hugging_face_model<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.is_hugging_face_model = v.into();
self
}
/// Sets the value of [hugging_face_token][crate::model::GetPublisherModelRequest::hugging_face_token].
pub fn set_hugging_face_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.hugging_face_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetPublisherModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::deploy][crate::client::ModelGardenService::deploy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::Deploy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> Deploy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct Deploy(RequestBuilder<crate::model::DeployRequest>);
impl Deploy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeployRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [deploy][crate::client::ModelGardenService::deploy].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.deploy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `deploy`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::DeployResponse,
crate::model::DeployOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::DeployResponse,
crate::model::DeployOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::ModelGardenService::deploy::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [destination][crate::model::DeployRequest::destination].
///
/// This is a **required** field for requests.
pub fn set_destination<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.destination = v.into();
self
}
/// Sets the value of [model_config][crate::model::DeployRequest::model_config].
pub fn set_model_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::deploy_request::ModelConfig>,
{
self.0.request.model_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_config][crate::model::DeployRequest::model_config].
pub fn set_or_clear_model_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::deploy_request::ModelConfig>,
{
self.0.request.model_config = v.map(|x| x.into());
self
}
/// Sets the value of [endpoint_config][crate::model::DeployRequest::endpoint_config].
pub fn set_endpoint_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::deploy_request::EndpointConfig>,
{
self.0.request.endpoint_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpoint_config][crate::model::DeployRequest::endpoint_config].
pub fn set_or_clear_endpoint_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::deploy_request::EndpointConfig>,
{
self.0.request.endpoint_config = v.map(|x| x.into());
self
}
/// Sets the value of [deploy_config][crate::model::DeployRequest::deploy_config].
pub fn set_deploy_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::deploy_request::DeployConfig>,
{
self.0.request.deploy_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [deploy_config][crate::model::DeployRequest::deploy_config].
pub fn set_or_clear_deploy_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::deploy_request::DeployConfig>,
{
self.0.request.deploy_config = v.map(|x| x.into());
self
}
/// Sets the value of [artifacts][crate::model::DeployRequest::artifacts].
///
/// Note that all the setters affecting `artifacts` are
/// mutually exclusive.
pub fn set_artifacts<T: Into<Option<crate::model::deploy_request::Artifacts>>>(
mut self,
v: T,
) -> Self {
self.0.request.artifacts = v.into();
self
}
/// Sets the value of [artifacts][crate::model::DeployRequest::artifacts]
/// to hold a `PublisherModelName`.
///
/// Note that all the setters affecting `artifacts` are
/// mutually exclusive.
pub fn set_publisher_model_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_publisher_model_name(v);
self
}
/// Sets the value of [artifacts][crate::model::DeployRequest::artifacts]
/// to hold a `HuggingFaceModelId`.
///
/// Note that all the setters affecting `artifacts` are
/// mutually exclusive.
pub fn set_hugging_face_model_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_hugging_face_model_id(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Deploy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::list_locations][crate::client::ModelGardenService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::get_location][crate::client::ModelGardenService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::set_iam_policy][crate::client::ModelGardenService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::get_iam_policy][crate::client::ModelGardenService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::test_iam_permissions][crate::client::ModelGardenService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::list_operations][crate::client::ModelGardenService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::get_operation][crate::client::ModelGardenService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::delete_operation][crate::client::ModelGardenService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::cancel_operation][crate::client::ModelGardenService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelGardenService::wait_operation][crate::client::ModelGardenService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_garden_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelGardenService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [ModelService][crate::client::ModelService].
#[cfg(feature = "model-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "model-service")))]
pub mod model_service {
use crate::Result;
/// A builder for [ModelService][crate::client::ModelService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::model_service::ClientBuilder;
/// # use client::ModelService;
/// let builder : ClientBuilder = ModelService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ModelService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ModelService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ModelService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ModelService::upload_model][crate::client::ModelService::upload_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::UploadModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UploadModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UploadModel(RequestBuilder<crate::model::UploadModelRequest>);
impl UploadModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UploadModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [upload_model][crate::client::ModelService::upload_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.upload_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `upload_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::UploadModelResponse,
crate::model::UploadModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::UploadModelResponse,
crate::model::UploadModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::ModelService::upload_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::UploadModelRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [parent_model][crate::model::UploadModelRequest::parent_model].
pub fn set_parent_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent_model = v.into();
self
}
/// Sets the value of [model_id][crate::model::UploadModelRequest::model_id].
pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.model_id = v.into();
self
}
/// Sets the value of [model][crate::model::UploadModelRequest::model].
///
/// This is a **required** field for requests.
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.0.request.model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model][crate::model::UploadModelRequest::model].
///
/// This is a **required** field for requests.
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.0.request.model = v.map(|x| x.into());
self
}
/// Sets the value of [service_account][crate::model::UploadModelRequest::service_account].
pub fn set_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.service_account = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UploadModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_model][crate::client::ModelService::get_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
impl GetModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Model> {
(*self.0.stub)
.get_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetModelRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_models][crate::client::ModelService::list_models] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListModels;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModels {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
impl ListModels {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
(*self.0.stub)
.list_models(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListModelsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListModelsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListModelsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListModelsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListModelsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModels {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_model_versions][crate::client::ModelService::list_model_versions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListModelVersions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModelVersions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModelVersions(RequestBuilder<crate::model::ListModelVersionsRequest>);
impl ListModelVersions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelVersionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelVersionsResponse> {
(*self.0.stub)
.list_model_versions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListModelVersionsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelVersionsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][crate::model::ListModelVersionsRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelVersionsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelVersionsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListModelVersionsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListModelVersionsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListModelVersionsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListModelVersionsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModelVersions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_model_version_checkpoints][crate::client::ModelService::list_model_version_checkpoints] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListModelVersionCheckpoints;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModelVersionCheckpoints {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModelVersionCheckpoints(
RequestBuilder<crate::model::ListModelVersionCheckpointsRequest>,
);
impl ListModelVersionCheckpoints {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelVersionCheckpointsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelVersionCheckpointsResponse> {
(*self.0.stub)
.list_model_version_checkpoints(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListModelVersionCheckpointsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelVersionCheckpointsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][crate::model::ListModelVersionCheckpointsRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelVersionCheckpointsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelVersionCheckpointsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModelVersionCheckpoints {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::update_model][crate::client::ModelService::update_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::UpdateModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateModel(RequestBuilder<crate::model::UpdateModelRequest>);
impl UpdateModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Model> {
(*self.0.stub)
.update_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [model][crate::model::UpdateModelRequest::model].
///
/// This is a **required** field for requests.
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.0.request.model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
///
/// This is a **required** field for requests.
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Model>,
{
self.0.request.model = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::update_explanation_dataset][crate::client::ModelService::update_explanation_dataset] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::UpdateExplanationDataset;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateExplanationDataset {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateExplanationDataset(
RequestBuilder<crate::model::UpdateExplanationDatasetRequest>,
);
impl UpdateExplanationDataset {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateExplanationDatasetRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_explanation_dataset][crate::client::ModelService::update_explanation_dataset].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_explanation_dataset(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_explanation_dataset`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::UpdateExplanationDatasetResponse,
crate::model::UpdateExplanationDatasetOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::UpdateExplanationDatasetResponse,
crate::model::UpdateExplanationDatasetOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ModelService::update_explanation_dataset::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [model][crate::model::UpdateExplanationDatasetRequest::model].
///
/// This is a **required** field for requests.
pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.model = v.into();
self
}
/// Sets the value of [examples][crate::model::UpdateExplanationDatasetRequest::examples].
pub fn set_examples<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Examples>,
{
self.0.request.examples = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [examples][crate::model::UpdateExplanationDatasetRequest::examples].
pub fn set_or_clear_examples<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Examples>,
{
self.0.request.examples = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateExplanationDataset {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::delete_model][crate::client::ModelService::delete_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::DeleteModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
impl DeleteModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_model][crate::client::ModelService::delete_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::ModelService::delete_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteModelRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::delete_model_version][crate::client::ModelService::delete_model_version] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::DeleteModelVersion;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteModelVersion {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteModelVersion(RequestBuilder<crate::model::DeleteModelVersionRequest>);
impl DeleteModelVersion {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteModelVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_model_version][crate::client::ModelService::delete_model_version].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_model_version(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_model_version`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ModelService::delete_model_version::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteModelVersionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteModelVersion {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::merge_version_aliases][crate::client::ModelService::merge_version_aliases] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::MergeVersionAliases;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> MergeVersionAliases {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct MergeVersionAliases(RequestBuilder<crate::model::MergeVersionAliasesRequest>);
impl MergeVersionAliases {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::MergeVersionAliasesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Model> {
(*self.0.stub)
.merge_version_aliases(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::MergeVersionAliasesRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [version_aliases][crate::model::MergeVersionAliasesRequest::version_aliases].
///
/// This is a **required** field for requests.
pub fn set_version_aliases<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.version_aliases = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for MergeVersionAliases {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::export_model][crate::client::ModelService::export_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ExportModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ExportModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ExportModel(RequestBuilder<crate::model::ExportModelRequest>);
impl ExportModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ExportModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [export_model][crate::client::ModelService::export_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.export_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `export_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ExportModelResponse,
crate::model::ExportModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ExportModelResponse,
crate::model::ExportModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::ModelService::export_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::ExportModelRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [output_config][crate::model::ExportModelRequest::output_config].
///
/// This is a **required** field for requests.
pub fn set_output_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::export_model_request::OutputConfig>,
{
self.0.request.output_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_config][crate::model::ExportModelRequest::output_config].
///
/// This is a **required** field for requests.
pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::export_model_request::OutputConfig>,
{
self.0.request.output_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ExportModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::copy_model][crate::client::ModelService::copy_model] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::CopyModel;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CopyModel {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CopyModel(RequestBuilder<crate::model::CopyModelRequest>);
impl CopyModel {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CopyModelRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [copy_model][crate::client::ModelService::copy_model].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.copy_model(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `copy_model`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::CopyModelResponse,
crate::model::CopyModelOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::CopyModelResponse,
crate::model::CopyModelOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::ModelService::copy_model::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CopyModelRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [source_model][crate::model::CopyModelRequest::source_model].
///
/// This is a **required** field for requests.
pub fn set_source_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.source_model = v.into();
self
}
/// Sets the value of [encryption_spec][crate::model::CopyModelRequest::encryption_spec].
pub fn set_encryption_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionSpec>,
{
self.0.request.encryption_spec = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [encryption_spec][crate::model::CopyModelRequest::encryption_spec].
pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EncryptionSpec>,
{
self.0.request.encryption_spec = v.map(|x| x.into());
self
}
/// Sets the value of [custom_service_account][crate::model::CopyModelRequest::custom_service_account].
pub fn set_custom_service_account<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.custom_service_account = v.into();
self
}
/// Sets the value of [destination_model][crate::model::CopyModelRequest::destination_model].
///
/// Note that all the setters affecting `destination_model` are
/// mutually exclusive.
pub fn set_destination_model<
T: Into<Option<crate::model::copy_model_request::DestinationModel>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.destination_model = v.into();
self
}
/// Sets the value of [destination_model][crate::model::CopyModelRequest::destination_model]
/// to hold a `ModelId`.
///
/// Note that all the setters affecting `destination_model` are
/// mutually exclusive.
pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request = self.0.request.set_model_id(v);
self
}
/// Sets the value of [destination_model][crate::model::CopyModelRequest::destination_model]
/// to hold a `ParentModel`.
///
/// Note that all the setters affecting `destination_model` are
/// mutually exclusive.
pub fn set_parent_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_parent_model(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CopyModel {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::import_model_evaluation][crate::client::ModelService::import_model_evaluation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ImportModelEvaluation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ImportModelEvaluation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ImportModelEvaluation(RequestBuilder<crate::model::ImportModelEvaluationRequest>);
impl ImportModelEvaluation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ImportModelEvaluationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ModelEvaluation> {
(*self.0.stub)
.import_model_evaluation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::ImportModelEvaluationRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [model_evaluation][crate::model::ImportModelEvaluationRequest::model_evaluation].
///
/// This is a **required** field for requests.
pub fn set_model_evaluation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ModelEvaluation>,
{
self.0.request.model_evaluation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_evaluation][crate::model::ImportModelEvaluationRequest::model_evaluation].
///
/// This is a **required** field for requests.
pub fn set_or_clear_model_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ModelEvaluation>,
{
self.0.request.model_evaluation = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ImportModelEvaluation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::batch_import_model_evaluation_slices][crate::client::ModelService::batch_import_model_evaluation_slices] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::BatchImportModelEvaluationSlices;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchImportModelEvaluationSlices {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchImportModelEvaluationSlices(
RequestBuilder<crate::model::BatchImportModelEvaluationSlicesRequest>,
);
impl BatchImportModelEvaluationSlices {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchImportModelEvaluationSlicesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchImportModelEvaluationSlicesResponse> {
(*self.0.stub)
.batch_import_model_evaluation_slices(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::BatchImportModelEvaluationSlicesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [model_evaluation_slices][crate::model::BatchImportModelEvaluationSlicesRequest::model_evaluation_slices].
///
/// This is a **required** field for requests.
pub fn set_model_evaluation_slices<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ModelEvaluationSlice>,
{
use std::iter::Iterator;
self.0.request.model_evaluation_slices = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchImportModelEvaluationSlices {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::batch_import_evaluated_annotations][crate::client::ModelService::batch_import_evaluated_annotations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::BatchImportEvaluatedAnnotations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchImportEvaluatedAnnotations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchImportEvaluatedAnnotations(
RequestBuilder<crate::model::BatchImportEvaluatedAnnotationsRequest>,
);
impl BatchImportEvaluatedAnnotations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchImportEvaluatedAnnotationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchImportEvaluatedAnnotationsResponse> {
(*self.0.stub)
.batch_import_evaluated_annotations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::BatchImportEvaluatedAnnotationsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [evaluated_annotations][crate::model::BatchImportEvaluatedAnnotationsRequest::evaluated_annotations].
///
/// This is a **required** field for requests.
pub fn set_evaluated_annotations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EvaluatedAnnotation>,
{
use std::iter::Iterator;
self.0.request.evaluated_annotations = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchImportEvaluatedAnnotations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_model_evaluation][crate::client::ModelService::get_model_evaluation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetModelEvaluation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetModelEvaluation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetModelEvaluation(RequestBuilder<crate::model::GetModelEvaluationRequest>);
impl GetModelEvaluation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetModelEvaluationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ModelEvaluation> {
(*self.0.stub)
.get_model_evaluation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetModelEvaluationRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetModelEvaluation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_model_evaluations][crate::client::ModelService::list_model_evaluations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListModelEvaluations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModelEvaluations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModelEvaluations(RequestBuilder<crate::model::ListModelEvaluationsRequest>);
impl ListModelEvaluations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelEvaluationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelEvaluationsResponse> {
(*self.0.stub)
.list_model_evaluations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListModelEvaluationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelEvaluationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListModelEvaluationsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListModelEvaluationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelEvaluationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelEvaluationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListModelEvaluationsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListModelEvaluationsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModelEvaluations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_model_evaluation_slice][crate::client::ModelService::get_model_evaluation_slice] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetModelEvaluationSlice;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetModelEvaluationSlice {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetModelEvaluationSlice(
RequestBuilder<crate::model::GetModelEvaluationSliceRequest>,
);
impl GetModelEvaluationSlice {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetModelEvaluationSliceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ModelEvaluationSlice> {
(*self.0.stub)
.get_model_evaluation_slice(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetModelEvaluationSliceRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetModelEvaluationSlice {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_model_evaluation_slices][crate::client::ModelService::list_model_evaluation_slices] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListModelEvaluationSlices;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListModelEvaluationSlices {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListModelEvaluationSlices(
RequestBuilder<crate::model::ListModelEvaluationSlicesRequest>,
);
impl ListModelEvaluationSlices {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListModelEvaluationSlicesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListModelEvaluationSlicesResponse> {
(*self.0.stub)
.list_model_evaluation_slices(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListModelEvaluationSlicesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListModelEvaluationSlicesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListModelEvaluationSlicesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListModelEvaluationSlicesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListModelEvaluationSlicesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListModelEvaluationSlicesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListModelEvaluationSlicesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListModelEvaluationSlicesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListModelEvaluationSlices {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_locations][crate::client::ModelService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_location][crate::client::ModelService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::set_iam_policy][crate::client::ModelService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_iam_policy][crate::client::ModelService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::test_iam_permissions][crate::client::ModelService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::list_operations][crate::client::ModelService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::get_operation][crate::client::ModelService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::delete_operation][crate::client::ModelService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::cancel_operation][crate::client::ModelService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ModelService::wait_operation][crate::client::ModelService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::model_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [NotebookService][crate::client::NotebookService].
#[cfg(feature = "notebook-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "notebook-service")))]
pub mod notebook_service {
use crate::Result;
/// A builder for [NotebookService][crate::client::NotebookService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::notebook_service::ClientBuilder;
/// # use client::NotebookService;
/// let builder : ClientBuilder = NotebookService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::NotebookService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = NotebookService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::NotebookService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [NotebookService::create_notebook_runtime_template][crate::client::NotebookService::create_notebook_runtime_template] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::CreateNotebookRuntimeTemplate;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateNotebookRuntimeTemplate {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateNotebookRuntimeTemplate(
RequestBuilder<crate::model::CreateNotebookRuntimeTemplateRequest>,
);
impl CreateNotebookRuntimeTemplate {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateNotebookRuntimeTemplateRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_notebook_runtime_template][crate::client::NotebookService::create_notebook_runtime_template].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_notebook_runtime_template(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_notebook_runtime_template`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::NotebookRuntimeTemplate,
crate::model::CreateNotebookRuntimeTemplateOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::NotebookRuntimeTemplate,
crate::model::CreateNotebookRuntimeTemplateOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::create_notebook_runtime_template::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateNotebookRuntimeTemplateRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [notebook_runtime_template][crate::model::CreateNotebookRuntimeTemplateRequest::notebook_runtime_template].
///
/// This is a **required** field for requests.
pub fn set_notebook_runtime_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntimeTemplate>,
{
self.0.request.notebook_runtime_template = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notebook_runtime_template][crate::model::CreateNotebookRuntimeTemplateRequest::notebook_runtime_template].
///
/// This is a **required** field for requests.
pub fn set_or_clear_notebook_runtime_template<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntimeTemplate>,
{
self.0.request.notebook_runtime_template = v.map(|x| x.into());
self
}
/// Sets the value of [notebook_runtime_template_id][crate::model::CreateNotebookRuntimeTemplateRequest::notebook_runtime_template_id].
pub fn set_notebook_runtime_template_id<T: Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request.notebook_runtime_template_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateNotebookRuntimeTemplate {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_notebook_runtime_template][crate::client::NotebookService::get_notebook_runtime_template] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetNotebookRuntimeTemplate;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetNotebookRuntimeTemplate {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetNotebookRuntimeTemplate(
RequestBuilder<crate::model::GetNotebookRuntimeTemplateRequest>,
);
impl GetNotebookRuntimeTemplate {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetNotebookRuntimeTemplateRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NotebookRuntimeTemplate> {
(*self.0.stub)
.get_notebook_runtime_template(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetNotebookRuntimeTemplateRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetNotebookRuntimeTemplate {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::list_notebook_runtime_templates][crate::client::NotebookService::list_notebook_runtime_templates] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::ListNotebookRuntimeTemplates;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListNotebookRuntimeTemplates {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListNotebookRuntimeTemplates(
RequestBuilder<crate::model::ListNotebookRuntimeTemplatesRequest>,
);
impl ListNotebookRuntimeTemplates {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListNotebookRuntimeTemplatesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListNotebookRuntimeTemplatesResponse> {
(*self.0.stub)
.list_notebook_runtime_templates(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListNotebookRuntimeTemplatesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListNotebookRuntimeTemplatesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListNotebookRuntimeTemplatesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListNotebookRuntimeTemplatesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListNotebookRuntimeTemplatesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListNotebookRuntimeTemplatesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListNotebookRuntimeTemplatesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListNotebookRuntimeTemplatesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListNotebookRuntimeTemplatesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListNotebookRuntimeTemplates {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::delete_notebook_runtime_template][crate::client::NotebookService::delete_notebook_runtime_template] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::DeleteNotebookRuntimeTemplate;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteNotebookRuntimeTemplate {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteNotebookRuntimeTemplate(
RequestBuilder<crate::model::DeleteNotebookRuntimeTemplateRequest>,
);
impl DeleteNotebookRuntimeTemplate {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteNotebookRuntimeTemplateRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_notebook_runtime_template][crate::client::NotebookService::delete_notebook_runtime_template].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_notebook_runtime_template(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_notebook_runtime_template`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::delete_notebook_runtime_template::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteNotebookRuntimeTemplateRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteNotebookRuntimeTemplate {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::update_notebook_runtime_template][crate::client::NotebookService::update_notebook_runtime_template] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::UpdateNotebookRuntimeTemplate;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateNotebookRuntimeTemplate {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateNotebookRuntimeTemplate(
RequestBuilder<crate::model::UpdateNotebookRuntimeTemplateRequest>,
);
impl UpdateNotebookRuntimeTemplate {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateNotebookRuntimeTemplateRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NotebookRuntimeTemplate> {
(*self.0.stub)
.update_notebook_runtime_template(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [notebook_runtime_template][crate::model::UpdateNotebookRuntimeTemplateRequest::notebook_runtime_template].
///
/// This is a **required** field for requests.
pub fn set_notebook_runtime_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntimeTemplate>,
{
self.0.request.notebook_runtime_template = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notebook_runtime_template][crate::model::UpdateNotebookRuntimeTemplateRequest::notebook_runtime_template].
///
/// This is a **required** field for requests.
pub fn set_or_clear_notebook_runtime_template<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntimeTemplate>,
{
self.0.request.notebook_runtime_template = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateNotebookRuntimeTemplateRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateNotebookRuntimeTemplateRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateNotebookRuntimeTemplate {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::assign_notebook_runtime][crate::client::NotebookService::assign_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::AssignNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AssignNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AssignNotebookRuntime(RequestBuilder<crate::model::AssignNotebookRuntimeRequest>);
impl AssignNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AssignNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [assign_notebook_runtime][crate::client::NotebookService::assign_notebook_runtime].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.assign_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `assign_notebook_runtime`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::NotebookRuntime,
crate::model::AssignNotebookRuntimeOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::NotebookRuntime,
crate::model::AssignNotebookRuntimeOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::assign_notebook_runtime::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::AssignNotebookRuntimeRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [notebook_runtime_template][crate::model::AssignNotebookRuntimeRequest::notebook_runtime_template].
///
/// This is a **required** field for requests.
pub fn set_notebook_runtime_template<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.notebook_runtime_template = v.into();
self
}
/// Sets the value of [notebook_runtime][crate::model::AssignNotebookRuntimeRequest::notebook_runtime].
///
/// This is a **required** field for requests.
pub fn set_notebook_runtime<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntime>,
{
self.0.request.notebook_runtime = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notebook_runtime][crate::model::AssignNotebookRuntimeRequest::notebook_runtime].
///
/// This is a **required** field for requests.
pub fn set_or_clear_notebook_runtime<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NotebookRuntime>,
{
self.0.request.notebook_runtime = v.map(|x| x.into());
self
}
/// Sets the value of [notebook_runtime_id][crate::model::AssignNotebookRuntimeRequest::notebook_runtime_id].
pub fn set_notebook_runtime_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.notebook_runtime_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AssignNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_notebook_runtime][crate::client::NotebookService::get_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetNotebookRuntime(RequestBuilder<crate::model::GetNotebookRuntimeRequest>);
impl GetNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NotebookRuntime> {
(*self.0.stub)
.get_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetNotebookRuntimeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::list_notebook_runtimes][crate::client::NotebookService::list_notebook_runtimes] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::ListNotebookRuntimes;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListNotebookRuntimes {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListNotebookRuntimes(RequestBuilder<crate::model::ListNotebookRuntimesRequest>);
impl ListNotebookRuntimes {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListNotebookRuntimesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListNotebookRuntimesResponse> {
(*self.0.stub)
.list_notebook_runtimes(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListNotebookRuntimesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListNotebookRuntimesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListNotebookRuntimesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListNotebookRuntimesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListNotebookRuntimesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListNotebookRuntimesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListNotebookRuntimesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListNotebookRuntimesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
/// Sets the value of [order_by][crate::model::ListNotebookRuntimesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListNotebookRuntimes {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::delete_notebook_runtime][crate::client::NotebookService::delete_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::DeleteNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteNotebookRuntime(RequestBuilder<crate::model::DeleteNotebookRuntimeRequest>);
impl DeleteNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_notebook_runtime][crate::client::NotebookService::delete_notebook_runtime].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_notebook_runtime`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::delete_notebook_runtime::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteNotebookRuntimeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::upgrade_notebook_runtime][crate::client::NotebookService::upgrade_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::UpgradeNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpgradeNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpgradeNotebookRuntime(RequestBuilder<crate::model::UpgradeNotebookRuntimeRequest>);
impl UpgradeNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpgradeNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [upgrade_notebook_runtime][crate::client::NotebookService::upgrade_notebook_runtime].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.upgrade_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `upgrade_notebook_runtime`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::UpgradeNotebookRuntimeResponse,
crate::model::UpgradeNotebookRuntimeOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::UpgradeNotebookRuntimeResponse,
crate::model::UpgradeNotebookRuntimeOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::upgrade_notebook_runtime::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::UpgradeNotebookRuntimeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpgradeNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::start_notebook_runtime][crate::client::NotebookService::start_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::StartNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> StartNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct StartNotebookRuntime(RequestBuilder<crate::model::StartNotebookRuntimeRequest>);
impl StartNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::StartNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [start_notebook_runtime][crate::client::NotebookService::start_notebook_runtime].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.start_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `start_notebook_runtime`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::StartNotebookRuntimeResponse,
crate::model::StartNotebookRuntimeOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::StartNotebookRuntimeResponse,
crate::model::StartNotebookRuntimeOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::start_notebook_runtime::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::StartNotebookRuntimeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for StartNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::stop_notebook_runtime][crate::client::NotebookService::stop_notebook_runtime] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::StopNotebookRuntime;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> StopNotebookRuntime {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct StopNotebookRuntime(RequestBuilder<crate::model::StopNotebookRuntimeRequest>);
impl StopNotebookRuntime {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::StopNotebookRuntimeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [stop_notebook_runtime][crate::client::NotebookService::stop_notebook_runtime].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.stop_notebook_runtime(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `stop_notebook_runtime`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::StopNotebookRuntimeResponse,
crate::model::StopNotebookRuntimeOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::StopNotebookRuntimeResponse,
crate::model::StopNotebookRuntimeOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::stop_notebook_runtime::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::StopNotebookRuntimeRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for StopNotebookRuntime {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::create_notebook_execution_job][crate::client::NotebookService::create_notebook_execution_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::CreateNotebookExecutionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateNotebookExecutionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateNotebookExecutionJob(
RequestBuilder<crate::model::CreateNotebookExecutionJobRequest>,
);
impl CreateNotebookExecutionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateNotebookExecutionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_notebook_execution_job][crate::client::NotebookService::create_notebook_execution_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_notebook_execution_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_notebook_execution_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::NotebookExecutionJob,
crate::model::CreateNotebookExecutionJobOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::NotebookExecutionJob,
crate::model::CreateNotebookExecutionJobOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::create_notebook_execution_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateNotebookExecutionJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [notebook_execution_job][crate::model::CreateNotebookExecutionJobRequest::notebook_execution_job].
///
/// This is a **required** field for requests.
pub fn set_notebook_execution_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotebookExecutionJob>,
{
self.0.request.notebook_execution_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notebook_execution_job][crate::model::CreateNotebookExecutionJobRequest::notebook_execution_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_notebook_execution_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NotebookExecutionJob>,
{
self.0.request.notebook_execution_job = v.map(|x| x.into());
self
}
/// Sets the value of [notebook_execution_job_id][crate::model::CreateNotebookExecutionJobRequest::notebook_execution_job_id].
pub fn set_notebook_execution_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.notebook_execution_job_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateNotebookExecutionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_notebook_execution_job][crate::client::NotebookService::get_notebook_execution_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetNotebookExecutionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetNotebookExecutionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetNotebookExecutionJob(
RequestBuilder<crate::model::GetNotebookExecutionJobRequest>,
);
impl GetNotebookExecutionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetNotebookExecutionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::NotebookExecutionJob> {
(*self.0.stub)
.get_notebook_execution_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetNotebookExecutionJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [view][crate::model::GetNotebookExecutionJobRequest::view].
pub fn set_view<T: Into<crate::model::NotebookExecutionJobView>>(mut self, v: T) -> Self {
self.0.request.view = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetNotebookExecutionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::list_notebook_execution_jobs][crate::client::NotebookService::list_notebook_execution_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::ListNotebookExecutionJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListNotebookExecutionJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListNotebookExecutionJobs(
RequestBuilder<crate::model::ListNotebookExecutionJobsRequest>,
);
impl ListNotebookExecutionJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListNotebookExecutionJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListNotebookExecutionJobsResponse> {
(*self.0.stub)
.list_notebook_execution_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListNotebookExecutionJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListNotebookExecutionJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListNotebookExecutionJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListNotebookExecutionJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListNotebookExecutionJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListNotebookExecutionJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListNotebookExecutionJobsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [view][crate::model::ListNotebookExecutionJobsRequest::view].
pub fn set_view<T: Into<crate::model::NotebookExecutionJobView>>(mut self, v: T) -> Self {
self.0.request.view = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListNotebookExecutionJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::delete_notebook_execution_job][crate::client::NotebookService::delete_notebook_execution_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::DeleteNotebookExecutionJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteNotebookExecutionJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteNotebookExecutionJob(
RequestBuilder<crate::model::DeleteNotebookExecutionJobRequest>,
);
impl DeleteNotebookExecutionJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteNotebookExecutionJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_notebook_execution_job][crate::client::NotebookService::delete_notebook_execution_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_notebook_execution_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_notebook_execution_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::NotebookService::delete_notebook_execution_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteNotebookExecutionJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteNotebookExecutionJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::list_locations][crate::client::NotebookService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_location][crate::client::NotebookService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::set_iam_policy][crate::client::NotebookService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_iam_policy][crate::client::NotebookService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::test_iam_permissions][crate::client::NotebookService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::list_operations][crate::client::NotebookService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::get_operation][crate::client::NotebookService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::delete_operation][crate::client::NotebookService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::cancel_operation][crate::client::NotebookService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [NotebookService::wait_operation][crate::client::NotebookService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::notebook_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::NotebookService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [PersistentResourceService][crate::client::PersistentResourceService].
#[cfg(feature = "persistent-resource-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "persistent-resource-service")))]
pub mod persistent_resource_service {
use crate::Result;
/// A builder for [PersistentResourceService][crate::client::PersistentResourceService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::persistent_resource_service::ClientBuilder;
/// # use client::PersistentResourceService;
/// let builder : ClientBuilder = PersistentResourceService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::PersistentResourceService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = PersistentResourceService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::PersistentResourceService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [PersistentResourceService::create_persistent_resource][crate::client::PersistentResourceService::create_persistent_resource] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::CreatePersistentResource;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreatePersistentResource {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreatePersistentResource(
RequestBuilder<crate::model::CreatePersistentResourceRequest>,
);
impl CreatePersistentResource {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreatePersistentResourceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_persistent_resource][crate::client::PersistentResourceService::create_persistent_resource].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_persistent_resource(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_persistent_resource`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PersistentResource,
crate::model::CreatePersistentResourceOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PersistentResource,
crate::model::CreatePersistentResourceOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PersistentResourceService::create_persistent_resource::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreatePersistentResourceRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [persistent_resource][crate::model::CreatePersistentResourceRequest::persistent_resource].
///
/// This is a **required** field for requests.
pub fn set_persistent_resource<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PersistentResource>,
{
self.0.request.persistent_resource = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [persistent_resource][crate::model::CreatePersistentResourceRequest::persistent_resource].
///
/// This is a **required** field for requests.
pub fn set_or_clear_persistent_resource<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PersistentResource>,
{
self.0.request.persistent_resource = v.map(|x| x.into());
self
}
/// Sets the value of [persistent_resource_id][crate::model::CreatePersistentResourceRequest::persistent_resource_id].
///
/// This is a **required** field for requests.
pub fn set_persistent_resource_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.persistent_resource_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreatePersistentResource {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::get_persistent_resource][crate::client::PersistentResourceService::get_persistent_resource] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::GetPersistentResource;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetPersistentResource {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetPersistentResource(RequestBuilder<crate::model::GetPersistentResourceRequest>);
impl GetPersistentResource {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetPersistentResourceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::PersistentResource> {
(*self.0.stub)
.get_persistent_resource(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetPersistentResourceRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetPersistentResource {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::list_persistent_resources][crate::client::PersistentResourceService::list_persistent_resources] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::ListPersistentResources;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListPersistentResources {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListPersistentResources(
RequestBuilder<crate::model::ListPersistentResourcesRequest>,
);
impl ListPersistentResources {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListPersistentResourcesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListPersistentResourcesResponse> {
(*self.0.stub)
.list_persistent_resources(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListPersistentResourcesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListPersistentResourcesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListPersistentResourcesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListPersistentResourcesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListPersistentResourcesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListPersistentResources {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::delete_persistent_resource][crate::client::PersistentResourceService::delete_persistent_resource] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::DeletePersistentResource;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeletePersistentResource {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeletePersistentResource(
RequestBuilder<crate::model::DeletePersistentResourceRequest>,
);
impl DeletePersistentResource {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeletePersistentResourceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_persistent_resource][crate::client::PersistentResourceService::delete_persistent_resource].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_persistent_resource(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_persistent_resource`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PersistentResourceService::delete_persistent_resource::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeletePersistentResourceRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeletePersistentResource {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::update_persistent_resource][crate::client::PersistentResourceService::update_persistent_resource] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::UpdatePersistentResource;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdatePersistentResource {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdatePersistentResource(
RequestBuilder<crate::model::UpdatePersistentResourceRequest>,
);
impl UpdatePersistentResource {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdatePersistentResourceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_persistent_resource][crate::client::PersistentResourceService::update_persistent_resource].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_persistent_resource(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_persistent_resource`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PersistentResource,
crate::model::UpdatePersistentResourceOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PersistentResource,
crate::model::UpdatePersistentResourceOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PersistentResourceService::update_persistent_resource::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [persistent_resource][crate::model::UpdatePersistentResourceRequest::persistent_resource].
///
/// This is a **required** field for requests.
pub fn set_persistent_resource<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PersistentResource>,
{
self.0.request.persistent_resource = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [persistent_resource][crate::model::UpdatePersistentResourceRequest::persistent_resource].
///
/// This is a **required** field for requests.
pub fn set_or_clear_persistent_resource<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PersistentResource>,
{
self.0.request.persistent_resource = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdatePersistentResourceRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdatePersistentResourceRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdatePersistentResource {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::reboot_persistent_resource][crate::client::PersistentResourceService::reboot_persistent_resource] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::RebootPersistentResource;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RebootPersistentResource {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RebootPersistentResource(
RequestBuilder<crate::model::RebootPersistentResourceRequest>,
);
impl RebootPersistentResource {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RebootPersistentResourceRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [reboot_persistent_resource][crate::client::PersistentResourceService::reboot_persistent_resource].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.reboot_persistent_resource(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `reboot_persistent_resource`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::PersistentResource,
crate::model::RebootPersistentResourceOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::PersistentResource,
crate::model::RebootPersistentResourceOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PersistentResourceService::reboot_persistent_resource::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::RebootPersistentResourceRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RebootPersistentResource {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::list_locations][crate::client::PersistentResourceService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::get_location][crate::client::PersistentResourceService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::set_iam_policy][crate::client::PersistentResourceService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::get_iam_policy][crate::client::PersistentResourceService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::test_iam_permissions][crate::client::PersistentResourceService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::list_operations][crate::client::PersistentResourceService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::get_operation][crate::client::PersistentResourceService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::delete_operation][crate::client::PersistentResourceService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::cancel_operation][crate::client::PersistentResourceService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PersistentResourceService::wait_operation][crate::client::PersistentResourceService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::persistent_resource_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PersistentResourceService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [PipelineService][crate::client::PipelineService].
#[cfg(feature = "pipeline-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "pipeline-service")))]
pub mod pipeline_service {
use crate::Result;
/// A builder for [PipelineService][crate::client::PipelineService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::pipeline_service::ClientBuilder;
/// # use client::PipelineService;
/// let builder : ClientBuilder = PipelineService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::PipelineService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = PipelineService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::PipelineService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [PipelineService::create_training_pipeline][crate::client::PipelineService::create_training_pipeline] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::CreateTrainingPipeline;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTrainingPipeline {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTrainingPipeline(RequestBuilder<crate::model::CreateTrainingPipelineRequest>);
impl CreateTrainingPipeline {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTrainingPipelineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TrainingPipeline> {
(*self.0.stub)
.create_training_pipeline(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTrainingPipelineRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [training_pipeline][crate::model::CreateTrainingPipelineRequest::training_pipeline].
///
/// This is a **required** field for requests.
pub fn set_training_pipeline<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TrainingPipeline>,
{
self.0.request.training_pipeline = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [training_pipeline][crate::model::CreateTrainingPipelineRequest::training_pipeline].
///
/// This is a **required** field for requests.
pub fn set_or_clear_training_pipeline<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TrainingPipeline>,
{
self.0.request.training_pipeline = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTrainingPipeline {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::get_training_pipeline][crate::client::PipelineService::get_training_pipeline] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::GetTrainingPipeline;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTrainingPipeline {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTrainingPipeline(RequestBuilder<crate::model::GetTrainingPipelineRequest>);
impl GetTrainingPipeline {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTrainingPipelineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TrainingPipeline> {
(*self.0.stub)
.get_training_pipeline(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTrainingPipelineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTrainingPipeline {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::list_training_pipelines][crate::client::PipelineService::list_training_pipelines] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::ListTrainingPipelines;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTrainingPipelines {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTrainingPipelines(RequestBuilder<crate::model::ListTrainingPipelinesRequest>);
impl ListTrainingPipelines {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTrainingPipelinesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTrainingPipelinesResponse> {
(*self.0.stub)
.list_training_pipelines(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTrainingPipelinesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTrainingPipelinesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTrainingPipelinesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTrainingPipelinesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTrainingPipelinesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTrainingPipelinesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListTrainingPipelinesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListTrainingPipelinesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTrainingPipelines {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::delete_training_pipeline][crate::client::PipelineService::delete_training_pipeline] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::DeleteTrainingPipeline;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTrainingPipeline {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTrainingPipeline(RequestBuilder<crate::model::DeleteTrainingPipelineRequest>);
impl DeleteTrainingPipeline {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTrainingPipelineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_training_pipeline][crate::client::PipelineService::delete_training_pipeline].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_training_pipeline(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_training_pipeline`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PipelineService::delete_training_pipeline::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteTrainingPipelineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTrainingPipeline {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::cancel_training_pipeline][crate::client::PipelineService::cancel_training_pipeline] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::CancelTrainingPipeline;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelTrainingPipeline {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelTrainingPipeline(RequestBuilder<crate::model::CancelTrainingPipelineRequest>);
impl CancelTrainingPipeline {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelTrainingPipelineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_training_pipeline(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelTrainingPipelineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelTrainingPipeline {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::create_pipeline_job][crate::client::PipelineService::create_pipeline_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::CreatePipelineJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreatePipelineJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreatePipelineJob(RequestBuilder<crate::model::CreatePipelineJobRequest>);
impl CreatePipelineJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreatePipelineJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::PipelineJob> {
(*self.0.stub)
.create_pipeline_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreatePipelineJobRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [pipeline_job][crate::model::CreatePipelineJobRequest::pipeline_job].
///
/// This is a **required** field for requests.
pub fn set_pipeline_job<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PipelineJob>,
{
self.0.request.pipeline_job = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pipeline_job][crate::model::CreatePipelineJobRequest::pipeline_job].
///
/// This is a **required** field for requests.
pub fn set_or_clear_pipeline_job<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PipelineJob>,
{
self.0.request.pipeline_job = v.map(|x| x.into());
self
}
/// Sets the value of [pipeline_job_id][crate::model::CreatePipelineJobRequest::pipeline_job_id].
pub fn set_pipeline_job_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.pipeline_job_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreatePipelineJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::get_pipeline_job][crate::client::PipelineService::get_pipeline_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::GetPipelineJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetPipelineJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetPipelineJob(RequestBuilder<crate::model::GetPipelineJobRequest>);
impl GetPipelineJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetPipelineJobRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::PipelineJob> {
(*self.0.stub)
.get_pipeline_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetPipelineJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetPipelineJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::list_pipeline_jobs][crate::client::PipelineService::list_pipeline_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::ListPipelineJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListPipelineJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListPipelineJobs(RequestBuilder<crate::model::ListPipelineJobsRequest>);
impl ListPipelineJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListPipelineJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListPipelineJobsResponse> {
(*self.0.stub)
.list_pipeline_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListPipelineJobsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListPipelineJobsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListPipelineJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListPipelineJobsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListPipelineJobsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListPipelineJobsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListPipelineJobsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListPipelineJobsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListPipelineJobsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListPipelineJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::delete_pipeline_job][crate::client::PipelineService::delete_pipeline_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::DeletePipelineJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeletePipelineJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeletePipelineJob(RequestBuilder<crate::model::DeletePipelineJobRequest>);
impl DeletePipelineJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeletePipelineJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_pipeline_job][crate::client::PipelineService::delete_pipeline_job].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_pipeline_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_pipeline_job`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PipelineService::delete_pipeline_job::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeletePipelineJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeletePipelineJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::batch_delete_pipeline_jobs][crate::client::PipelineService::batch_delete_pipeline_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::BatchDeletePipelineJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchDeletePipelineJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchDeletePipelineJobs(
RequestBuilder<crate::model::BatchDeletePipelineJobsRequest>,
);
impl BatchDeletePipelineJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchDeletePipelineJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_delete_pipeline_jobs][crate::client::PipelineService::batch_delete_pipeline_jobs].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_delete_pipeline_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_delete_pipeline_jobs`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchDeletePipelineJobsResponse,
crate::model::DeleteOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchDeletePipelineJobsResponse,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PipelineService::batch_delete_pipeline_jobs::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::BatchDeletePipelineJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [names][crate::model::BatchDeletePipelineJobsRequest::names].
///
/// This is a **required** field for requests.
pub fn set_names<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.names = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchDeletePipelineJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::cancel_pipeline_job][crate::client::PipelineService::cancel_pipeline_job] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::CancelPipelineJob;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelPipelineJob {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelPipelineJob(RequestBuilder<crate::model::CancelPipelineJobRequest>);
impl CancelPipelineJob {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelPipelineJobRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_pipeline_job(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelPipelineJobRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelPipelineJob {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::batch_cancel_pipeline_jobs][crate::client::PipelineService::batch_cancel_pipeline_jobs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::BatchCancelPipelineJobs;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchCancelPipelineJobs {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchCancelPipelineJobs(
RequestBuilder<crate::model::BatchCancelPipelineJobsRequest>,
);
impl BatchCancelPipelineJobs {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchCancelPipelineJobsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [batch_cancel_pipeline_jobs][crate::client::PipelineService::batch_cancel_pipeline_jobs].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.batch_cancel_pipeline_jobs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_cancel_pipeline_jobs`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::BatchCancelPipelineJobsResponse,
crate::model::BatchCancelPipelineJobsOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::BatchCancelPipelineJobsResponse,
crate::model::BatchCancelPipelineJobsOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::PipelineService::batch_cancel_pipeline_jobs::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::BatchCancelPipelineJobsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [names][crate::model::BatchCancelPipelineJobsRequest::names].
///
/// This is a **required** field for requests.
pub fn set_names<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.names = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchCancelPipelineJobs {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::list_locations][crate::client::PipelineService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::get_location][crate::client::PipelineService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::set_iam_policy][crate::client::PipelineService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::get_iam_policy][crate::client::PipelineService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::test_iam_permissions][crate::client::PipelineService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::list_operations][crate::client::PipelineService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::get_operation][crate::client::PipelineService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::delete_operation][crate::client::PipelineService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::cancel_operation][crate::client::PipelineService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PipelineService::wait_operation][crate::client::PipelineService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::pipeline_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PipelineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [PredictionService][crate::client::PredictionService].
#[cfg(feature = "prediction-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "prediction-service")))]
pub mod prediction_service {
use crate::Result;
/// A builder for [PredictionService][crate::client::PredictionService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::prediction_service::ClientBuilder;
/// # use client::PredictionService;
/// let builder : ClientBuilder = PredictionService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::PredictionService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = PredictionService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::PredictionService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [PredictionService::predict][crate::client::PredictionService::predict] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::Predict;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> Predict {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct Predict(RequestBuilder<crate::model::PredictRequest>);
impl Predict {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PredictRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::PredictResponse> {
(*self.0.stub)
.predict(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::PredictRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [instances][crate::model::PredictRequest::instances].
///
/// This is a **required** field for requests.
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.0.request.instances = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parameters][crate::model::PredictRequest::parameters].
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.0.request.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::PredictRequest::parameters].
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.0.request.parameters = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::PredictRequest::labels].
pub fn set_labels<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>,
{
self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Predict {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::raw_predict][crate::client::PredictionService::raw_predict] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::RawPredict;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RawPredict {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RawPredict(RequestBuilder<crate::model::RawPredictRequest>);
impl RawPredict {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RawPredictRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
(*self.0.stub)
.raw_predict(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::RawPredictRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [http_body][crate::model::RawPredictRequest::http_body].
pub fn set_http_body<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_api::model::HttpBody>,
{
self.0.request.http_body = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [http_body][crate::model::RawPredictRequest::http_body].
pub fn set_or_clear_http_body<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_api::model::HttpBody>,
{
self.0.request.http_body = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RawPredict {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::direct_predict][crate::client::PredictionService::direct_predict] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::DirectPredict;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DirectPredict {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DirectPredict(RequestBuilder<crate::model::DirectPredictRequest>);
impl DirectPredict {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DirectPredictRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DirectPredictResponse> {
(*self.0.stub)
.direct_predict(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::DirectPredictRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [inputs][crate::model::DirectPredictRequest::inputs].
pub fn set_inputs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tensor>,
{
use std::iter::Iterator;
self.0.request.inputs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parameters][crate::model::DirectPredictRequest::parameters].
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Tensor>,
{
self.0.request.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::DirectPredictRequest::parameters].
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Tensor>,
{
self.0.request.parameters = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DirectPredict {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::direct_raw_predict][crate::client::PredictionService::direct_raw_predict] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::DirectRawPredict;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DirectRawPredict {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DirectRawPredict(RequestBuilder<crate::model::DirectRawPredictRequest>);
impl DirectRawPredict {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DirectRawPredictRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::DirectRawPredictResponse> {
(*self.0.stub)
.direct_raw_predict(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::DirectRawPredictRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [method_name][crate::model::DirectRawPredictRequest::method_name].
pub fn set_method_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.method_name = v.into();
self
}
/// Sets the value of [input][crate::model::DirectRawPredictRequest::input].
pub fn set_input<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.0.request.input = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DirectRawPredict {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::explain][crate::client::PredictionService::explain] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::Explain;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> Explain {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct Explain(RequestBuilder<crate::model::ExplainRequest>);
impl Explain {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ExplainRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ExplainResponse> {
(*self.0.stub)
.explain(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [endpoint][crate::model::ExplainRequest::endpoint].
///
/// This is a **required** field for requests.
pub fn set_endpoint<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.endpoint = v.into();
self
}
/// Sets the value of [instances][crate::model::ExplainRequest::instances].
///
/// This is a **required** field for requests.
pub fn set_instances<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Value>,
{
use std::iter::Iterator;
self.0.request.instances = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parameters][crate::model::ExplainRequest::parameters].
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.0.request.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::ExplainRequest::parameters].
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.0.request.parameters = v.map(|x| x.into());
self
}
/// Sets the value of [explanation_spec_override][crate::model::ExplainRequest::explanation_spec_override].
pub fn set_explanation_spec_override<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ExplanationSpecOverride>,
{
self.0.request.explanation_spec_override = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [explanation_spec_override][crate::model::ExplainRequest::explanation_spec_override].
pub fn set_or_clear_explanation_spec_override<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ExplanationSpecOverride>,
{
self.0.request.explanation_spec_override = v.map(|x| x.into());
self
}
/// Sets the value of [deployed_model_id][crate::model::ExplainRequest::deployed_model_id].
pub fn set_deployed_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.deployed_model_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for Explain {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::generate_content][crate::client::PredictionService::generate_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::GenerateContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GenerateContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GenerateContent(RequestBuilder<crate::model::GenerateContentRequest>);
impl GenerateContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GenerateContentRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::GenerateContentResponse> {
(*self.0.stub)
.generate_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [model][crate::model::GenerateContentRequest::model].
///
/// This is a **required** field for requests.
pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.model = v.into();
self
}
/// Sets the value of [contents][crate::model::GenerateContentRequest::contents].
///
/// This is a **required** field for requests.
pub fn set_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Content>,
{
use std::iter::Iterator;
self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [system_instruction][crate::model::GenerateContentRequest::system_instruction].
pub fn set_system_instruction<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.system_instruction = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [system_instruction][crate::model::GenerateContentRequest::system_instruction].
pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.system_instruction = v.map(|x| x.into());
self
}
/// Sets the value of [cached_content][crate::model::GenerateContentRequest::cached_content].
pub fn set_cached_content<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.cached_content = v.into();
self
}
/// Sets the value of [tools][crate::model::GenerateContentRequest::tools].
pub fn set_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tool>,
{
use std::iter::Iterator;
self.0.request.tools = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [tool_config][crate::model::GenerateContentRequest::tool_config].
pub fn set_tool_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ToolConfig>,
{
self.0.request.tool_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tool_config][crate::model::GenerateContentRequest::tool_config].
pub fn set_or_clear_tool_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ToolConfig>,
{
self.0.request.tool_config = v.map(|x| x.into());
self
}
/// Sets the value of [labels][crate::model::GenerateContentRequest::labels].
pub fn set_labels<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>,
{
self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [safety_settings][crate::model::GenerateContentRequest::safety_settings].
pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SafetySetting>,
{
use std::iter::Iterator;
self.0.request.safety_settings = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model_armor_config][crate::model::GenerateContentRequest::model_armor_config].
pub fn set_model_armor_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ModelArmorConfig>,
{
self.0.request.model_armor_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model_armor_config][crate::model::GenerateContentRequest::model_armor_config].
pub fn set_or_clear_model_armor_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ModelArmorConfig>,
{
self.0.request.model_armor_config = v.map(|x| x.into());
self
}
/// Sets the value of [generation_config][crate::model::GenerateContentRequest::generation_config].
pub fn set_generation_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GenerationConfig>,
{
self.0.request.generation_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generation_config][crate::model::GenerateContentRequest::generation_config].
pub fn set_or_clear_generation_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GenerationConfig>,
{
self.0.request.generation_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GenerateContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::embed_content][crate::client::PredictionService::embed_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::EmbedContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> EmbedContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct EmbedContent(RequestBuilder<crate::model::EmbedContentRequest>);
impl EmbedContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::EmbedContentRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::EmbedContentResponse> {
(*self.0.stub)
.embed_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [model][crate::model::EmbedContentRequest::model].
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.0.request.model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model][crate::model::EmbedContentRequest::model].
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.0.request.model = v.map(|x| x.into());
self
}
/// Sets the value of [content][crate::model::EmbedContentRequest::content].
pub fn set_content<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.content = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [content][crate::model::EmbedContentRequest::content].
pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.content = v.map(|x| x.into());
self
}
/// Sets the value of [title][crate::model::EmbedContentRequest::title].
#[deprecated]
pub fn set_title<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.0.request.title = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [title][crate::model::EmbedContentRequest::title].
#[deprecated]
pub fn set_or_clear_title<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.0.request.title = v.map(|x| x.into());
self
}
/// Sets the value of [task_type][crate::model::EmbedContentRequest::task_type].
#[deprecated]
pub fn set_task_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::embed_content_request::EmbeddingTaskType>,
{
self.0.request.task_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [task_type][crate::model::EmbedContentRequest::task_type].
#[deprecated]
pub fn set_or_clear_task_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::embed_content_request::EmbeddingTaskType>,
{
self.0.request.task_type = v.map(|x| x.into());
self
}
/// Sets the value of [output_dimensionality][crate::model::EmbedContentRequest::output_dimensionality].
#[deprecated]
pub fn set_output_dimensionality<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i32>,
{
self.0.request.output_dimensionality = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_dimensionality][crate::model::EmbedContentRequest::output_dimensionality].
#[deprecated]
pub fn set_or_clear_output_dimensionality<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i32>,
{
self.0.request.output_dimensionality = v.map(|x| x.into());
self
}
/// Sets the value of [auto_truncate][crate::model::EmbedContentRequest::auto_truncate].
#[deprecated]
pub fn set_auto_truncate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.0.request.auto_truncate = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [auto_truncate][crate::model::EmbedContentRequest::auto_truncate].
#[deprecated]
pub fn set_or_clear_auto_truncate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.0.request.auto_truncate = v.map(|x| x.into());
self
}
/// Sets the value of [embed_content_config][crate::model::EmbedContentRequest::embed_content_config].
pub fn set_embed_content_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::embed_content_request::EmbedContentConfig>,
{
self.0.request.embed_content_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [embed_content_config][crate::model::EmbedContentRequest::embed_content_config].
pub fn set_or_clear_embed_content_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::embed_content_request::EmbedContentConfig>,
{
self.0.request.embed_content_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for EmbedContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::list_locations][crate::client::PredictionService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::get_location][crate::client::PredictionService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::set_iam_policy][crate::client::PredictionService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::get_iam_policy][crate::client::PredictionService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::test_iam_permissions][crate::client::PredictionService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::list_operations][crate::client::PredictionService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::get_operation][crate::client::PredictionService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::delete_operation][crate::client::PredictionService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::cancel_operation][crate::client::PredictionService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [PredictionService::wait_operation][crate::client::PredictionService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::prediction_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [ReasoningEngineExecutionService][crate::client::ReasoningEngineExecutionService].
#[cfg(feature = "reasoning-engine-execution-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-execution-service")))]
pub mod reasoning_engine_execution_service {
use crate::Result;
/// A builder for [ReasoningEngineExecutionService][crate::client::ReasoningEngineExecutionService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::reasoning_engine_execution_service::ClientBuilder;
/// # use client::ReasoningEngineExecutionService;
/// let builder : ClientBuilder = ReasoningEngineExecutionService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ReasoningEngineExecutionService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ReasoningEngineExecutionService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ReasoningEngineExecutionService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ReasoningEngineExecutionService::query_reasoning_engine][crate::client::ReasoningEngineExecutionService::query_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::QueryReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> QueryReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct QueryReasoningEngine(RequestBuilder<crate::model::QueryReasoningEngineRequest>);
impl QueryReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::QueryReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::QueryReasoningEngineResponse> {
(*self.0.stub)
.query_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::QueryReasoningEngineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [input][crate::model::QueryReasoningEngineRequest::input].
pub fn set_input<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.0.request.input = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input][crate::model::QueryReasoningEngineRequest::input].
pub fn set_or_clear_input<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.0.request.input = v.map(|x| x.into());
self
}
/// Sets the value of [class_method][crate::model::QueryReasoningEngineRequest::class_method].
pub fn set_class_method<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.class_method = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for QueryReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::async_query_reasoning_engine][crate::client::ReasoningEngineExecutionService::async_query_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::AsyncQueryReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AsyncQueryReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AsyncQueryReasoningEngine(
RequestBuilder<crate::model::AsyncQueryReasoningEngineRequest>,
);
impl AsyncQueryReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AsyncQueryReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [async_query_reasoning_engine][crate::client::ReasoningEngineExecutionService::async_query_reasoning_engine].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.async_query_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `async_query_reasoning_engine`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::AsyncQueryReasoningEngineResponse,
crate::model::AsyncQueryReasoningEngineOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::AsyncQueryReasoningEngineResponse,
crate::model::AsyncQueryReasoningEngineOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ReasoningEngineExecutionService::async_query_reasoning_engine::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::AsyncQueryReasoningEngineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [input_gcs_uri][crate::model::AsyncQueryReasoningEngineRequest::input_gcs_uri].
pub fn set_input_gcs_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.input_gcs_uri = v.into();
self
}
/// Sets the value of [output_gcs_uri][crate::model::AsyncQueryReasoningEngineRequest::output_gcs_uri].
pub fn set_output_gcs_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.output_gcs_uri = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AsyncQueryReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::cancel_async_query_reasoning_engine][crate::client::ReasoningEngineExecutionService::cancel_async_query_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::CancelAsyncQueryReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelAsyncQueryReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelAsyncQueryReasoningEngine(
RequestBuilder<crate::model::CancelAsyncQueryReasoningEngineRequest>,
);
impl CancelAsyncQueryReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CancelAsyncQueryReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CancelAsyncQueryReasoningEngineResponse> {
(*self.0.stub)
.cancel_async_query_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CancelAsyncQueryReasoningEngineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [operation_name][crate::model::CancelAsyncQueryReasoningEngineRequest::operation_name].
///
/// This is a **required** field for requests.
pub fn set_operation_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.operation_name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelAsyncQueryReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::list_locations][crate::client::ReasoningEngineExecutionService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::get_location][crate::client::ReasoningEngineExecutionService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::set_iam_policy][crate::client::ReasoningEngineExecutionService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::get_iam_policy][crate::client::ReasoningEngineExecutionService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::test_iam_permissions][crate::client::ReasoningEngineExecutionService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::list_operations][crate::client::ReasoningEngineExecutionService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::get_operation][crate::client::ReasoningEngineExecutionService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::delete_operation][crate::client::ReasoningEngineExecutionService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::cancel_operation][crate::client::ReasoningEngineExecutionService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineExecutionService::wait_operation][crate::client::ReasoningEngineExecutionService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_execution_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineExecutionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [ReasoningEngineService][crate::client::ReasoningEngineService].
#[cfg(feature = "reasoning-engine-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "reasoning-engine-service")))]
pub mod reasoning_engine_service {
use crate::Result;
/// A builder for [ReasoningEngineService][crate::client::ReasoningEngineService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::reasoning_engine_service::ClientBuilder;
/// # use client::ReasoningEngineService;
/// let builder : ClientBuilder = ReasoningEngineService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ReasoningEngineService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ReasoningEngineService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ReasoningEngineService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ReasoningEngineService::create_reasoning_engine][crate::client::ReasoningEngineService::create_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::CreateReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateReasoningEngine(RequestBuilder<crate::model::CreateReasoningEngineRequest>);
impl CreateReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_reasoning_engine][crate::client::ReasoningEngineService::create_reasoning_engine].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_reasoning_engine`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ReasoningEngine,
crate::model::CreateReasoningEngineOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ReasoningEngine,
crate::model::CreateReasoningEngineOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ReasoningEngineService::create_reasoning_engine::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateReasoningEngineRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [reasoning_engine][crate::model::CreateReasoningEngineRequest::reasoning_engine].
///
/// This is a **required** field for requests.
pub fn set_reasoning_engine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ReasoningEngine>,
{
self.0.request.reasoning_engine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reasoning_engine][crate::model::CreateReasoningEngineRequest::reasoning_engine].
///
/// This is a **required** field for requests.
pub fn set_or_clear_reasoning_engine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ReasoningEngine>,
{
self.0.request.reasoning_engine = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::get_reasoning_engine][crate::client::ReasoningEngineService::get_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::GetReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetReasoningEngine(RequestBuilder<crate::model::GetReasoningEngineRequest>);
impl GetReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReasoningEngine> {
(*self.0.stub)
.get_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetReasoningEngineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::list_reasoning_engines][crate::client::ReasoningEngineService::list_reasoning_engines] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::ListReasoningEngines;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListReasoningEngines {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListReasoningEngines(RequestBuilder<crate::model::ListReasoningEnginesRequest>);
impl ListReasoningEngines {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListReasoningEnginesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListReasoningEnginesResponse> {
(*self.0.stub)
.list_reasoning_engines(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListReasoningEnginesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListReasoningEnginesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListReasoningEnginesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListReasoningEnginesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListReasoningEnginesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListReasoningEnginesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListReasoningEngines {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::update_reasoning_engine][crate::client::ReasoningEngineService::update_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::UpdateReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateReasoningEngine(RequestBuilder<crate::model::UpdateReasoningEngineRequest>);
impl UpdateReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_reasoning_engine][crate::client::ReasoningEngineService::update_reasoning_engine].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_reasoning_engine`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ReasoningEngine,
crate::model::UpdateReasoningEngineOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ReasoningEngine,
crate::model::UpdateReasoningEngineOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ReasoningEngineService::update_reasoning_engine::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [reasoning_engine][crate::model::UpdateReasoningEngineRequest::reasoning_engine].
///
/// This is a **required** field for requests.
pub fn set_reasoning_engine<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ReasoningEngine>,
{
self.0.request.reasoning_engine = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reasoning_engine][crate::model::UpdateReasoningEngineRequest::reasoning_engine].
///
/// This is a **required** field for requests.
pub fn set_or_clear_reasoning_engine<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ReasoningEngine>,
{
self.0.request.reasoning_engine = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateReasoningEngineRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateReasoningEngineRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::delete_reasoning_engine][crate::client::ReasoningEngineService::delete_reasoning_engine] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::DeleteReasoningEngine;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteReasoningEngine {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteReasoningEngine(RequestBuilder<crate::model::DeleteReasoningEngineRequest>);
impl DeleteReasoningEngine {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteReasoningEngineRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_reasoning_engine][crate::client::ReasoningEngineService::delete_reasoning_engine].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_reasoning_engine(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_reasoning_engine`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ReasoningEngineService::delete_reasoning_engine::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteReasoningEngineRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteReasoningEngineRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteReasoningEngine {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::list_locations][crate::client::ReasoningEngineService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::get_location][crate::client::ReasoningEngineService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::set_iam_policy][crate::client::ReasoningEngineService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::get_iam_policy][crate::client::ReasoningEngineService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::test_iam_permissions][crate::client::ReasoningEngineService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::list_operations][crate::client::ReasoningEngineService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::get_operation][crate::client::ReasoningEngineService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::delete_operation][crate::client::ReasoningEngineService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::cancel_operation][crate::client::ReasoningEngineService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ReasoningEngineService::wait_operation][crate::client::ReasoningEngineService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::reasoning_engine_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ReasoningEngineService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [ScheduleService][crate::client::ScheduleService].
#[cfg(feature = "schedule-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "schedule-service")))]
pub mod schedule_service {
use crate::Result;
/// A builder for [ScheduleService][crate::client::ScheduleService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::schedule_service::ClientBuilder;
/// # use client::ScheduleService;
/// let builder : ClientBuilder = ScheduleService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::ScheduleService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = ScheduleService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::ScheduleService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [ScheduleService::create_schedule][crate::client::ScheduleService::create_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::CreateSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateSchedule(RequestBuilder<crate::model::CreateScheduleRequest>);
impl CreateSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Schedule> {
(*self.0.stub)
.create_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateScheduleRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [schedule][crate::model::CreateScheduleRequest::schedule].
///
/// This is a **required** field for requests.
pub fn set_schedule<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Schedule>,
{
self.0.request.schedule = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schedule][crate::model::CreateScheduleRequest::schedule].
///
/// This is a **required** field for requests.
pub fn set_or_clear_schedule<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Schedule>,
{
self.0.request.schedule = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::delete_schedule][crate::client::ScheduleService::delete_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::DeleteSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteSchedule(RequestBuilder<crate::model::DeleteScheduleRequest>);
impl DeleteSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_schedule][crate::client::ScheduleService::delete_schedule].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_schedule`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::ScheduleService::delete_schedule::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteScheduleRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::get_schedule][crate::client::ScheduleService::get_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::GetSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetSchedule(RequestBuilder<crate::model::GetScheduleRequest>);
impl GetSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Schedule> {
(*self.0.stub)
.get_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetScheduleRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::list_schedules][crate::client::ScheduleService::list_schedules] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::ListSchedules;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListSchedules {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListSchedules(RequestBuilder<crate::model::ListSchedulesRequest>);
impl ListSchedules {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListSchedulesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListSchedulesResponse> {
(*self.0.stub)
.list_schedules(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchedulesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListSchedulesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListSchedulesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListSchedulesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSchedulesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSchedulesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListSchedulesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListSchedules {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::pause_schedule][crate::client::ScheduleService::pause_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::PauseSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> PauseSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct PauseSchedule(RequestBuilder<crate::model::PauseScheduleRequest>);
impl PauseSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::PauseScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.pause_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::PauseScheduleRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for PauseSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::resume_schedule][crate::client::ScheduleService::resume_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::ResumeSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ResumeSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ResumeSchedule(RequestBuilder<crate::model::ResumeScheduleRequest>);
impl ResumeSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ResumeScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.resume_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::ResumeScheduleRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [catch_up][crate::model::ResumeScheduleRequest::catch_up].
pub fn set_catch_up<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.catch_up = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ResumeSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::update_schedule][crate::client::ScheduleService::update_schedule] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::UpdateSchedule;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateSchedule {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateSchedule(RequestBuilder<crate::model::UpdateScheduleRequest>);
impl UpdateSchedule {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateScheduleRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Schedule> {
(*self.0.stub)
.update_schedule(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [schedule][crate::model::UpdateScheduleRequest::schedule].
///
/// This is a **required** field for requests.
pub fn set_schedule<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Schedule>,
{
self.0.request.schedule = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [schedule][crate::model::UpdateScheduleRequest::schedule].
///
/// This is a **required** field for requests.
pub fn set_or_clear_schedule<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Schedule>,
{
self.0.request.schedule = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateScheduleRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateScheduleRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateSchedule {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::list_locations][crate::client::ScheduleService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::get_location][crate::client::ScheduleService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::set_iam_policy][crate::client::ScheduleService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::get_iam_policy][crate::client::ScheduleService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::test_iam_permissions][crate::client::ScheduleService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::list_operations][crate::client::ScheduleService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::get_operation][crate::client::ScheduleService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::delete_operation][crate::client::ScheduleService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::cancel_operation][crate::client::ScheduleService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [ScheduleService::wait_operation][crate::client::ScheduleService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::schedule_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::ScheduleService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [SessionService][crate::client::SessionService].
#[cfg(feature = "session-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
pub mod session_service {
use crate::Result;
/// A builder for [SessionService][crate::client::SessionService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::session_service::ClientBuilder;
/// # use client::SessionService;
/// let builder : ClientBuilder = SessionService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::SessionService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = SessionService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::SessionService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [SessionService::create_session][crate::client::SessionService::create_session] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::CreateSession;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateSession {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
impl CreateSession {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_session][crate::client::SessionService::create_session].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_session(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_session`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Session,
crate::model::CreateSessionOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Session,
crate::model::CreateSessionOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::SessionService::create_session::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateSessionRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [session][crate::model::CreateSessionRequest::session].
///
/// This is a **required** field for requests.
pub fn set_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.0.request.session = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session][crate::model::CreateSessionRequest::session].
///
/// This is a **required** field for requests.
pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.0.request.session = v.map(|x| x.into());
self
}
/// Sets the value of [session_id][crate::model::CreateSessionRequest::session_id].
pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.session_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateSession {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::get_session][crate::client::SessionService::get_session] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::GetSession;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetSession {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
impl GetSession {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Session> {
(*self.0.stub)
.get_session(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetSessionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetSession {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::list_sessions][crate::client::SessionService::list_sessions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::ListSessions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListSessions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
impl ListSessions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
(*self.0.stub)
.list_sessions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListSessionsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListSessionsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSessionsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSessionsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListSessionsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListSessionsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListSessions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::update_session][crate::client::SessionService::update_session] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::UpdateSession;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateSession {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
impl UpdateSession {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Session> {
(*self.0.stub)
.update_session(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [session][crate::model::UpdateSessionRequest::session].
///
/// This is a **required** field for requests.
pub fn set_session<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.0.request.session = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session][crate::model::UpdateSessionRequest::session].
///
/// This is a **required** field for requests.
pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Session>,
{
self.0.request.session = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateSessionRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateSession {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::delete_session][crate::client::SessionService::delete_session] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::DeleteSession;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteSession {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
impl DeleteSession {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_session][crate::client::SessionService::delete_session].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_session(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_session`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::SessionService::delete_session::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteSessionRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteSession {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::list_events][crate::client::SessionService::list_events] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::ListEvents;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListEvents {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListEvents(RequestBuilder<crate::model::ListEventsRequest>);
impl ListEvents {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListEventsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListEventsResponse> {
(*self.0.stub)
.list_events(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEventsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListEventsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListEventsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListEventsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListEventsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListEventsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListEventsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListEvents {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::append_event][crate::client::SessionService::append_event] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::AppendEvent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AppendEvent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AppendEvent(RequestBuilder<crate::model::AppendEventRequest>);
impl AppendEvent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AppendEventRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AppendEventResponse> {
(*self.0.stub)
.append_event(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::AppendEventRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [event][crate::model::AppendEventRequest::event].
///
/// This is a **required** field for requests.
pub fn set_event<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SessionEvent>,
{
self.0.request.event = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [event][crate::model::AppendEventRequest::event].
///
/// This is a **required** field for requests.
pub fn set_or_clear_event<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SessionEvent>,
{
self.0.request.event = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AppendEvent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::list_locations][crate::client::SessionService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::get_location][crate::client::SessionService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::set_iam_policy][crate::client::SessionService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::get_iam_policy][crate::client::SessionService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::test_iam_permissions][crate::client::SessionService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::list_operations][crate::client::SessionService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::get_operation][crate::client::SessionService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::delete_operation][crate::client::SessionService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::cancel_operation][crate::client::SessionService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SessionService::wait_operation][crate::client::SessionService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::session_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [SpecialistPoolService][crate::client::SpecialistPoolService].
#[cfg(feature = "specialist-pool-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "specialist-pool-service")))]
pub mod specialist_pool_service {
use crate::Result;
/// A builder for [SpecialistPoolService][crate::client::SpecialistPoolService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::specialist_pool_service::ClientBuilder;
/// # use client::SpecialistPoolService;
/// let builder : ClientBuilder = SpecialistPoolService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::SpecialistPoolService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = SpecialistPoolService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::SpecialistPoolService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [SpecialistPoolService::create_specialist_pool][crate::client::SpecialistPoolService::create_specialist_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::CreateSpecialistPool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateSpecialistPool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateSpecialistPool(RequestBuilder<crate::model::CreateSpecialistPoolRequest>);
impl CreateSpecialistPool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateSpecialistPoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_specialist_pool][crate::client::SpecialistPoolService::create_specialist_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_specialist_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_specialist_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::SpecialistPool,
crate::model::CreateSpecialistPoolOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::SpecialistPool,
crate::model::CreateSpecialistPoolOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::SpecialistPoolService::create_specialist_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateSpecialistPoolRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [specialist_pool][crate::model::CreateSpecialistPoolRequest::specialist_pool].
///
/// This is a **required** field for requests.
pub fn set_specialist_pool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SpecialistPool>,
{
self.0.request.specialist_pool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [specialist_pool][crate::model::CreateSpecialistPoolRequest::specialist_pool].
///
/// This is a **required** field for requests.
pub fn set_or_clear_specialist_pool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SpecialistPool>,
{
self.0.request.specialist_pool = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateSpecialistPool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::get_specialist_pool][crate::client::SpecialistPoolService::get_specialist_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::GetSpecialistPool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetSpecialistPool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetSpecialistPool(RequestBuilder<crate::model::GetSpecialistPoolRequest>);
impl GetSpecialistPool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetSpecialistPoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::SpecialistPool> {
(*self.0.stub)
.get_specialist_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetSpecialistPoolRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetSpecialistPool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::list_specialist_pools][crate::client::SpecialistPoolService::list_specialist_pools] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::ListSpecialistPools;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListSpecialistPools {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListSpecialistPools(RequestBuilder<crate::model::ListSpecialistPoolsRequest>);
impl ListSpecialistPools {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListSpecialistPoolsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListSpecialistPoolsResponse> {
(*self.0.stub)
.list_specialist_pools(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListSpecialistPoolsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListSpecialistPoolsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListSpecialistPoolsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSpecialistPoolsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSpecialistPoolsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListSpecialistPoolsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListSpecialistPoolsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListSpecialistPools {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::delete_specialist_pool][crate::client::SpecialistPoolService::delete_specialist_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::DeleteSpecialistPool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteSpecialistPool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteSpecialistPool(RequestBuilder<crate::model::DeleteSpecialistPoolRequest>);
impl DeleteSpecialistPool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteSpecialistPoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_specialist_pool][crate::client::SpecialistPoolService::delete_specialist_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_specialist_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_specialist_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::SpecialistPoolService::delete_specialist_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteSpecialistPoolRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteSpecialistPoolRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteSpecialistPool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::update_specialist_pool][crate::client::SpecialistPoolService::update_specialist_pool] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::UpdateSpecialistPool;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateSpecialistPool {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateSpecialistPool(RequestBuilder<crate::model::UpdateSpecialistPoolRequest>);
impl UpdateSpecialistPool {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateSpecialistPoolRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_specialist_pool][crate::client::SpecialistPoolService::update_specialist_pool].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_specialist_pool(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_specialist_pool`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::SpecialistPool,
crate::model::UpdateSpecialistPoolOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::SpecialistPool,
crate::model::UpdateSpecialistPoolOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::SpecialistPoolService::update_specialist_pool::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [specialist_pool][crate::model::UpdateSpecialistPoolRequest::specialist_pool].
///
/// This is a **required** field for requests.
pub fn set_specialist_pool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SpecialistPool>,
{
self.0.request.specialist_pool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [specialist_pool][crate::model::UpdateSpecialistPoolRequest::specialist_pool].
///
/// This is a **required** field for requests.
pub fn set_or_clear_specialist_pool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SpecialistPool>,
{
self.0.request.specialist_pool = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateSpecialistPoolRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateSpecialistPoolRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateSpecialistPool {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::list_locations][crate::client::SpecialistPoolService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::get_location][crate::client::SpecialistPoolService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::set_iam_policy][crate::client::SpecialistPoolService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::get_iam_policy][crate::client::SpecialistPoolService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::test_iam_permissions][crate::client::SpecialistPoolService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::list_operations][crate::client::SpecialistPoolService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::get_operation][crate::client::SpecialistPoolService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::delete_operation][crate::client::SpecialistPoolService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::cancel_operation][crate::client::SpecialistPoolService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [SpecialistPoolService::wait_operation][crate::client::SpecialistPoolService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::specialist_pool_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::SpecialistPoolService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [TensorboardService][crate::client::TensorboardService].
#[cfg(feature = "tensorboard-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "tensorboard-service")))]
pub mod tensorboard_service {
use crate::Result;
/// A builder for [TensorboardService][crate::client::TensorboardService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::tensorboard_service::ClientBuilder;
/// # use client::TensorboardService;
/// let builder : ClientBuilder = TensorboardService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::TensorboardService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = TensorboardService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::TensorboardService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [TensorboardService::create_tensorboard][crate::client::TensorboardService::create_tensorboard] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::CreateTensorboard;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTensorboard {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTensorboard(RequestBuilder<crate::model::CreateTensorboardRequest>);
impl CreateTensorboard {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTensorboardRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_tensorboard][crate::client::TensorboardService::create_tensorboard].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_tensorboard(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_tensorboard`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Tensorboard,
crate::model::CreateTensorboardOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Tensorboard,
crate::model::CreateTensorboardOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::create_tensorboard::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateTensorboardRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tensorboard][crate::model::CreateTensorboardRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_tensorboard<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Tensorboard>,
{
self.0.request.tensorboard = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard][crate::model::CreateTensorboardRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Tensorboard>,
{
self.0.request.tensorboard = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTensorboard {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_tensorboard][crate::client::TensorboardService::get_tensorboard] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetTensorboard;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTensorboard {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTensorboard(RequestBuilder<crate::model::GetTensorboardRequest>);
impl GetTensorboard {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTensorboardRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Tensorboard> {
(*self.0.stub)
.get_tensorboard(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTensorboardRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTensorboard {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::update_tensorboard][crate::client::TensorboardService::update_tensorboard] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::UpdateTensorboard;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateTensorboard {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateTensorboard(RequestBuilder<crate::model::UpdateTensorboardRequest>);
impl UpdateTensorboard {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateTensorboardRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_tensorboard][crate::client::TensorboardService::update_tensorboard].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_tensorboard(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_tensorboard`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::Tensorboard,
crate::model::UpdateTensorboardOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::Tensorboard,
crate::model::UpdateTensorboardOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::update_tensorboard::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [update_mask][crate::model::UpdateTensorboardRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateTensorboardRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard][crate::model::UpdateTensorboardRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_tensorboard<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Tensorboard>,
{
self.0.request.tensorboard = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard][crate::model::UpdateTensorboardRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Tensorboard>,
{
self.0.request.tensorboard = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateTensorboard {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_tensorboards][crate::client::TensorboardService::list_tensorboards] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListTensorboards;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTensorboards {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTensorboards(RequestBuilder<crate::model::ListTensorboardsRequest>);
impl ListTensorboards {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTensorboardsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTensorboardsResponse> {
(*self.0.stub)
.list_tensorboards(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTensorboardsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTensorboardsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTensorboardsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTensorboardsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTensorboardsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTensorboardsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListTensorboardsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListTensorboardsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListTensorboardsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTensorboards {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::delete_tensorboard][crate::client::TensorboardService::delete_tensorboard] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::DeleteTensorboard;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTensorboard {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTensorboard(RequestBuilder<crate::model::DeleteTensorboardRequest>);
impl DeleteTensorboard {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTensorboardRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_tensorboard][crate::client::TensorboardService::delete_tensorboard].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_tensorboard(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_tensorboard`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::delete_tensorboard::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteTensorboardRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTensorboard {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::read_tensorboard_usage][crate::client::TensorboardService::read_tensorboard_usage] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ReadTensorboardUsage;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ReadTensorboardUsage {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ReadTensorboardUsage(RequestBuilder<crate::model::ReadTensorboardUsageRequest>);
impl ReadTensorboardUsage {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReadTensorboardUsageRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReadTensorboardUsageResponse> {
(*self.0.stub)
.read_tensorboard_usage(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard][crate::model::ReadTensorboardUsageRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_tensorboard<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ReadTensorboardUsage {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::read_tensorboard_size][crate::client::TensorboardService::read_tensorboard_size] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ReadTensorboardSize;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ReadTensorboardSize {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ReadTensorboardSize(RequestBuilder<crate::model::ReadTensorboardSizeRequest>);
impl ReadTensorboardSize {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReadTensorboardSizeRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReadTensorboardSizeResponse> {
(*self.0.stub)
.read_tensorboard_size(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard][crate::model::ReadTensorboardSizeRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_tensorboard<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ReadTensorboardSize {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::create_tensorboard_experiment][crate::client::TensorboardService::create_tensorboard_experiment] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::CreateTensorboardExperiment;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTensorboardExperiment {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTensorboardExperiment(
RequestBuilder<crate::model::CreateTensorboardExperimentRequest>,
);
impl CreateTensorboardExperiment {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTensorboardExperimentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardExperiment> {
(*self.0.stub)
.create_tensorboard_experiment(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTensorboardExperimentRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tensorboard_experiment][crate::model::CreateTensorboardExperimentRequest::tensorboard_experiment].
pub fn set_tensorboard_experiment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardExperiment>,
{
self.0.request.tensorboard_experiment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_experiment][crate::model::CreateTensorboardExperimentRequest::tensorboard_experiment].
pub fn set_or_clear_tensorboard_experiment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardExperiment>,
{
self.0.request.tensorboard_experiment = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard_experiment_id][crate::model::CreateTensorboardExperimentRequest::tensorboard_experiment_id].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_experiment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_experiment_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTensorboardExperiment {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_tensorboard_experiment][crate::client::TensorboardService::get_tensorboard_experiment] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetTensorboardExperiment;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTensorboardExperiment {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTensorboardExperiment(
RequestBuilder<crate::model::GetTensorboardExperimentRequest>,
);
impl GetTensorboardExperiment {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTensorboardExperimentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardExperiment> {
(*self.0.stub)
.get_tensorboard_experiment(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTensorboardExperimentRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTensorboardExperiment {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::update_tensorboard_experiment][crate::client::TensorboardService::update_tensorboard_experiment] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::UpdateTensorboardExperiment;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateTensorboardExperiment {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateTensorboardExperiment(
RequestBuilder<crate::model::UpdateTensorboardExperimentRequest>,
);
impl UpdateTensorboardExperiment {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateTensorboardExperimentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardExperiment> {
(*self.0.stub)
.update_tensorboard_experiment(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [update_mask][crate::model::UpdateTensorboardExperimentRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateTensorboardExperimentRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard_experiment][crate::model::UpdateTensorboardExperimentRequest::tensorboard_experiment].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_experiment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardExperiment>,
{
self.0.request.tensorboard_experiment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_experiment][crate::model::UpdateTensorboardExperimentRequest::tensorboard_experiment].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard_experiment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardExperiment>,
{
self.0.request.tensorboard_experiment = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateTensorboardExperiment {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_tensorboard_experiments][crate::client::TensorboardService::list_tensorboard_experiments] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListTensorboardExperiments;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTensorboardExperiments {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTensorboardExperiments(
RequestBuilder<crate::model::ListTensorboardExperimentsRequest>,
);
impl ListTensorboardExperiments {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTensorboardExperimentsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTensorboardExperimentsResponse> {
(*self.0.stub)
.list_tensorboard_experiments(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTensorboardExperimentsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTensorboardExperimentsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTensorboardExperimentsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTensorboardExperimentsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTensorboardExperimentsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTensorboardExperimentsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListTensorboardExperimentsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListTensorboardExperimentsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListTensorboardExperimentsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTensorboardExperiments {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::delete_tensorboard_experiment][crate::client::TensorboardService::delete_tensorboard_experiment] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::DeleteTensorboardExperiment;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTensorboardExperiment {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTensorboardExperiment(
RequestBuilder<crate::model::DeleteTensorboardExperimentRequest>,
);
impl DeleteTensorboardExperiment {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTensorboardExperimentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_tensorboard_experiment][crate::client::TensorboardService::delete_tensorboard_experiment].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_tensorboard_experiment(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_tensorboard_experiment`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::delete_tensorboard_experiment::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteTensorboardExperimentRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTensorboardExperiment {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::create_tensorboard_run][crate::client::TensorboardService::create_tensorboard_run] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::CreateTensorboardRun;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTensorboardRun {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTensorboardRun(RequestBuilder<crate::model::CreateTensorboardRunRequest>);
impl CreateTensorboardRun {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTensorboardRunRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardRun> {
(*self.0.stub)
.create_tensorboard_run(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTensorboardRunRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tensorboard_run][crate::model::CreateTensorboardRunRequest::tensorboard_run].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_run<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardRun>,
{
self.0.request.tensorboard_run = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_run][crate::model::CreateTensorboardRunRequest::tensorboard_run].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard_run<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardRun>,
{
self.0.request.tensorboard_run = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard_run_id][crate::model::CreateTensorboardRunRequest::tensorboard_run_id].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_run_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_run_id = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTensorboardRun {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::batch_create_tensorboard_runs][crate::client::TensorboardService::batch_create_tensorboard_runs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::BatchCreateTensorboardRuns;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchCreateTensorboardRuns {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchCreateTensorboardRuns(
RequestBuilder<crate::model::BatchCreateTensorboardRunsRequest>,
);
impl BatchCreateTensorboardRuns {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchCreateTensorboardRunsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchCreateTensorboardRunsResponse> {
(*self.0.stub)
.batch_create_tensorboard_runs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::BatchCreateTensorboardRunsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [requests][crate::model::BatchCreateTensorboardRunsRequest::requests].
///
/// This is a **required** field for requests.
pub fn set_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CreateTensorboardRunRequest>,
{
use std::iter::Iterator;
self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchCreateTensorboardRuns {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_tensorboard_run][crate::client::TensorboardService::get_tensorboard_run] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetTensorboardRun;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTensorboardRun {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTensorboardRun(RequestBuilder<crate::model::GetTensorboardRunRequest>);
impl GetTensorboardRun {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTensorboardRunRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardRun> {
(*self.0.stub)
.get_tensorboard_run(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTensorboardRunRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTensorboardRun {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::update_tensorboard_run][crate::client::TensorboardService::update_tensorboard_run] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::UpdateTensorboardRun;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateTensorboardRun {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateTensorboardRun(RequestBuilder<crate::model::UpdateTensorboardRunRequest>);
impl UpdateTensorboardRun {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateTensorboardRunRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardRun> {
(*self.0.stub)
.update_tensorboard_run(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [update_mask][crate::model::UpdateTensorboardRunRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateTensorboardRunRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard_run][crate::model::UpdateTensorboardRunRequest::tensorboard_run].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_run<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardRun>,
{
self.0.request.tensorboard_run = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_run][crate::model::UpdateTensorboardRunRequest::tensorboard_run].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard_run<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardRun>,
{
self.0.request.tensorboard_run = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateTensorboardRun {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_tensorboard_runs][crate::client::TensorboardService::list_tensorboard_runs] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListTensorboardRuns;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTensorboardRuns {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTensorboardRuns(RequestBuilder<crate::model::ListTensorboardRunsRequest>);
impl ListTensorboardRuns {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTensorboardRunsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTensorboardRunsResponse> {
(*self.0.stub)
.list_tensorboard_runs(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTensorboardRunsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTensorboardRunsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTensorboardRunsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTensorboardRunsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTensorboardRunsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTensorboardRunsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListTensorboardRunsRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListTensorboardRunsRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListTensorboardRunsRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTensorboardRuns {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::delete_tensorboard_run][crate::client::TensorboardService::delete_tensorboard_run] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::DeleteTensorboardRun;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTensorboardRun {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTensorboardRun(RequestBuilder<crate::model::DeleteTensorboardRunRequest>);
impl DeleteTensorboardRun {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTensorboardRunRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_tensorboard_run][crate::client::TensorboardService::delete_tensorboard_run].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_tensorboard_run(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_tensorboard_run`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::delete_tensorboard_run::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteTensorboardRunRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTensorboardRun {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::batch_create_tensorboard_time_series][crate::client::TensorboardService::batch_create_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::BatchCreateTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchCreateTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchCreateTensorboardTimeSeries(
RequestBuilder<crate::model::BatchCreateTensorboardTimeSeriesRequest>,
);
impl BatchCreateTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchCreateTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::BatchCreateTensorboardTimeSeriesResponse> {
(*self.0.stub)
.batch_create_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::BatchCreateTensorboardTimeSeriesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [requests][crate::model::BatchCreateTensorboardTimeSeriesRequest::requests].
///
/// This is a **required** field for requests.
pub fn set_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CreateTensorboardTimeSeriesRequest>,
{
use std::iter::Iterator;
self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchCreateTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::create_tensorboard_time_series][crate::client::TensorboardService::create_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::CreateTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTensorboardTimeSeries(
RequestBuilder<crate::model::CreateTensorboardTimeSeriesRequest>,
);
impl CreateTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardTimeSeries> {
(*self.0.stub)
.create_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTensorboardTimeSeriesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [tensorboard_time_series_id][crate::model::CreateTensorboardTimeSeriesRequest::tensorboard_time_series_id].
pub fn set_tensorboard_time_series_id<T: Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.0.request.tensorboard_time_series_id = v.into();
self
}
/// Sets the value of [tensorboard_time_series][crate::model::CreateTensorboardTimeSeriesRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_time_series<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardTimeSeries>,
{
self.0.request.tensorboard_time_series = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_time_series][crate::model::CreateTensorboardTimeSeriesRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard_time_series<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardTimeSeries>,
{
self.0.request.tensorboard_time_series = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_tensorboard_time_series][crate::client::TensorboardService::get_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTensorboardTimeSeries(
RequestBuilder<crate::model::GetTensorboardTimeSeriesRequest>,
);
impl GetTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardTimeSeries> {
(*self.0.stub)
.get_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTensorboardTimeSeriesRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::update_tensorboard_time_series][crate::client::TensorboardService::update_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::UpdateTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateTensorboardTimeSeries(
RequestBuilder<crate::model::UpdateTensorboardTimeSeriesRequest>,
);
impl UpdateTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::TensorboardTimeSeries> {
(*self.0.stub)
.update_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [update_mask][crate::model::UpdateTensorboardTimeSeriesRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][crate::model::UpdateTensorboardTimeSeriesRequest::update_mask].
///
/// This is a **required** field for requests.
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
/// Sets the value of [tensorboard_time_series][crate::model::UpdateTensorboardTimeSeriesRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_time_series<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TensorboardTimeSeries>,
{
self.0.request.tensorboard_time_series = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tensorboard_time_series][crate::model::UpdateTensorboardTimeSeriesRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_or_clear_tensorboard_time_series<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TensorboardTimeSeries>,
{
self.0.request.tensorboard_time_series = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_tensorboard_time_series][crate::client::TensorboardService::list_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTensorboardTimeSeries(
RequestBuilder<crate::model::ListTensorboardTimeSeriesRequest>,
);
impl ListTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTensorboardTimeSeriesResponse> {
(*self.0.stub)
.list_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListTensorboardTimeSeriesResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTensorboardTimeSeriesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTensorboardTimeSeriesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListTensorboardTimeSeriesRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTensorboardTimeSeriesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTensorboardTimeSeriesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ListTensorboardTimeSeriesRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
/// Sets the value of [read_mask][crate::model::ListTensorboardTimeSeriesRequest::read_mask].
pub fn set_read_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [read_mask][crate::model::ListTensorboardTimeSeriesRequest::read_mask].
pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.read_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::delete_tensorboard_time_series][crate::client::TensorboardService::delete_tensorboard_time_series] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::DeleteTensorboardTimeSeries;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTensorboardTimeSeries {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTensorboardTimeSeries(
RequestBuilder<crate::model::DeleteTensorboardTimeSeriesRequest>,
);
impl DeleteTensorboardTimeSeries {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTensorboardTimeSeriesRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_tensorboard_time_series][crate::client::TensorboardService::delete_tensorboard_time_series].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_tensorboard_time_series(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_tensorboard_time_series`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::TensorboardService::delete_tensorboard_time_series::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteTensorboardTimeSeriesRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTensorboardTimeSeries {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::batch_read_tensorboard_time_series_data][crate::client::TensorboardService::batch_read_tensorboard_time_series_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::BatchReadTensorboardTimeSeriesData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> BatchReadTensorboardTimeSeriesData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct BatchReadTensorboardTimeSeriesData(
RequestBuilder<crate::model::BatchReadTensorboardTimeSeriesDataRequest>,
);
impl BatchReadTensorboardTimeSeriesData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::BatchReadTensorboardTimeSeriesDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(
self,
) -> Result<crate::model::BatchReadTensorboardTimeSeriesDataResponse> {
(*self.0.stub)
.batch_read_tensorboard_time_series_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard][crate::model::BatchReadTensorboardTimeSeriesDataRequest::tensorboard].
///
/// This is a **required** field for requests.
pub fn set_tensorboard<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard = v.into();
self
}
/// Sets the value of [time_series][crate::model::BatchReadTensorboardTimeSeriesDataRequest::time_series].
///
/// This is a **required** field for requests.
pub fn set_time_series<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.time_series = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for BatchReadTensorboardTimeSeriesData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::read_tensorboard_time_series_data][crate::client::TensorboardService::read_tensorboard_time_series_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ReadTensorboardTimeSeriesData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ReadTensorboardTimeSeriesData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ReadTensorboardTimeSeriesData(
RequestBuilder<crate::model::ReadTensorboardTimeSeriesDataRequest>,
);
impl ReadTensorboardTimeSeriesData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ReadTensorboardTimeSeriesDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ReadTensorboardTimeSeriesDataResponse> {
(*self.0.stub)
.read_tensorboard_time_series_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard_time_series][crate::model::ReadTensorboardTimeSeriesDataRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_time_series<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_time_series = v.into();
self
}
/// Sets the value of [max_data_points][crate::model::ReadTensorboardTimeSeriesDataRequest::max_data_points].
pub fn set_max_data_points<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.max_data_points = v.into();
self
}
/// Sets the value of [filter][crate::model::ReadTensorboardTimeSeriesDataRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ReadTensorboardTimeSeriesData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::write_tensorboard_experiment_data][crate::client::TensorboardService::write_tensorboard_experiment_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::WriteTensorboardExperimentData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WriteTensorboardExperimentData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WriteTensorboardExperimentData(
RequestBuilder<crate::model::WriteTensorboardExperimentDataRequest>,
);
impl WriteTensorboardExperimentData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::WriteTensorboardExperimentDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::WriteTensorboardExperimentDataResponse> {
(*self.0.stub)
.write_tensorboard_experiment_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard_experiment][crate::model::WriteTensorboardExperimentDataRequest::tensorboard_experiment].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_experiment<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_experiment = v.into();
self
}
/// Sets the value of [write_run_data_requests][crate::model::WriteTensorboardExperimentDataRequest::write_run_data_requests].
///
/// This is a **required** field for requests.
pub fn set_write_run_data_requests<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::WriteTensorboardRunDataRequest>,
{
use std::iter::Iterator;
self.0.request.write_run_data_requests = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WriteTensorboardExperimentData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::write_tensorboard_run_data][crate::client::TensorboardService::write_tensorboard_run_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::WriteTensorboardRunData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WriteTensorboardRunData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WriteTensorboardRunData(
RequestBuilder<crate::model::WriteTensorboardRunDataRequest>,
);
impl WriteTensorboardRunData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::WriteTensorboardRunDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::WriteTensorboardRunDataResponse> {
(*self.0.stub)
.write_tensorboard_run_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [tensorboard_run][crate::model::WriteTensorboardRunDataRequest::tensorboard_run].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_run<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_run = v.into();
self
}
/// Sets the value of [time_series_data][crate::model::WriteTensorboardRunDataRequest::time_series_data].
///
/// This is a **required** field for requests.
pub fn set_time_series_data<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TimeSeriesData>,
{
use std::iter::Iterator;
self.0.request.time_series_data = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WriteTensorboardRunData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::export_tensorboard_time_series_data][crate::client::TensorboardService::export_tensorboard_time_series_data] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ExportTensorboardTimeSeriesData;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ExportTensorboardTimeSeriesData {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ExportTensorboardTimeSeriesData(
RequestBuilder<crate::model::ExportTensorboardTimeSeriesDataRequest>,
);
impl ExportTensorboardTimeSeriesData {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ExportTensorboardTimeSeriesDataRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ExportTensorboardTimeSeriesDataResponse> {
(*self.0.stub)
.export_tensorboard_time_series_data(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ExportTensorboardTimeSeriesDataResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ExportTensorboardTimeSeriesDataResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [tensorboard_time_series][crate::model::ExportTensorboardTimeSeriesDataRequest::tensorboard_time_series].
///
/// This is a **required** field for requests.
pub fn set_tensorboard_time_series<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.tensorboard_time_series = v.into();
self
}
/// Sets the value of [filter][crate::model::ExportTensorboardTimeSeriesDataRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ExportTensorboardTimeSeriesDataRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ExportTensorboardTimeSeriesDataRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [order_by][crate::model::ExportTensorboardTimeSeriesDataRequest::order_by].
pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.order_by = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ExportTensorboardTimeSeriesData {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_locations][crate::client::TensorboardService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_location][crate::client::TensorboardService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::set_iam_policy][crate::client::TensorboardService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_iam_policy][crate::client::TensorboardService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::test_iam_permissions][crate::client::TensorboardService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::list_operations][crate::client::TensorboardService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::get_operation][crate::client::TensorboardService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::delete_operation][crate::client::TensorboardService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::cancel_operation][crate::client::TensorboardService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [TensorboardService::wait_operation][crate::client::TensorboardService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::tensorboard_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::TensorboardService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [VertexRagDataService][crate::client::VertexRagDataService].
#[cfg(feature = "vertex-rag-data-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-data-service")))]
pub mod vertex_rag_data_service {
use crate::Result;
/// A builder for [VertexRagDataService][crate::client::VertexRagDataService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::vertex_rag_data_service::ClientBuilder;
/// # use client::VertexRagDataService;
/// let builder : ClientBuilder = VertexRagDataService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::VertexRagDataService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = VertexRagDataService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::VertexRagDataService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [VertexRagDataService::create_rag_corpus][crate::client::VertexRagDataService::create_rag_corpus] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::CreateRagCorpus;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateRagCorpus {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateRagCorpus(RequestBuilder<crate::model::CreateRagCorpusRequest>);
impl CreateRagCorpus {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateRagCorpusRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [create_rag_corpus][crate::client::VertexRagDataService::create_rag_corpus].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.create_rag_corpus(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `create_rag_corpus`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::RagCorpus,
crate::model::CreateRagCorpusOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::RagCorpus,
crate::model::CreateRagCorpusOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::create_rag_corpus::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::CreateRagCorpusRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [rag_corpus][crate::model::CreateRagCorpusRequest::rag_corpus].
///
/// This is a **required** field for requests.
pub fn set_rag_corpus<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagCorpus>,
{
self.0.request.rag_corpus = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rag_corpus][crate::model::CreateRagCorpusRequest::rag_corpus].
///
/// This is a **required** field for requests.
pub fn set_or_clear_rag_corpus<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagCorpus>,
{
self.0.request.rag_corpus = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateRagCorpus {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::update_rag_corpus][crate::client::VertexRagDataService::update_rag_corpus] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::UpdateRagCorpus;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateRagCorpus {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateRagCorpus(RequestBuilder<crate::model::UpdateRagCorpusRequest>);
impl UpdateRagCorpus {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateRagCorpusRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_rag_corpus][crate::client::VertexRagDataService::update_rag_corpus].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_rag_corpus(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_rag_corpus`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::RagCorpus,
crate::model::UpdateRagCorpusOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::RagCorpus,
crate::model::UpdateRagCorpusOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::update_rag_corpus::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [rag_corpus][crate::model::UpdateRagCorpusRequest::rag_corpus].
///
/// This is a **required** field for requests.
pub fn set_rag_corpus<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagCorpus>,
{
self.0.request.rag_corpus = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rag_corpus][crate::model::UpdateRagCorpusRequest::rag_corpus].
///
/// This is a **required** field for requests.
pub fn set_or_clear_rag_corpus<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagCorpus>,
{
self.0.request.rag_corpus = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateRagCorpus {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_rag_corpus][crate::client::VertexRagDataService::get_rag_corpus] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetRagCorpus;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetRagCorpus {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetRagCorpus(RequestBuilder<crate::model::GetRagCorpusRequest>);
impl GetRagCorpus {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetRagCorpusRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RagCorpus> {
(*self.0.stub)
.get_rag_corpus(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetRagCorpusRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetRagCorpus {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::list_rag_corpora][crate::client::VertexRagDataService::list_rag_corpora] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::ListRagCorpora;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListRagCorpora {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListRagCorpora(RequestBuilder<crate::model::ListRagCorporaRequest>);
impl ListRagCorpora {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListRagCorporaRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListRagCorporaResponse> {
(*self.0.stub)
.list_rag_corpora(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
crate::model::ListRagCorporaResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListRagCorporaResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListRagCorporaRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListRagCorporaRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListRagCorporaRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListRagCorpora {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::delete_rag_corpus][crate::client::VertexRagDataService::delete_rag_corpus] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::DeleteRagCorpus;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteRagCorpus {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteRagCorpus(RequestBuilder<crate::model::DeleteRagCorpusRequest>);
impl DeleteRagCorpus {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteRagCorpusRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_rag_corpus][crate::client::VertexRagDataService::delete_rag_corpus].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_rag_corpus(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_rag_corpus`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::delete_rag_corpus::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteRagCorpusRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteRagCorpusRequest::force].
pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.force = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteRagCorpus {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::upload_rag_file][crate::client::VertexRagDataService::upload_rag_file] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::UploadRagFile;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UploadRagFile {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UploadRagFile(RequestBuilder<crate::model::UploadRagFileRequest>);
impl UploadRagFile {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UploadRagFileRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::UploadRagFileResponse> {
(*self.0.stub)
.upload_rag_file(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::UploadRagFileRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [rag_file][crate::model::UploadRagFileRequest::rag_file].
///
/// This is a **required** field for requests.
pub fn set_rag_file<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagFile>,
{
self.0.request.rag_file = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rag_file][crate::model::UploadRagFileRequest::rag_file].
///
/// This is a **required** field for requests.
pub fn set_or_clear_rag_file<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagFile>,
{
self.0.request.rag_file = v.map(|x| x.into());
self
}
/// Sets the value of [upload_rag_file_config][crate::model::UploadRagFileRequest::upload_rag_file_config].
///
/// This is a **required** field for requests.
pub fn set_upload_rag_file_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::UploadRagFileConfig>,
{
self.0.request.upload_rag_file_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [upload_rag_file_config][crate::model::UploadRagFileRequest::upload_rag_file_config].
///
/// This is a **required** field for requests.
pub fn set_or_clear_upload_rag_file_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::UploadRagFileConfig>,
{
self.0.request.upload_rag_file_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UploadRagFile {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::import_rag_files][crate::client::VertexRagDataService::import_rag_files] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::ImportRagFiles;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ImportRagFiles {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ImportRagFiles(RequestBuilder<crate::model::ImportRagFilesRequest>);
impl ImportRagFiles {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ImportRagFilesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [import_rag_files][crate::client::VertexRagDataService::import_rag_files].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.import_rag_files(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `import_rag_files`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::ImportRagFilesResponse,
crate::model::ImportRagFilesOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::ImportRagFilesResponse,
crate::model::ImportRagFilesOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::import_rag_files::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::ImportRagFilesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [import_rag_files_config][crate::model::ImportRagFilesRequest::import_rag_files_config].
///
/// This is a **required** field for requests.
pub fn set_import_rag_files_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportRagFilesConfig>,
{
self.0.request.import_rag_files_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [import_rag_files_config][crate::model::ImportRagFilesRequest::import_rag_files_config].
///
/// This is a **required** field for requests.
pub fn set_or_clear_import_rag_files_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportRagFilesConfig>,
{
self.0.request.import_rag_files_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ImportRagFiles {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_rag_file][crate::client::VertexRagDataService::get_rag_file] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetRagFile;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetRagFile {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetRagFile(RequestBuilder<crate::model::GetRagFileRequest>);
impl GetRagFile {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetRagFileRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RagFile> {
(*self.0.stub)
.get_rag_file(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetRagFileRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetRagFile {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::list_rag_files][crate::client::VertexRagDataService::list_rag_files] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::ListRagFiles;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListRagFiles {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListRagFiles(RequestBuilder<crate::model::ListRagFilesRequest>);
impl ListRagFiles {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListRagFilesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListRagFilesResponse> {
(*self.0.stub)
.list_rag_files(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListRagFilesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListRagFilesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListRagFilesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListRagFilesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListRagFilesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListRagFiles {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::delete_rag_file][crate::client::VertexRagDataService::delete_rag_file] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::DeleteRagFile;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteRagFile {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteRagFile(RequestBuilder<crate::model::DeleteRagFileRequest>);
impl DeleteRagFile {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteRagFileRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [delete_rag_file][crate::client::VertexRagDataService::delete_rag_file].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.delete_rag_file(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_rag_file`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<(), crate::model::DeleteOperationMetadata> {
type Operation = google_cloud_lro::internal::Operation<
wkt::Empty,
crate::model::DeleteOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::delete_rag_file::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_unit_response_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [name][crate::model::DeleteRagFileRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteRagFile {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::update_rag_engine_config][crate::client::VertexRagDataService::update_rag_engine_config] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::UpdateRagEngineConfig;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> UpdateRagEngineConfig {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct UpdateRagEngineConfig(RequestBuilder<crate::model::UpdateRagEngineConfigRequest>);
impl UpdateRagEngineConfig {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::UpdateRagEngineConfigRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [update_rag_engine_config][crate::client::VertexRagDataService::update_rag_engine_config].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.update_rag_engine_config(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `update_rag_engine_config`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::RagEngineConfig,
crate::model::UpdateRagEngineConfigOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::RagEngineConfig,
crate::model::UpdateRagEngineConfigOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagDataService::update_rag_engine_config::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [rag_engine_config][crate::model::UpdateRagEngineConfigRequest::rag_engine_config].
///
/// This is a **required** field for requests.
pub fn set_rag_engine_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagEngineConfig>,
{
self.0.request.rag_engine_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rag_engine_config][crate::model::UpdateRagEngineConfigRequest::rag_engine_config].
///
/// This is a **required** field for requests.
pub fn set_or_clear_rag_engine_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagEngineConfig>,
{
self.0.request.rag_engine_config = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for UpdateRagEngineConfig {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_rag_engine_config][crate::client::VertexRagDataService::get_rag_engine_config] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetRagEngineConfig;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetRagEngineConfig {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetRagEngineConfig(RequestBuilder<crate::model::GetRagEngineConfigRequest>);
impl GetRagEngineConfig {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetRagEngineConfigRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RagEngineConfig> {
(*self.0.stub)
.get_rag_engine_config(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetRagEngineConfigRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetRagEngineConfig {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::list_locations][crate::client::VertexRagDataService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_location][crate::client::VertexRagDataService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::set_iam_policy][crate::client::VertexRagDataService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_iam_policy][crate::client::VertexRagDataService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::test_iam_permissions][crate::client::VertexRagDataService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::list_operations][crate::client::VertexRagDataService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::get_operation][crate::client::VertexRagDataService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::delete_operation][crate::client::VertexRagDataService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::cancel_operation][crate::client::VertexRagDataService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagDataService::wait_operation][crate::client::VertexRagDataService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_data_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagDataService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [VertexRagService][crate::client::VertexRagService].
#[cfg(feature = "vertex-rag-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vertex-rag-service")))]
pub mod vertex_rag_service {
use crate::Result;
/// A builder for [VertexRagService][crate::client::VertexRagService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::vertex_rag_service::ClientBuilder;
/// # use client::VertexRagService;
/// let builder : ClientBuilder = VertexRagService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::VertexRagService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = VertexRagService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::VertexRagService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [VertexRagService::retrieve_contexts][crate::client::VertexRagService::retrieve_contexts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::RetrieveContexts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> RetrieveContexts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct RetrieveContexts(RequestBuilder<crate::model::RetrieveContextsRequest>);
impl RetrieveContexts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::RetrieveContextsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::RetrieveContextsResponse> {
(*self.0.stub)
.retrieve_contexts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::RetrieveContextsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [query][crate::model::RetrieveContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::RetrieveContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = v.map(|x| x.into());
self
}
/// Sets the value of [data_source][crate::model::RetrieveContextsRequest::data_source].
///
/// Note that all the setters affecting `data_source` are
/// mutually exclusive.
pub fn set_data_source<
T: Into<Option<crate::model::retrieve_contexts_request::DataSource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.data_source = v.into();
self
}
/// Sets the value of [data_source][crate::model::RetrieveContextsRequest::data_source]
/// to hold a `VertexRagStore`.
///
/// Note that all the setters affecting `data_source` are
/// mutually exclusive.
pub fn set_vertex_rag_store<
T: std::convert::Into<
std::boxed::Box<crate::model::retrieve_contexts_request::VertexRagStore>,
>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_vertex_rag_store(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for RetrieveContexts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::augment_prompt][crate::client::VertexRagService::augment_prompt] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::AugmentPrompt;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AugmentPrompt {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AugmentPrompt(RequestBuilder<crate::model::AugmentPromptRequest>);
impl AugmentPrompt {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AugmentPromptRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AugmentPromptResponse> {
(*self.0.stub)
.augment_prompt(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::AugmentPromptRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [contents][crate::model::AugmentPromptRequest::contents].
pub fn set_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Content>,
{
use std::iter::Iterator;
self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model][crate::model::AugmentPromptRequest::model].
pub fn set_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::augment_prompt_request::Model>,
{
self.0.request.model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [model][crate::model::AugmentPromptRequest::model].
pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::augment_prompt_request::Model>,
{
self.0.request.model = v.map(|x| x.into());
self
}
/// Sets the value of [data_source][crate::model::AugmentPromptRequest::data_source].
///
/// Note that all the setters affecting `data_source` are
/// mutually exclusive.
pub fn set_data_source<
T: Into<Option<crate::model::augment_prompt_request::DataSource>>,
>(
mut self,
v: T,
) -> Self {
self.0.request.data_source = v.into();
self
}
/// Sets the value of [data_source][crate::model::AugmentPromptRequest::data_source]
/// to hold a `VertexRagStore`.
///
/// Note that all the setters affecting `data_source` are
/// mutually exclusive.
pub fn set_vertex_rag_store<
T: std::convert::Into<std::boxed::Box<crate::model::VertexRagStore>>,
>(
mut self,
v: T,
) -> Self {
self.0.request = self.0.request.set_vertex_rag_store(v);
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AugmentPrompt {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::corroborate_content][crate::client::VertexRagService::corroborate_content] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::CorroborateContent;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CorroborateContent {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CorroborateContent(RequestBuilder<crate::model::CorroborateContentRequest>);
impl CorroborateContent {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CorroborateContentRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::CorroborateContentResponse> {
(*self.0.stub)
.corroborate_content(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CorroborateContentRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [content][crate::model::CorroborateContentRequest::content].
pub fn set_content<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.content = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [content][crate::model::CorroborateContentRequest::content].
pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Content>,
{
self.0.request.content = v.map(|x| x.into());
self
}
/// Sets the value of [facts][crate::model::CorroborateContentRequest::facts].
pub fn set_facts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Fact>,
{
use std::iter::Iterator;
self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parameters][crate::model::CorroborateContentRequest::parameters].
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::corroborate_content_request::Parameters>,
{
self.0.request.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::CorroborateContentRequest::parameters].
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::corroborate_content_request::Parameters>,
{
self.0.request.parameters = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CorroborateContent {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::ask_contexts][crate::client::VertexRagService::ask_contexts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::AskContexts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AskContexts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AskContexts(RequestBuilder<crate::model::AskContextsRequest>);
impl AskContexts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AskContextsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::AskContextsResponse> {
(*self.0.stub)
.ask_contexts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::AskContextsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [query][crate::model::AskContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::AskContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = v.map(|x| x.into());
self
}
/// Sets the value of [tools][crate::model::AskContextsRequest::tools].
pub fn set_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tool>,
{
use std::iter::Iterator;
self.0.request.tools = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AskContexts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::async_retrieve_contexts][crate::client::VertexRagService::async_retrieve_contexts] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::AsyncRetrieveContexts;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AsyncRetrieveContexts {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AsyncRetrieveContexts(RequestBuilder<crate::model::AsyncRetrieveContextsRequest>);
impl AsyncRetrieveContexts {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AsyncRetrieveContextsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [async_retrieve_contexts][crate::client::VertexRagService::async_retrieve_contexts].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.async_retrieve_contexts(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `async_retrieve_contexts`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::AsyncRetrieveContextsResponse,
crate::model::AsyncRetrieveContextsOperationMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::AsyncRetrieveContextsResponse,
crate::model::AsyncRetrieveContextsOperationMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VertexRagService::async_retrieve_contexts::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::AsyncRetrieveContextsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [query][crate::model::AsyncRetrieveContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::AsyncRetrieveContextsRequest::query].
///
/// This is a **required** field for requests.
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RagQuery>,
{
self.0.request.query = v.map(|x| x.into());
self
}
/// Sets the value of [tools][crate::model::AsyncRetrieveContextsRequest::tools].
pub fn set_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tool>,
{
use std::iter::Iterator;
self.0.request.tools = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AsyncRetrieveContexts {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::list_locations][crate::client::VertexRagService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::get_location][crate::client::VertexRagService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::set_iam_policy][crate::client::VertexRagService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::get_iam_policy][crate::client::VertexRagService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::test_iam_permissions][crate::client::VertexRagService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::list_operations][crate::client::VertexRagService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::get_operation][crate::client::VertexRagService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::delete_operation][crate::client::VertexRagService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::cancel_operation][crate::client::VertexRagService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VertexRagService::wait_operation][crate::client::VertexRagService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vertex_rag_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VertexRagService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}
/// Request and client builders for [VizierService][crate::client::VizierService].
#[cfg(feature = "vizier-service")]
#[cfg_attr(docsrs, doc(cfg(feature = "vizier-service")))]
pub mod vizier_service {
use crate::Result;
/// A builder for [VizierService][crate::client::VizierService].
///
/// ```
/// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
/// # use google_cloud_aiplatform_v1::*;
/// # use builder::vizier_service::ClientBuilder;
/// # use client::VizierService;
/// let builder : ClientBuilder = VizierService::builder();
/// let client = builder
/// .with_endpoint("https://aiplatform.googleapis.com")
/// .build().await?;
/// # Ok(()) }
/// ```
pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
pub(crate) mod client {
use super::super::super::client::VizierService;
pub struct Factory;
impl crate::ClientFactory for Factory {
type Client = VizierService;
type Credentials = gaxi::options::Credentials;
async fn build(
self,
config: gaxi::options::ClientConfig,
) -> crate::ClientBuilderResult<Self::Client> {
Self::Client::new(config).await
}
}
}
/// Common implementation for [crate::client::VizierService] request builders.
#[derive(Clone, Debug)]
pub(crate) struct RequestBuilder<R: std::default::Default> {
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
request: R,
options: crate::RequestOptions,
}
impl<R> RequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self {
stub,
request: R::default(),
options: crate::RequestOptions::default(),
}
}
}
/// The request builder for [VizierService::create_study][crate::client::VizierService::create_study] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::CreateStudy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateStudy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateStudy(RequestBuilder<crate::model::CreateStudyRequest>);
impl CreateStudy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateStudyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Study> {
(*self.0.stub)
.create_study(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateStudyRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [study][crate::model::CreateStudyRequest::study].
///
/// This is a **required** field for requests.
pub fn set_study<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Study>,
{
self.0.request.study = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [study][crate::model::CreateStudyRequest::study].
///
/// This is a **required** field for requests.
pub fn set_or_clear_study<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Study>,
{
self.0.request.study = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateStudy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::get_study][crate::client::VizierService::get_study] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::GetStudy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetStudy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetStudy(RequestBuilder<crate::model::GetStudyRequest>);
impl GetStudy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetStudyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Study> {
(*self.0.stub)
.get_study(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetStudyRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetStudy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::list_studies][crate::client::VizierService::list_studies] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::ListStudies;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListStudies {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListStudies(RequestBuilder<crate::model::ListStudiesRequest>);
impl ListStudies {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListStudiesRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListStudiesResponse> {
(*self.0.stub)
.list_studies(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListStudiesResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListStudiesResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListStudiesRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListStudiesRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListStudiesRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListStudies {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::delete_study][crate::client::VizierService::delete_study] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::DeleteStudy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteStudy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteStudy(RequestBuilder<crate::model::DeleteStudyRequest>);
impl DeleteStudy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteStudyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_study(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::DeleteStudyRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteStudy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::lookup_study][crate::client::VizierService::lookup_study] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::LookupStudy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> LookupStudy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct LookupStudy(RequestBuilder<crate::model::LookupStudyRequest>);
impl LookupStudy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::LookupStudyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Study> {
(*self.0.stub)
.lookup_study(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::LookupStudyRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [display_name][crate::model::LookupStudyRequest::display_name].
///
/// This is a **required** field for requests.
pub fn set_display_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.display_name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for LookupStudy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::suggest_trials][crate::client::VizierService::suggest_trials] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::SuggestTrials;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SuggestTrials {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SuggestTrials(RequestBuilder<crate::model::SuggestTrialsRequest>);
impl SuggestTrials {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::SuggestTrialsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [suggest_trials][crate::client::VizierService::suggest_trials].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.suggest_trials(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `suggest_trials`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::SuggestTrialsResponse,
crate::model::SuggestTrialsMetadata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::SuggestTrialsResponse,
crate::model::SuggestTrialsMetadata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name =
"google_cloud_aiplatform_v1::client::VizierService::suggest_trials::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [parent][crate::model::SuggestTrialsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [suggestion_count][crate::model::SuggestTrialsRequest::suggestion_count].
///
/// This is a **required** field for requests.
pub fn set_suggestion_count<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.suggestion_count = v.into();
self
}
/// Sets the value of [client_id][crate::model::SuggestTrialsRequest::client_id].
///
/// This is a **required** field for requests.
pub fn set_client_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.client_id = v.into();
self
}
/// Sets the value of [contexts][crate::model::SuggestTrialsRequest::contexts].
pub fn set_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TrialContext>,
{
use std::iter::Iterator;
self.0.request.contexts = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SuggestTrials {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::create_trial][crate::client::VizierService::create_trial] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::CreateTrial;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CreateTrial {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CreateTrial(RequestBuilder<crate::model::CreateTrialRequest>);
impl CreateTrial {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CreateTrialRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Trial> {
(*self.0.stub)
.create_trial(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::CreateTrialRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [trial][crate::model::CreateTrialRequest::trial].
///
/// This is a **required** field for requests.
pub fn set_trial<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Trial>,
{
self.0.request.trial = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [trial][crate::model::CreateTrialRequest::trial].
///
/// This is a **required** field for requests.
pub fn set_or_clear_trial<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Trial>,
{
self.0.request.trial = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CreateTrial {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::get_trial][crate::client::VizierService::get_trial] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::GetTrial;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetTrial {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetTrial(RequestBuilder<crate::model::GetTrialRequest>);
impl GetTrial {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::GetTrialRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Trial> {
(*self.0.stub)
.get_trial(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::GetTrialRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetTrial {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::list_trials][crate::client::VizierService::list_trials] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::ListTrials;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListTrials {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListTrials(RequestBuilder<crate::model::ListTrialsRequest>);
impl ListTrials {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListTrialsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListTrialsResponse> {
(*self.0.stub)
.list_trials(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListTrialsResponse, crate::Error>
{
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
crate::model::ListTrialsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [parent][crate::model::ListTrialsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListTrialsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListTrialsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListTrials {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::add_trial_measurement][crate::client::VizierService::add_trial_measurement] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::AddTrialMeasurement;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> AddTrialMeasurement {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct AddTrialMeasurement(RequestBuilder<crate::model::AddTrialMeasurementRequest>);
impl AddTrialMeasurement {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::AddTrialMeasurementRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Trial> {
(*self.0.stub)
.add_trial_measurement(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [trial_name][crate::model::AddTrialMeasurementRequest::trial_name].
///
/// This is a **required** field for requests.
pub fn set_trial_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.trial_name = v.into();
self
}
/// Sets the value of [measurement][crate::model::AddTrialMeasurementRequest::measurement].
///
/// This is a **required** field for requests.
pub fn set_measurement<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Measurement>,
{
self.0.request.measurement = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [measurement][crate::model::AddTrialMeasurementRequest::measurement].
///
/// This is a **required** field for requests.
pub fn set_or_clear_measurement<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Measurement>,
{
self.0.request.measurement = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for AddTrialMeasurement {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::complete_trial][crate::client::VizierService::complete_trial] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::CompleteTrial;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CompleteTrial {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CompleteTrial(RequestBuilder<crate::model::CompleteTrialRequest>);
impl CompleteTrial {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CompleteTrialRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Trial> {
(*self.0.stub)
.complete_trial(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::CompleteTrialRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [final_measurement][crate::model::CompleteTrialRequest::final_measurement].
pub fn set_final_measurement<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Measurement>,
{
self.0.request.final_measurement = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [final_measurement][crate::model::CompleteTrialRequest::final_measurement].
pub fn set_or_clear_final_measurement<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Measurement>,
{
self.0.request.final_measurement = v.map(|x| x.into());
self
}
/// Sets the value of [trial_infeasible][crate::model::CompleteTrialRequest::trial_infeasible].
pub fn set_trial_infeasible<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.trial_infeasible = v.into();
self
}
/// Sets the value of [infeasible_reason][crate::model::CompleteTrialRequest::infeasible_reason].
pub fn set_infeasible_reason<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.infeasible_reason = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CompleteTrial {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::delete_trial][crate::client::VizierService::delete_trial] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::DeleteTrial;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteTrial {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteTrial(RequestBuilder<crate::model::DeleteTrialRequest>);
impl DeleteTrial {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::DeleteTrialRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_trial(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::DeleteTrialRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteTrial {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::check_trial_early_stopping_state][crate::client::VizierService::check_trial_early_stopping_state] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::CheckTrialEarlyStoppingState;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_lro::Poller;
///
/// let builder = prepare_request_builder();
/// let response = builder.poller().until_done().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CheckTrialEarlyStoppingState {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CheckTrialEarlyStoppingState(
RequestBuilder<crate::model::CheckTrialEarlyStoppingStateRequest>,
);
impl CheckTrialEarlyStoppingState {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::CheckTrialEarlyStoppingStateRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
///
/// # Long running operations
///
/// This starts, but does not poll, a longrunning operation. More information
/// on [check_trial_early_stopping_state][crate::client::VizierService::check_trial_early_stopping_state].
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.check_trial_early_stopping_state(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Creates a [Poller][google_cloud_lro::Poller] to work with `check_trial_early_stopping_state`.
pub fn poller(
self,
) -> impl google_cloud_lro::Poller<
crate::model::CheckTrialEarlyStoppingStateResponse,
crate::model::CheckTrialEarlyStoppingStateMetatdata,
> {
type Operation = google_cloud_lro::internal::Operation<
crate::model::CheckTrialEarlyStoppingStateResponse,
crate::model::CheckTrialEarlyStoppingStateMetatdata,
>;
let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
if let Some(ref mut details) = poller_options.tracing {
details.method_name = "google_cloud_aiplatform_v1::client::VizierService::check_trial_early_stopping_state::until_done";
}
let stub = self.0.stub.clone();
let mut options = self.0.options.clone();
options.set_retry_policy(google_cloud_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))
};
use google_cloud_lro::internal::PollerExt;
{
google_cloud_lro::internal::new_poller(
polling_error_policy,
polling_backoff_policy,
start,
query,
)
}
.with_options(poller_options)
}
/// Sets the value of [trial_name][crate::model::CheckTrialEarlyStoppingStateRequest::trial_name].
///
/// This is a **required** field for requests.
pub fn set_trial_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.trial_name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CheckTrialEarlyStoppingState {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::stop_trial][crate::client::VizierService::stop_trial] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::StopTrial;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> StopTrial {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct StopTrial(RequestBuilder<crate::model::StopTrialRequest>);
impl StopTrial {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::StopTrialRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::Trial> {
(*self.0.stub)
.stop_trial(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][crate::model::StopTrialRequest::name].
///
/// This is a **required** field for requests.
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for StopTrial {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::list_optimal_trials][crate::client::VizierService::list_optimal_trials] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::ListOptimalTrials;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOptimalTrials {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOptimalTrials(RequestBuilder<crate::model::ListOptimalTrialsRequest>);
impl ListOptimalTrials {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<crate::model::ListOptimalTrialsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<crate::model::ListOptimalTrialsResponse> {
(*self.0.stub)
.list_optimal_trials(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [parent][crate::model::ListOptimalTrialsRequest::parent].
///
/// This is a **required** field for requests.
pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOptimalTrials {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::list_locations][crate::client::VizierService::list_locations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::ListLocations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListLocations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
(*self.0.stub)
.list_locations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_location::model::ListLocationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::get_location][crate::client::VizierService::get_location] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::GetLocation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetLocation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_location::model::Location> {
(*self.0.stub)
.get_location(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::set_iam_policy][crate::client::VizierService::set_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::SetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> SetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct SetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::SetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.set_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::SetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_policy<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [policy][google_cloud_iam_v1::model::SetIamPolicyRequest::policy].
///
/// This is a **required** field for requests.
pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::Policy>,
{
self.0.request.policy = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [update_mask][google_cloud_iam_v1::model::SetIamPolicyRequest::update_mask].
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.0.request.update_mask = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::get_iam_policy][crate::client::VizierService::get_iam_policy] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::GetIamPolicy;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetIamPolicy {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetIamPolicy(RequestBuilder<google_cloud_iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::GetIamPolicyRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::Policy> {
(*self.0.stub)
.get_iam_policy(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::GetIamPolicyRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_options<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [options][google_cloud_iam_v1::model::GetIamPolicyRequest::options].
pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_iam_v1::model::GetPolicyOptions>,
{
self.0.request.options = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::test_iam_permissions][crate::client::VizierService::test_iam_permissions] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::TestIamPermissions;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> TestIamPermissions {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
RequestBuilder<google_cloud_iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_iam_v1::model::TestIamPermissionsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_iam_v1::model::TestIamPermissionsResponse> {
(*self.0.stub)
.test_iam_permissions(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [resource][google_cloud_iam_v1::model::TestIamPermissionsRequest::resource].
///
/// This is a **required** field for requests.
pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
/// Sets the value of [permissions][google_cloud_iam_v1::model::TestIamPermissionsRequest::permissions].
///
/// This is a **required** field for requests.
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
}
}
#[doc(hidden)]
impl crate::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::list_operations][crate::client::VizierService::list_operations] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::ListOperations;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
/// use google_cloud_gax::paginator::ItemPaginator;
///
/// let builder = prepare_request_builder();
/// let mut items = builder.by_item();
/// while let Some(result) = items.next().await {
/// let item = result?;
/// }
/// # Ok(()) }
///
/// fn prepare_request_builder() -> ListOperations {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct ListOperations(
RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
);
impl ListOperations {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
(*self.0.stub)
.list_operations(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Streams each page in the collection.
pub fn by_page(
self,
) -> impl google_cloud_gax::paginator::Paginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use std::clone::Clone;
let token = self.0.request.page_token.clone();
let execute = move |token: String| {
let mut builder = self.clone();
builder.0.request = builder.0.request.set_page_token(token);
builder.send()
};
google_cloud_gax::paginator::internal::new_paginator(token, execute)
}
/// Streams each item in the collection.
pub fn by_item(
self,
) -> impl google_cloud_gax::paginator::ItemPaginator<
google_cloud_longrunning::model::ListOperationsResponse,
crate::Error,
> {
use google_cloud_gax::paginator::Paginator;
self.by_page().items()
}
/// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
/// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
/// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
/// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
self.0.request.return_partial_success = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for ListOperations {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::get_operation][crate::client::VizierService::get_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::GetOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> GetOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
impl GetOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.get_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for GetOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::delete_operation][crate::client::VizierService::delete_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::DeleteOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> DeleteOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct DeleteOperation(
RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
);
impl DeleteOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.delete_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for DeleteOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::cancel_operation][crate::client::VizierService::cancel_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::CancelOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> CancelOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CancelOperation(
RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
);
impl CancelOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<()> {
(*self.0.stub)
.cancel_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for CancelOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
/// The request builder for [VizierService::wait_operation][crate::client::VizierService::wait_operation] calls.
///
/// # Example
/// ```
/// # use google_cloud_aiplatform_v1::builder::vizier_service::WaitOperation;
/// # async fn sample() -> google_cloud_aiplatform_v1::Result<()> {
///
/// let builder = prepare_request_builder();
/// let response = builder.send().await?;
/// # Ok(()) }
///
/// fn prepare_request_builder() -> WaitOperation {
/// # panic!();
/// // ... details omitted ...
/// }
/// ```
#[derive(Clone, Debug)]
pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
impl WaitOperation {
pub(crate) fn new(
stub: std::sync::Arc<dyn super::super::stub::dynamic::VizierService>,
) -> Self {
Self(RequestBuilder::new(stub))
}
/// Sets the full request, replacing any prior values.
pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
/// Sets all the options, replacing any prior values.
pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
self.0.options = v.into();
self
}
/// Sends the request.
pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
(*self.0.stub)
.wait_operation(self.0.request, self.0.options)
.await
.map(crate::Response::into_body)
}
/// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
/// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.0.request.timeout = v.map(|x| x.into());
self
}
}
#[doc(hidden)]
impl crate::RequestBuilder for WaitOperation {
fn request_options(&mut self) -> &mut crate::RequestOptions {
&mut self.0.options
}
}
}