nominal-api-proto 0.1340.1

Protobuf/gRPC API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceShareKey {
    #[prost(string, tag = "1")]
    pub resource_rid: ::prost::alloc::string::String,
    #[prost(enumeration = "ResourceShareRole", tag = "2")]
    pub role: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceShare {
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<ResourceShareKey>,
    #[prost(message, repeated, tag = "2")]
    pub subjects: ::prost::alloc::vec::Vec<resource_share::ShareSubject>,
    #[prost(message, optional, tag = "3")]
    pub related_grants: ::core::option::Option<resource_share::RelatedResourceGrants>,
    #[prost(string, tag = "4")]
    pub last_updated_by: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "5")]
    pub last_updated_at: ::core::option::Option<
        super::super::super::super::google::protobuf::Timestamp,
    >,
}
/// Nested message and enum types in `ResourceShare`.
pub mod resource_share {
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ShareSubject {
        #[prost(oneof = "share_subject::Subject", tags = "1")]
        pub subject: ::core::option::Option<share_subject::Subject>,
    }
    /// Nested message and enum types in `ShareSubject`.
    pub mod share_subject {
        #[derive(Clone, PartialEq, ::prost::Oneof)]
        pub enum Subject {
            #[prost(string, tag = "1")]
            UserRid(::prost::alloc::string::String),
        }
    }
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct RelatedResourceGrants {
        #[prost(message, repeated, tag = "1")]
        pub run_grants: ::prost::alloc::vec::Vec<super::RunGrant>,
        #[prost(message, repeated, tag = "2")]
        pub asset_grants: ::prost::alloc::vec::Vec<super::AssetGrant>,
        #[prost(message, repeated, tag = "3")]
        pub datasource_grants: ::prost::alloc::vec::Vec<super::DatasourceGrant>,
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RunGrant {
    #[prost(string, tag = "1")]
    pub rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssetGrant {
    #[prost(string, tag = "1")]
    pub rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatasourceGrant {
    #[prost(string, tag = "1")]
    pub rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateResourceShareRequest {
    #[prost(message, optional, tag = "1")]
    pub resource_share: ::core::option::Option<ResourceShare>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateResourceShareResponse {
    #[prost(message, optional, tag = "1")]
    pub resource_share: ::core::option::Option<ResourceShare>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetResourceSharesRequest {
    #[prost(message, repeated, tag = "1")]
    pub keys: ::prost::alloc::vec::Vec<ResourceShareKey>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetResourceSharesResponse {
    #[prost(message, repeated, tag = "1")]
    pub resource_shares: ::prost::alloc::vec::Vec<ResourceShare>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListResourceSharesRequest {
    #[prost(string, tag = "1")]
    pub resource_rid: ::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 ListResourceSharesResponse {
    #[prost(message, repeated, tag = "1")]
    pub resource_shares: ::prost::alloc::vec::Vec<ResourceShare>,
    #[prost(string, tag = "2")]
    pub next_page_token: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteResourceShareRequest {
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<ResourceShareKey>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DeleteResourceShareResponse {}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResourceShareRole {
    Unspecified = 0,
    Viewer = 1,
}
impl ResourceShareRole {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "RESOURCE_SHARE_ROLE_UNSPECIFIED",
            Self::Viewer => "RESOURCE_SHARE_ROLE_VIEWER",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "RESOURCE_SHARE_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
            "RESOURCE_SHARE_ROLE_VIEWER" => Some(Self::Viewer),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod resource_share_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 ResourceShareServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ResourceShareServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        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> ResourceShareServiceClient<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,
        ) -> ResourceShareServiceClient<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,
        {
            ResourceShareServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[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_resource_share(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateResourceShareRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CreateResourceShareResponse>,
            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.resources.v1.ResourceShareService/CreateResourceShare",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.authorization.resources.v1.ResourceShareService",
                        "CreateResourceShare",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn batch_get_resource_shares(
            &mut self,
            request: impl tonic::IntoRequest<super::BatchGetResourceSharesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::BatchGetResourceSharesResponse>,
            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.resources.v1.ResourceShareService/BatchGetResourceShares",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.authorization.resources.v1.ResourceShareService",
                        "BatchGetResourceShares",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn list_resource_shares(
            &mut self,
            request: impl tonic::IntoRequest<super::ListResourceSharesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListResourceSharesResponse>,
            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.resources.v1.ResourceShareService/ListResourceShares",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.authorization.resources.v1.ResourceShareService",
                        "ListResourceShares",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn delete_resource_share(
            &mut self,
            request: impl tonic::IntoRequest<super::DeleteResourceShareRequest>,
        ) -> std::result::Result<
            tonic::Response<super::DeleteResourceShareResponse>,
            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.resources.v1.ResourceShareService/DeleteResourceShare",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.authorization.resources.v1.ResourceShareService",
                        "DeleteResourceShare",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}