#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateConnectionRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub connection_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub connection: ::core::option::Option<Connection>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConnectionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConnectionsRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub page_size: i32,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListConnectionsResponse {
#[prost(string, tag = "1")]
pub next_page_token: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub connections: ::prost::alloc::vec::Vec<Connection>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateConnectionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub connection: ::core::option::Option<Connection>,
#[prost(message, optional, tag = "3")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteConnectionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Connection {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub friendly_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(int64, tag = "5")]
pub creation_time: i64,
#[prost(int64, tag = "6")]
pub last_modified_time: i64,
#[prost(bool, tag = "7")]
pub has_credential: bool,
#[prost(oneof = "connection::Properties", tags = "4, 8, 21")]
pub properties: ::core::option::Option<connection::Properties>,
}
pub mod connection {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Properties {
#[prost(message, tag = "4")]
CloudSql(super::CloudSqlProperties),
#[prost(message, tag = "8")]
Aws(super::AwsProperties),
#[prost(message, tag = "21")]
CloudSpanner(super::CloudSpannerProperties),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloudSqlProperties {
#[prost(string, tag = "1")]
pub instance_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub database: ::prost::alloc::string::String,
#[prost(enumeration = "cloud_sql_properties::DatabaseType", tag = "3")]
pub r#type: i32,
#[prost(message, optional, tag = "4")]
pub credential: ::core::option::Option<CloudSqlCredential>,
}
pub mod cloud_sql_properties {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DatabaseType {
Unspecified = 0,
Postgres = 1,
Mysql = 2,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloudSqlCredential {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloudSpannerProperties {
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub use_parallelism: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AwsProperties {
#[prost(oneof = "aws_properties::AuthenticationMethod", tags = "2, 3")]
pub authentication_method: ::core::option::Option<aws_properties::AuthenticationMethod>,
}
pub mod aws_properties {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum AuthenticationMethod {
#[prost(message, tag = "2")]
CrossAccountRole(super::AwsCrossAccountRole),
#[prost(message, tag = "3")]
AccessRole(super::AwsAccessRole),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AwsCrossAccountRole {
#[prost(string, tag = "1")]
pub iam_role_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub iam_user_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub external_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AwsAccessRole {
#[prost(string, tag = "1")]
pub iam_role_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub identity: ::prost::alloc::string::String,
}
#[doc = r" Generated client implementations."]
pub mod connection_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Manages external data source connections and credentials."]
#[derive(Debug, Clone)]
pub struct ConnectionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> ConnectionServiceClient<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,
) -> ConnectionServiceClient<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,
{
ConnectionServiceClient::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 = " Creates a new connection."]
pub async fn create_connection(
&mut self,
request: impl tonic::IntoRequest<super::CreateConnectionRequest>,
) -> Result<tonic::Response<super::Connection>, 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.bigquery.connection.v1.ConnectionService/CreateConnection",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns specified connection."]
pub async fn get_connection(
&mut self,
request: impl tonic::IntoRequest<super::GetConnectionRequest>,
) -> Result<tonic::Response<super::Connection>, 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.bigquery.connection.v1.ConnectionService/GetConnection",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns a list of connections in the given project."]
pub async fn list_connections(
&mut self,
request: impl tonic::IntoRequest<super::ListConnectionsRequest>,
) -> Result<tonic::Response<super::ListConnectionsResponse>, 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.bigquery.connection.v1.ConnectionService/ListConnections",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Updates the specified connection. For security reasons, also resets"]
#[doc = " credential if connection properties are in the update field mask."]
pub async fn update_connection(
&mut self,
request: impl tonic::IntoRequest<super::UpdateConnectionRequest>,
) -> Result<tonic::Response<super::Connection>, 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.bigquery.connection.v1.ConnectionService/UpdateConnection",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Deletes connection and associated credential."]
pub async fn delete_connection(
&mut self,
request: impl tonic::IntoRequest<super::DeleteConnectionRequest>,
) -> 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.bigquery.connection.v1.ConnectionService/DeleteConnection",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the access control policy for a resource."]
#[doc = " Returns an empty policy if the resource exists and does not have a policy"]
#[doc = " set."]
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.cloud.bigquery.connection.v1.ConnectionService/GetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Sets the access control policy on the specified resource. Replaces any"]
#[doc = " existing policy."]
#[doc = ""]
#[doc = " Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors."]
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.cloud.bigquery.connection.v1.ConnectionService/SetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Returns permissions that a caller has on the specified resource."]
#[doc = " If the resource does not exist, this will return 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::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.cloud.bigquery.connection.v1.ConnectionService/TestIamPermissions",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}