gcp_sdk_secretmanager_v1/
builders.rsuse crate::Result;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct SecretManagerServiceRequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> SecretManagerServiceRequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListSecrets(SecretManagerServiceRequestBuilder<crate::model::ListSecretsRequest>);
impl ListSecrets {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListSecretsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListSecretsResponse> {
self.0
.stub
.list_secrets(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListSecretsResponse, gax::error::Error> {
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_filter<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
impl gax::options::RequestBuilder for ListSecrets {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct CreateSecret(SecretManagerServiceRequestBuilder<crate::model::CreateSecretRequest>);
impl CreateSecret {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::CreateSecretRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Secret> {
self.0
.stub
.create_secret(self.0.request, self.0.options)
.await
}
pub fn set_parent<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_secret_id<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.secret_id = v.into();
self
}
pub fn set_secret<T: Into<Option<crate::model::Secret>>>(mut self, v: T) -> Self {
self.0.request.secret = v.into();
self
}
}
impl gax::options::RequestBuilder for CreateSecret {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct AddSecretVersion(
SecretManagerServiceRequestBuilder<crate::model::AddSecretVersionRequest>,
);
impl AddSecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::AddSecretVersionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SecretVersion> {
self.0
.stub
.add_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_parent<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_payload<T: Into<Option<crate::model::SecretPayload>>>(mut self, v: T) -> Self {
self.0.request.payload = v.into();
self
}
}
impl gax::options::RequestBuilder for AddSecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetSecret(SecretManagerServiceRequestBuilder<crate::model::GetSecretRequest>);
impl GetSecret {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetSecretRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Secret> {
self.0.stub.get_secret(self.0.request, self.0.options).await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetSecret {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct UpdateSecret(SecretManagerServiceRequestBuilder<crate::model::UpdateSecretRequest>);
impl UpdateSecret {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::UpdateSecretRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::Secret> {
self.0
.stub
.update_secret(self.0.request, self.0.options)
.await
}
pub fn set_secret<T: Into<Option<crate::model::Secret>>>(mut self, v: T) -> Self {
self.0.request.secret = v.into();
self
}
pub fn set_update_mask<T: Into<Option<wkt::FieldMask>>>(mut self, v: T) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for UpdateSecret {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DeleteSecret(SecretManagerServiceRequestBuilder<crate::model::DeleteSecretRequest>);
impl DeleteSecret {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DeleteSecretRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<wkt::Empty> {
self.0
.stub
.delete_secret(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_etag<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for DeleteSecret {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct ListSecretVersions(
SecretManagerServiceRequestBuilder<crate::model::ListSecretVersionsRequest>,
);
impl ListSecretVersions {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::ListSecretVersionsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::ListSecretVersionsResponse> {
self.0
.stub
.list_secret_versions(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<crate::model::ListSecretVersionsResponse, gax::error::Error>
{
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_parent<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.parent = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
pub fn set_filter<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
}
impl gax::options::RequestBuilder for ListSecretVersions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetSecretVersion(
SecretManagerServiceRequestBuilder<crate::model::GetSecretVersionRequest>,
);
impl GetSecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::GetSecretVersionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SecretVersion> {
self.0
.stub
.get_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetSecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct AccessSecretVersion(
SecretManagerServiceRequestBuilder<crate::model::AccessSecretVersionRequest>,
);
impl AccessSecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::AccessSecretVersionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::AccessSecretVersionResponse> {
self.0
.stub
.access_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for AccessSecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DisableSecretVersion(
SecretManagerServiceRequestBuilder<crate::model::DisableSecretVersionRequest>,
);
impl DisableSecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DisableSecretVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SecretVersion> {
self.0
.stub
.disable_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_etag<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for DisableSecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct EnableSecretVersion(
SecretManagerServiceRequestBuilder<crate::model::EnableSecretVersionRequest>,
);
impl EnableSecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::EnableSecretVersionRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SecretVersion> {
self.0
.stub
.enable_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_etag<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for EnableSecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct DestroySecretVersion(
SecretManagerServiceRequestBuilder<crate::model::DestroySecretVersionRequest>,
);
impl DestroySecretVersion {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<crate::model::DestroySecretVersionRequest>>(
mut self,
v: V,
) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<crate::model::SecretVersion> {
self.0
.stub
.destroy_secret_version(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_etag<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.etag = v.into();
self
}
}
impl gax::options::RequestBuilder for DestroySecretVersion {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct SetIamPolicy(SecretManagerServiceRequestBuilder<iam_v1::model::SetIamPolicyRequest>);
impl SetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
self.0
.stub
.set_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_policy<T: Into<Option<iam_v1::model::Policy>>>(mut self, v: T) -> Self {
self.0.request.policy = v.into();
self
}
pub fn set_update_mask<T: Into<Option<wkt::FieldMask>>>(mut self, v: T) -> Self {
self.0.request.update_mask = v.into();
self
}
}
impl gax::options::RequestBuilder for SetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetIamPolicy(SecretManagerServiceRequestBuilder<iam_v1::model::GetIamPolicyRequest>);
impl GetIamPolicy {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::Policy> {
self.0
.stub
.get_iam_policy(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_options<T: Into<Option<iam_v1::model::GetPolicyOptions>>>(mut self, v: T) -> Self {
self.0.request.options = v.into();
self
}
}
impl gax::options::RequestBuilder for GetIamPolicy {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct TestIamPermissions(
SecretManagerServiceRequestBuilder<iam_v1::model::TestIamPermissionsRequest>,
);
impl TestIamPermissions {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::SecretManagerService>) -> Self {
Self(SecretManagerServiceRequestBuilder::new(stub))
}
pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
self.0
.stub
.test_iam_permissions(self.0.request, self.0.options)
.await
}
pub fn set_resource<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.resource = v.into();
self
}
pub fn set_permissions<T: Into<Vec<String>>>(mut self, v: T) -> Self {
self.0.request.permissions = v.into();
self
}
}
impl gax::options::RequestBuilder for TestIamPermissions {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct LocationsRequestBuilder<R: std::default::Default> {
stub: Arc<dyn crate::traits::dyntraits::Locations>,
request: R,
options: gax::options::RequestOptions,
}
impl<R> LocationsRequestBuilder<R>
where
R: std::default::Default,
{
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::Locations>) -> Self {
Self {
stub,
request: R::default(),
options: gax::options::RequestOptions::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct ListLocations(LocationsRequestBuilder<location::model::ListLocationsRequest>);
impl ListLocations {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::Locations>) -> Self {
Self(LocationsRequestBuilder::new(stub))
}
pub fn with_request<V: Into<location::model::ListLocationsRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
self.0
.stub
.list_locations(self.0.request, self.0.options)
.await
}
#[cfg(feature = "unstable-stream")]
pub async fn stream(
self,
) -> gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error> {
let token = gax::paginator::extract_token(&self.0.request.page_token);
let execute = move |token: String| {
let builder = self.clone();
builder.0.request.clone().set_page_token(token);
builder.send()
};
gax::paginator::Paginator::new(token, execute)
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
pub fn set_filter<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.filter = v.into();
self
}
pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
self.0.request.page_size = v.into();
self
}
pub fn set_page_token<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.page_token = v.into();
self
}
}
impl gax::options::RequestBuilder for ListLocations {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}
#[derive(Clone, Debug)]
pub struct GetLocation(LocationsRequestBuilder<location::model::GetLocationRequest>);
impl GetLocation {
pub(crate) fn new(stub: Arc<dyn crate::traits::dyntraits::Locations>) -> Self {
Self(LocationsRequestBuilder::new(stub))
}
pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
self.0.request = v.into();
self
}
pub async fn send(self) -> Result<location::model::Location> {
self.0
.stub
.get_location(self.0.request, self.0.options)
.await
}
pub fn set_name<T: Into<String>>(mut self, v: T) -> Self {
self.0.request.name = v.into();
self
}
}
impl gax::options::RequestBuilder for GetLocation {
fn request_options(&mut self) -> &mut gax::options::RequestOptions {
&mut self.0.options
}
}