#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReplicaInfo {
#[prost(string, tag = "1")]
pub location: ::prost::alloc::string::String,
#[prost(enumeration = "replica_info::ReplicaType", tag = "2")]
pub r#type: i32,
#[prost(bool, tag = "3")]
pub default_leader_location: bool,
}
pub mod replica_info {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ReplicaType {
TypeUnspecified = 0,
ReadWrite = 1,
ReadOnly = 2,
Witness = 3,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstanceConfig {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub replicas: ::prost::alloc::vec::Vec<ReplicaInfo>,
#[prost(string, repeated, tag = "4")]
pub leader_options: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Instance {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub config: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub display_name: ::prost::alloc::string::String,
#[prost(int32, tag = "5")]
pub node_count: i32,
#[prost(int32, tag = "9")]
pub processing_units: i32,
#[prost(enumeration = "instance::State", tag = "6")]
pub state: i32,
#[prost(map = "string, string", tag = "7")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(string, repeated, tag = "8")]
pub endpoint_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
pub mod instance {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
Unspecified = 0,
Creating = 1,
Ready = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListInstanceConfigsRequest {
#[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 ListInstanceConfigsResponse {
#[prost(message, repeated, tag = "1")]
pub instance_configs: ::prost::alloc::vec::Vec<InstanceConfig>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetInstanceConfigRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetInstanceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub field_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateInstanceRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub instance_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub instance: ::core::option::Option<Instance>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListInstancesRequest {
#[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,
#[prost(string, tag = "4")]
pub filter: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListInstancesResponse {
#[prost(message, repeated, tag = "1")]
pub instances: ::prost::alloc::vec::Vec<Instance>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateInstanceRequest {
#[prost(message, optional, tag = "1")]
pub instance: ::core::option::Option<Instance>,
#[prost(message, optional, tag = "2")]
pub field_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteInstanceRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateInstanceMetadata {
#[prost(message, optional, tag = "1")]
pub instance: ::core::option::Option<Instance>,
#[prost(message, optional, tag = "2")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateInstanceMetadata {
#[prost(message, optional, tag = "1")]
pub instance: ::core::option::Option<Instance>,
#[prost(message, optional, tag = "2")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub cancel_time: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub end_time: ::core::option::Option<::prost_types::Timestamp>,
}
#[doc = r" Generated client implementations."]
pub mod instance_admin_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Cloud Spanner Instance Admin API"]
#[doc = ""]
#[doc = " The Cloud Spanner Instance Admin API can be used to create, delete,"]
#[doc = " modify and list instances. Instances are dedicated Cloud Spanner serving"]
#[doc = " and storage resources to be used by Cloud Spanner databases."]
#[doc = ""]
#[doc = " Each instance has a \"configuration\", which dictates where the"]
#[doc = " serving resources for the Cloud Spanner instance are located (e.g.,"]
#[doc = " US-central, Europe). Configurations are created by Google based on"]
#[doc = " resource availability."]
#[doc = ""]
#[doc = " Cloud Spanner billing is based on the instances that exist and their"]
#[doc = " sizes. After an instance exists, there are no additional"]
#[doc = " per-database or per-operation charges for use of the instance"]
#[doc = " (though there may be additional network bandwidth charges)."]
#[doc = " Instances offer isolation: problems with databases in one instance"]
#[doc = " will not affect other instances. However, within an instance"]
#[doc = " databases can affect each other. For example, if one database in an"]
#[doc = " instance receives a lot of requests and consumes most of the"]
#[doc = " instance resources, fewer resources are available for other"]
#[doc = " databases in that instance, and their performance may suffer."]
#[derive(Debug, Clone)]
pub struct InstanceAdminClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> InstanceAdminClient<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,
) -> InstanceAdminClient<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,
{
InstanceAdminClient::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 the supported instance configurations for a given project."]
pub async fn list_instance_configs(
&mut self,
request: impl tonic::IntoRequest<super::ListInstanceConfigsRequest>,
) -> Result<tonic::Response<super::ListInstanceConfigsResponse>, 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.spanner.admin.instance.v1.InstanceAdmin/ListInstanceConfigs",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets information about a particular instance configuration."]
pub async fn get_instance_config(
&mut self,
request: impl tonic::IntoRequest<super::GetInstanceConfigRequest>,
) -> Result<tonic::Response<super::InstanceConfig>, 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.spanner.admin.instance.v1.InstanceAdmin/GetInstanceConfig",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Lists all instances in the given project."]
pub async fn list_instances(
&mut self,
request: impl tonic::IntoRequest<super::ListInstancesRequest>,
) -> Result<tonic::Response<super::ListInstancesResponse>, 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.spanner.admin.instance.v1.InstanceAdmin/ListInstances",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets information about a particular instance."]
pub async fn get_instance(
&mut self,
request: impl tonic::IntoRequest<super::GetInstanceRequest>,
) -> Result<tonic::Response<super::Instance>, 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.spanner.admin.instance.v1.InstanceAdmin/GetInstance",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Creates an instance and begins preparing it to begin serving. The"]
#[doc = " returned [long-running operation][google.longrunning.Operation]"]
#[doc = " can be used to track the progress of preparing the new"]
#[doc = " instance. The instance name is assigned by the caller. If the"]
#[doc = " named instance already exists, `CreateInstance` returns"]
#[doc = " `ALREADY_EXISTS`."]
#[doc = ""]
#[doc = " Immediately upon completion of this request:"]
#[doc = ""]
#[doc = " * The instance is readable via the API, with all requested attributes"]
#[doc = " but no allocated resources. Its state is `CREATING`."]
#[doc = ""]
#[doc = " Until completion of the returned operation:"]
#[doc = ""]
#[doc = " * Cancelling the operation renders the instance immediately unreadable"]
#[doc = " via the API."]
#[doc = " * The instance can be deleted."]
#[doc = " * All other attempts to modify the instance are rejected."]
#[doc = ""]
#[doc = " Upon completion of the returned operation:"]
#[doc = ""]
#[doc = " * Billing for all successfully-allocated resources begins (some types"]
#[doc = " may have lower than the requested levels)."]
#[doc = " * Databases can be created in the instance."]
#[doc = " * The instance's allocated resource levels are readable via the API."]
#[doc = " * The instance's state becomes `READY`."]
#[doc = ""]
#[doc = " The returned [long-running operation][google.longrunning.Operation] will"]
#[doc = " have a name of the format `<instance_name>/operations/<operation_id>` and"]
#[doc = " can be used to track creation of the instance. The"]
#[doc = " [metadata][google.longrunning.Operation.metadata] field type is"]
#[doc = " [CreateInstanceMetadata][google.spanner.admin.instance.v1.CreateInstanceMetadata]."]
#[doc = " The [response][google.longrunning.Operation.response] field type is"]
#[doc = " [Instance][google.spanner.admin.instance.v1.Instance], if successful."]
pub async fn create_instance(
&mut self,
request: impl tonic::IntoRequest<super::CreateInstanceRequest>,
) -> Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
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.spanner.admin.instance.v1.InstanceAdmin/CreateInstance",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates an instance, and begins allocating or releasing resources"]
#[doc = " as requested. The returned [long-running"]
#[doc = " operation][google.longrunning.Operation] can be used to track the"]
#[doc = " progress of updating the instance. If the named instance does not"]
#[doc = " exist, returns `NOT_FOUND`."]
#[doc = ""]
#[doc = " Immediately upon completion of this request:"]
#[doc = ""]
#[doc = " * For resource types for which a decrease in the instance's allocation"]
#[doc = " has been requested, billing is based on the newly-requested level."]
#[doc = ""]
#[doc = " Until completion of the returned operation:"]
#[doc = ""]
#[doc = " * Cancelling the operation sets its metadata's"]
#[doc = " [cancel_time][google.spanner.admin.instance.v1.UpdateInstanceMetadata.cancel_time], and begins"]
#[doc = " restoring resources to their pre-request values. The operation"]
#[doc = " is guaranteed to succeed at undoing all resource changes,"]
#[doc = " after which point it terminates with a `CANCELLED` status."]
#[doc = " * All other attempts to modify the instance are rejected."]
#[doc = " * Reading the instance via the API continues to give the pre-request"]
#[doc = " resource levels."]
#[doc = ""]
#[doc = " Upon completion of the returned operation:"]
#[doc = ""]
#[doc = " * Billing begins for all successfully-allocated resources (some types"]
#[doc = " may have lower than the requested levels)."]
#[doc = " * All newly-reserved resources are available for serving the instance's"]
#[doc = " tables."]
#[doc = " * The instance's new resource levels are readable via the API."]
#[doc = ""]
#[doc = " The returned [long-running operation][google.longrunning.Operation] will"]
#[doc = " have a name of the format `<instance_name>/operations/<operation_id>` and"]
#[doc = " can be used to track the instance modification. The"]
#[doc = " [metadata][google.longrunning.Operation.metadata] field type is"]
#[doc = " [UpdateInstanceMetadata][google.spanner.admin.instance.v1.UpdateInstanceMetadata]."]
#[doc = " The [response][google.longrunning.Operation.response] field type is"]
#[doc = " [Instance][google.spanner.admin.instance.v1.Instance], if successful."]
#[doc = ""]
#[doc = " Authorization requires `spanner.instances.update` permission on"]
#[doc = " resource [name][google.spanner.admin.instance.v1.Instance.name]."]
pub async fn update_instance(
&mut self,
request: impl tonic::IntoRequest<super::UpdateInstanceRequest>,
) -> Result<
tonic::Response<super::super::super::super::super::longrunning::Operation>,
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.spanner.admin.instance.v1.InstanceAdmin/UpdateInstance",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes an instance."]
#[doc = ""]
#[doc = " Immediately upon completion of the request:"]
#[doc = ""]
#[doc = " * Billing ceases for all of the instance's reserved resources."]
#[doc = ""]
#[doc = " Soon afterward:"]
#[doc = ""]
#[doc = " * The instance and *all of its databases* immediately and"]
#[doc = " irrevocably disappear from the API. All data in the databases"]
#[doc = " is permanently deleted."]
pub async fn delete_instance(
&mut self,
request: impl tonic::IntoRequest<super::DeleteInstanceRequest>,
) -> 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.spanner.admin.instance.v1.InstanceAdmin/DeleteInstance",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Sets the access control policy on an instance resource. Replaces any"]
#[doc = " existing policy."]
#[doc = ""]
#[doc = " Authorization requires `spanner.instances.setIamPolicy` on"]
#[doc = " [resource][google.iam.v1.SetIamPolicyRequest.resource]."]
pub async fn set_iam_policy(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::SetIamPolicyRequest,
>,
) -> Result<
tonic::Response<super::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.spanner.admin.instance.v1.InstanceAdmin/SetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the access control policy for an instance resource. Returns an empty"]
#[doc = " policy if an instance exists but does not have a policy set."]
#[doc = ""]
#[doc = " Authorization requires `spanner.instances.getIamPolicy` on"]
#[doc = " [resource][google.iam.v1.GetIamPolicyRequest.resource]."]
pub async fn get_iam_policy(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::GetIamPolicyRequest,
>,
) -> Result<
tonic::Response<super::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.spanner.admin.instance.v1.InstanceAdmin/GetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns permissions that the caller has on the specified instance resource."]
#[doc = ""]
#[doc = " Attempting this RPC on a non-existent Cloud Spanner instance resource will"]
#[doc = " result in a NOT_FOUND error if the user has `spanner.instances.list`"]
#[doc = " permission on the containing Google Cloud Project. Otherwise returns an"]
#[doc = " empty set of permissions."]
pub async fn test_iam_permissions(
&mut self,
request: impl tonic::IntoRequest<
super::super::super::super::super::iam::v1::TestIamPermissionsRequest,
>,
) -> Result<
tonic::Response<super::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.spanner.admin.instance.v1.InstanceAdmin/TestIamPermissions",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}