#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Secret {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub replication: ::core::option::Option<Replication>,
#[prost(message, optional, tag = "3")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(map = "string, string", tag = "4")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SecretVersion {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub destroy_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(enumeration = "secret_version::State", tag = "4")]
pub state: i32,
}
pub mod secret_version {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Enabled = 1,
Disabled = 2,
Destroyed = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Replication {
#[prost(oneof = "replication::Replication", tags = "1, 2")]
pub replication: ::core::option::Option<replication::Replication>,
}
pub mod replication {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Automatic {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UserManaged {
#[prost(message, repeated, tag = "1")]
pub replicas: ::prost::alloc::vec::Vec<user_managed::Replica>,
}
pub mod user_managed {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Replica {
#[prost(string, tag = "1")]
pub location: ::prost::alloc::string::String,
}
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Replication {
#[prost(message, tag = "1")]
Automatic(Automatic),
#[prost(message, tag = "2")]
UserManaged(UserManaged),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SecretPayload {
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSecretsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSecretsResponse {
#[prost(message, repeated, tag = "1")]
pub secrets: ::prost::alloc::vec::Vec<Secret>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub total_size: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateSecretRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub secret_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub secret: ::core::option::Option<Secret>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddSecretVersionRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub payload: ::core::option::Option<SecretPayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSecretRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSecretVersionsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSecretVersionsResponse {
#[prost(message, repeated, tag = "1")]
pub versions: ::prost::alloc::vec::Vec<SecretVersion>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub total_size: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSecretVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateSecretRequest {
#[prost(message, optional, tag = "1")]
pub secret: ::core::option::Option<Secret>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessSecretVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AccessSecretVersionResponse {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub payload: ::core::option::Option<SecretPayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteSecretRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DisableSecretVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnableSecretVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DestroySecretVersionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[doc = r" Generated client implementations."]
pub mod secret_manager_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Secret Manager Service"]
#[doc = ""]
#[doc = " Manages secrets and operations using those secrets. Implements a REST"]
#[doc = " model with the following objects:"]
#[doc = ""]
#[doc = " * [Secret][google.cloud.secrets.v1beta1.Secret]"]
#[doc = " * [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]"]
#[derive(Debug, Clone)]
pub struct SecretManagerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> SecretManagerServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SecretManagerServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
SecretManagerServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Lists [Secrets][google.cloud.secrets.v1beta1.Secret]."]
pub async fn list_secrets(
&mut self,
request: impl tonic::IntoRequest<super::ListSecretsRequest>,
) -> Result<tonic::Response<super::ListSecretsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/ListSecrets",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new [Secret][google.cloud.secrets.v1beta1.Secret] containing no [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion]."]
pub async fn create_secret(
&mut self,
request: impl tonic::IntoRequest<super::CreateSecretRequest>,
) -> Result<tonic::Response<super::Secret>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/CreateSecret",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates a new [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] containing secret data and attaches"]
#[doc = " it to an existing [Secret][google.cloud.secrets.v1beta1.Secret]."]
pub async fn add_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::AddSecretVersionRequest>,
) -> Result<tonic::Response<super::SecretVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/AddSecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets metadata for a given [Secret][google.cloud.secrets.v1beta1.Secret]."]
pub async fn get_secret(
&mut self,
request: impl tonic::IntoRequest<super::GetSecretRequest>,
) -> Result<tonic::Response<super::Secret>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/GetSecret",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates metadata of an existing [Secret][google.cloud.secrets.v1beta1.Secret]."]
pub async fn update_secret(
&mut self,
request: impl tonic::IntoRequest<super::UpdateSecretRequest>,
) -> Result<tonic::Response<super::Secret>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/UpdateSecret",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes a [Secret][google.cloud.secrets.v1beta1.Secret]."]
pub async fn delete_secret(
&mut self,
request: impl tonic::IntoRequest<super::DeleteSecretRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/DeleteSecret",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion]. This call does not return secret"]
#[doc = " data."]
pub async fn list_secret_versions(
&mut self,
request: impl tonic::IntoRequest<super::ListSecretVersionsRequest>,
) -> Result<tonic::Response<super::ListSecretVersionsResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/ListSecretVersions",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets metadata for a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
#[doc = ""]
#[doc = " `projects/*/secrets/*/versions/latest` is an alias to the `latest`"]
#[doc = " [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
pub async fn get_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::GetSecretVersionRequest>,
) -> Result<tonic::Response<super::SecretVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/GetSecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Accesses a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]. This call returns the secret data."]
#[doc = ""]
#[doc = " `projects/*/secrets/*/versions/latest` is an alias to the `latest`"]
#[doc = " [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
pub async fn access_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::AccessSecretVersionRequest>,
) -> Result<tonic::Response<super::AccessSecretVersionResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/AccessSecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Disables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
#[doc = ""]
#[doc = " Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to"]
#[doc = " [DISABLED][google.cloud.secrets.v1beta1.SecretVersion.State.DISABLED]."]
pub async fn disable_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::DisableSecretVersionRequest>,
) -> Result<tonic::Response<super::SecretVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/DisableSecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Enables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
#[doc = ""]
#[doc = " Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to"]
#[doc = " [ENABLED][google.cloud.secrets.v1beta1.SecretVersion.State.ENABLED]."]
pub async fn enable_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::EnableSecretVersionRequest>,
) -> Result<tonic::Response<super::SecretVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/EnableSecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Destroys a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]."]
#[doc = ""]
#[doc = " Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to"]
#[doc = " [DESTROYED][google.cloud.secrets.v1beta1.SecretVersion.State.DESTROYED] and irrevocably destroys the"]
#[doc = " secret data."]
pub async fn destroy_secret_version(
&mut self,
request: impl tonic::IntoRequest<super::DestroySecretVersionRequest>,
) -> Result<tonic::Response<super::SecretVersion>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/DestroySecretVersion",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Sets the access control policy on the specified secret. Replaces any"]
#[doc = " existing policy."]
#[doc = ""]
#[doc = " Permissions on [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion] are enforced according"]
#[doc = " to the policy set on the associated [Secret][google.cloud.secrets.v1beta1.Secret]."]
pub async fn set_iam_policy(
&mut self,
request: impl tonic::IntoRequest<super::super::super::super::iam::v1::SetIamPolicyRequest>,
) -> Result<tonic::Response<super::super::super::super::iam::v1::Policy>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/SetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the access control policy for a secret."]
#[doc = " Returns empty policy if the secret exists and does not have a policy set."]
pub async fn get_iam_policy(
&mut self,
request: impl tonic::IntoRequest<super::super::super::super::iam::v1::GetIamPolicyRequest>,
) -> Result<tonic::Response<super::super::super::super::iam::v1::Policy>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/GetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns permissions that a caller has for the specified secret."]
#[doc = " If the secret does not exist, this call returns an empty set of"]
#[doc = " permissions, not a NOT_FOUND error."]
#[doc = ""]
#[doc = " Note: This operation is designed to be used for building permission-aware"]
#[doc = " UIs and command-line tools, not for authorization checking. This operation"]
#[doc = " may \"fail open\" without warning."]
pub async fn test_iam_permissions(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::iam::v1::TestIamPermissionsRequest,
>,
) -> Result<
tonic::Response<super::super::super::super::iam::v1::TestIamPermissionsResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.secrets.v1beta1.SecretManagerService/TestIamPermissions",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}