#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDataPolicyRequest {
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub data_policy: ::core::option::Option<DataPolicy>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateDataPolicyRequest {
#[prost(message, optional, tag = "1")]
pub data_policy: ::core::option::Option<DataPolicy>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RenameDataPolicyRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub new_data_policy_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteDataPolicyRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDataPolicyRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDataPoliciesRequest {
#[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,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDataPoliciesResponse {
#[prost(message, repeated, tag = "1")]
pub data_policies: ::prost::alloc::vec::Vec<DataPolicy>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataPolicy {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "data_policy::DataPolicyType", tag = "2")]
pub data_policy_type: i32,
#[prost(string, tag = "3")]
pub data_policy_id: ::prost::alloc::string::String,
#[prost(oneof = "data_policy::MatchingLabel", tags = "4")]
pub matching_label: ::core::option::Option<data_policy::MatchingLabel>,
#[prost(oneof = "data_policy::Policy", tags = "5")]
pub policy: ::core::option::Option<data_policy::Policy>,
}
pub mod data_policy {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum DataPolicyType {
Unspecified = 0,
ColumnLevelSecurityPolicy = 3,
DataMaskingPolicy = 2,
}
impl DataPolicyType {
pub fn as_str_name(&self) -> &'static str {
match self {
DataPolicyType::Unspecified => "DATA_POLICY_TYPE_UNSPECIFIED",
DataPolicyType::ColumnLevelSecurityPolicy => {
"COLUMN_LEVEL_SECURITY_POLICY"
}
DataPolicyType::DataMaskingPolicy => "DATA_MASKING_POLICY",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DATA_POLICY_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"COLUMN_LEVEL_SECURITY_POLICY" => Some(Self::ColumnLevelSecurityPolicy),
"DATA_MASKING_POLICY" => Some(Self::DataMaskingPolicy),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum MatchingLabel {
#[prost(string, tag = "4")]
PolicyTag(::prost::alloc::string::String),
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Policy {
#[prost(message, tag = "5")]
DataMaskingPolicy(super::DataMaskingPolicy),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DataMaskingPolicy {
#[prost(oneof = "data_masking_policy::MaskingExpression", tags = "1")]
pub masking_expression: ::core::option::Option<
data_masking_policy::MaskingExpression,
>,
}
pub mod data_masking_policy {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PredefinedExpression {
Unspecified = 0,
Sha256 = 3,
AlwaysNull = 5,
DefaultMaskingValue = 7,
}
impl PredefinedExpression {
pub fn as_str_name(&self) -> &'static str {
match self {
PredefinedExpression::Unspecified => "PREDEFINED_EXPRESSION_UNSPECIFIED",
PredefinedExpression::Sha256 => "SHA256",
PredefinedExpression::AlwaysNull => "ALWAYS_NULL",
PredefinedExpression::DefaultMaskingValue => "DEFAULT_MASKING_VALUE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PREDEFINED_EXPRESSION_UNSPECIFIED" => Some(Self::Unspecified),
"SHA256" => Some(Self::Sha256),
"ALWAYS_NULL" => Some(Self::AlwaysNull),
"DEFAULT_MASKING_VALUE" => Some(Self::DefaultMaskingValue),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum MaskingExpression {
#[prost(enumeration = "PredefinedExpression", tag = "1")]
PredefinedExpression(i32),
}
}
pub mod data_policy_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct DataPolicyServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DataPolicyServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DataPolicyServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<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_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> DataPolicyServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
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,
{
DataPolicyServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
pub async fn create_data_policy(
&mut self,
request: impl tonic::IntoRequest<super::CreateDataPolicyRequest>,
) -> Result<tonic::Response<super::DataPolicy>, 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.datapolicies.v1.DataPolicyService/CreateDataPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn update_data_policy(
&mut self,
request: impl tonic::IntoRequest<super::UpdateDataPolicyRequest>,
) -> Result<tonic::Response<super::DataPolicy>, 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.datapolicies.v1.DataPolicyService/UpdateDataPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn rename_data_policy(
&mut self,
request: impl tonic::IntoRequest<super::RenameDataPolicyRequest>,
) -> Result<tonic::Response<super::DataPolicy>, 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.datapolicies.v1.DataPolicyService/RenameDataPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn delete_data_policy(
&mut self,
request: impl tonic::IntoRequest<super::DeleteDataPolicyRequest>,
) -> 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.datapolicies.v1.DataPolicyService/DeleteDataPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn get_data_policy(
&mut self,
request: impl tonic::IntoRequest<super::GetDataPolicyRequest>,
) -> Result<tonic::Response<super::DataPolicy>, 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.datapolicies.v1.DataPolicyService/GetDataPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
pub async fn list_data_policies(
&mut self,
request: impl tonic::IntoRequest<super::ListDataPoliciesRequest>,
) -> Result<tonic::Response<super::ListDataPoliciesResponse>, 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.datapolicies.v1.DataPolicyService/ListDataPolicies",
);
self.inner.unary(request.into_request(), path, codec).await
}
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.datapolicies.v1.DataPolicyService/GetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
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.datapolicies.v1.DataPolicyService/SetIamPolicy",
);
self.inner.unary(request.into_request(), path, codec).await
}
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.datapolicies.v1.DataPolicyService/TestIamPermissions",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}