#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleBindingScope {
#[prost(oneof = "role_binding_scope::Scope", tags = "1")]
pub scope: ::core::option::Option<role_binding_scope::Scope>,
}
pub mod role_binding_scope {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Scope {
#[prost(string, tag = "1")]
WorkspaceRid(::prost::alloc::string::String),
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RoleBindingScopeType {
Unspecified = 0,
Workspace = 1,
}
impl RoleBindingScopeType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "ROLE_BINDING_SCOPE_TYPE_UNSPECIFIED",
Self::Workspace => "ROLE_BINDING_SCOPE_TYPE_WORKSPACE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_BINDING_SCOPE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"ROLE_BINDING_SCOPE_TYPE_WORKSPACE" => Some(Self::Workspace),
_ => None,
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleBindingSubject {
#[prost(oneof = "role_binding_subject::Subject", tags = "1, 2")]
pub subject: ::core::option::Option<role_binding_subject::Subject>,
}
pub mod role_binding_subject {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Subject {
#[prost(string, tag = "1")]
UserRid(::prost::alloc::string::String),
#[prost(string, tag = "2")]
GroupRid(::prost::alloc::string::String),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleBindingKey {
#[prost(message, optional, tag = "1")]
pub scope: ::core::option::Option<RoleBindingScope>,
#[prost(string, tag = "2")]
pub role_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub subject: ::core::option::Option<RoleBindingSubject>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RoleBinding {
#[prost(message, optional, tag = "1")]
pub key: ::core::option::Option<RoleBindingKey>,
#[prost(string, tag = "2")]
pub granted_by: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub granted_at: ::core::option::Option<
super::super::super::super::google::protobuf::Timestamp,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateRoleBindingRequest {
#[prost(message, optional, tag = "1")]
pub role_binding: ::core::option::Option<RoleBinding>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateRoleBindingResponse {
#[prost(message, optional, tag = "1")]
pub role_binding: ::core::option::Option<RoleBinding>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRoleBindingsRequest {
#[prost(message, repeated, tag = "1")]
pub keys: ::prost::alloc::vec::Vec<RoleBindingKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRoleBindingsResponse {
#[prost(message, repeated, tag = "1")]
pub role_bindings: ::prost::alloc::vec::Vec<RoleBinding>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchRoleBindingsRequest {
#[prost(message, repeated, tag = "1")]
pub scopes: ::prost::alloc::vec::Vec<RoleBindingScope>,
#[prost(message, repeated, tag = "2")]
pub subjects: ::prost::alloc::vec::Vec<RoleBindingSubject>,
#[prost(string, optional, tag = "3")]
pub role_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, tag = "4")]
pub page_size: i32,
#[prost(string, tag = "5")]
pub page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchRoleBindingsResponse {
#[prost(message, repeated, tag = "1")]
pub role_bindings: ::prost::alloc::vec::Vec<RoleBinding>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRoleBindingRequest {
#[prost(message, optional, tag = "1")]
pub key: ::core::option::Option<RoleBindingKey>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteRoleBindingResponse {}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RoleBindingErrors {
ScopeNotFound = 0,
RoleNotFound = 1,
SubjectNotFound = 2,
ScopeTypeNotBindable = 3,
Unauthorized = 4,
RoleBindingNotFound = 5,
}
impl RoleBindingErrors {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ScopeNotFound => "ROLE_BINDING_ERRORS_SCOPE_NOT_FOUND",
Self::RoleNotFound => "ROLE_BINDING_ERRORS_ROLE_NOT_FOUND",
Self::SubjectNotFound => "ROLE_BINDING_ERRORS_SUBJECT_NOT_FOUND",
Self::ScopeTypeNotBindable => "ROLE_BINDING_ERRORS_SCOPE_TYPE_NOT_BINDABLE",
Self::Unauthorized => "ROLE_BINDING_ERRORS_UNAUTHORIZED",
Self::RoleBindingNotFound => "ROLE_BINDING_ERRORS_ROLE_BINDING_NOT_FOUND",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ROLE_BINDING_ERRORS_SCOPE_NOT_FOUND" => Some(Self::ScopeNotFound),
"ROLE_BINDING_ERRORS_ROLE_NOT_FOUND" => Some(Self::RoleNotFound),
"ROLE_BINDING_ERRORS_SUBJECT_NOT_FOUND" => Some(Self::SubjectNotFound),
"ROLE_BINDING_ERRORS_SCOPE_TYPE_NOT_BINDABLE" => {
Some(Self::ScopeTypeNotBindable)
}
"ROLE_BINDING_ERRORS_UNAUTHORIZED" => Some(Self::Unauthorized),
"ROLE_BINDING_ERRORS_ROLE_BINDING_NOT_FOUND" => {
Some(Self::RoleBindingNotFound)
}
_ => None,
}
}
}
pub mod role_binding_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct RoleBindingServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RoleBindingServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> RoleBindingServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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,
) -> RoleBindingServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
RoleBindingServiceClient::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
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn create_role_binding(
&mut self,
request: impl tonic::IntoRequest<super::CreateRoleBindingRequest>,
) -> std::result::Result<
tonic::Response<super::CreateRoleBindingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleBindingService/CreateRoleBinding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleBindingService",
"CreateRoleBinding",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn batch_get_role_bindings(
&mut self,
request: impl tonic::IntoRequest<super::BatchGetRoleBindingsRequest>,
) -> std::result::Result<
tonic::Response<super::BatchGetRoleBindingsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleBindingService/BatchGetRoleBindings",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleBindingService",
"BatchGetRoleBindings",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn search_role_bindings(
&mut self,
request: impl tonic::IntoRequest<super::SearchRoleBindingsRequest>,
) -> std::result::Result<
tonic::Response<super::SearchRoleBindingsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleBindingService/SearchRoleBindings",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleBindingService",
"SearchRoleBindings",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_role_binding(
&mut self,
request: impl tonic::IntoRequest<super::DeleteRoleBindingRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteRoleBindingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleBindingService/DeleteRoleBinding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleBindingService",
"DeleteRoleBinding",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Role {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub display_name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "4")]
pub actions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "RoleBindingScopeType", repeated, packed = "false", tag = "5")]
pub bindable_scope_types: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRolesRequest {
#[prost(int32, tag = "1")]
pub page_size: i32,
#[prost(string, tag = "2")]
pub page_token: ::prost::alloc::string::String,
#[prost(enumeration = "RoleBindingScopeType", optional, tag = "3")]
pub scope_type: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRolesResponse {
#[prost(message, repeated, tag = "1")]
pub roles: ::prost::alloc::vec::Vec<Role>,
#[prost(string, tag = "2")]
pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRolesRequest {
#[prost(string, repeated, tag = "1")]
pub role_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRolesResponse {
#[prost(message, repeated, tag = "1")]
pub roles: ::prost::alloc::vec::Vec<Role>,
}
pub mod role_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct RoleServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl RoleServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> RoleServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::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,
) -> RoleServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
RoleServiceClient::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
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn batch_get_roles(
&mut self,
request: impl tonic::IntoRequest<super::BatchGetRolesRequest>,
) -> std::result::Result<
tonic::Response<super::BatchGetRolesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleService/BatchGetRoles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleService",
"BatchGetRoles",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_roles(
&mut self,
request: impl tonic::IntoRequest<super::ListRolesRequest>,
) -> std::result::Result<
tonic::Response<super::ListRolesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/nominal.authorization.rbac.v1.RoleService/ListRoles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.authorization.rbac.v1.RoleService",
"ListRoles",
),
);
self.inner.unary(req, path, codec).await
}
}
}