Skip to main content

nominal_api_proto/proto/
nominal.authorization.resources.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ResourceShareKey {
4    #[prost(string, tag = "1")]
5    pub resource_rid: ::prost::alloc::string::String,
6    #[prost(enumeration = "ResourceShareRole", tag = "2")]
7    pub role: i32,
8}
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct ResourceShare {
11    #[prost(message, optional, tag = "1")]
12    pub key: ::core::option::Option<ResourceShareKey>,
13    #[prost(message, repeated, tag = "2")]
14    pub subjects: ::prost::alloc::vec::Vec<resource_share::ShareSubject>,
15    #[prost(message, optional, tag = "3")]
16    pub related_grants: ::core::option::Option<resource_share::RelatedResourceGrants>,
17    #[prost(string, tag = "4")]
18    pub last_updated_by: ::prost::alloc::string::String,
19    #[prost(message, optional, tag = "5")]
20    pub last_updated_at: ::core::option::Option<
21        super::super::super::super::google::protobuf::Timestamp,
22    >,
23}
24/// Nested message and enum types in `ResourceShare`.
25pub mod resource_share {
26    #[derive(Clone, PartialEq, ::prost::Message)]
27    pub struct ShareSubject {
28        #[prost(oneof = "share_subject::Subject", tags = "1")]
29        pub subject: ::core::option::Option<share_subject::Subject>,
30    }
31    /// Nested message and enum types in `ShareSubject`.
32    pub mod share_subject {
33        #[derive(Clone, PartialEq, ::prost::Oneof)]
34        pub enum Subject {
35            #[prost(string, tag = "1")]
36            UserRid(::prost::alloc::string::String),
37        }
38    }
39    #[derive(Clone, PartialEq, ::prost::Message)]
40    pub struct RelatedResourceGrants {
41        #[prost(message, repeated, tag = "1")]
42        pub run_grants: ::prost::alloc::vec::Vec<super::RunGrant>,
43        #[prost(message, repeated, tag = "2")]
44        pub asset_grants: ::prost::alloc::vec::Vec<super::AssetGrant>,
45        #[prost(message, repeated, tag = "3")]
46        pub datasource_grants: ::prost::alloc::vec::Vec<super::DatasourceGrant>,
47    }
48}
49#[derive(Clone, PartialEq, ::prost::Message)]
50pub struct RunGrant {
51    #[prost(string, tag = "1")]
52    pub rid: ::prost::alloc::string::String,
53}
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct AssetGrant {
56    #[prost(string, tag = "1")]
57    pub rid: ::prost::alloc::string::String,
58}
59#[derive(Clone, PartialEq, ::prost::Message)]
60pub struct DatasourceGrant {
61    #[prost(string, tag = "1")]
62    pub rid: ::prost::alloc::string::String,
63}
64#[derive(Clone, PartialEq, ::prost::Message)]
65pub struct CreateResourceShareRequest {
66    #[prost(message, optional, tag = "1")]
67    pub resource_share: ::core::option::Option<ResourceShare>,
68}
69#[derive(Clone, PartialEq, ::prost::Message)]
70pub struct CreateResourceShareResponse {
71    #[prost(message, optional, tag = "1")]
72    pub resource_share: ::core::option::Option<ResourceShare>,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct BatchGetResourceSharesRequest {
76    #[prost(message, repeated, tag = "1")]
77    pub keys: ::prost::alloc::vec::Vec<ResourceShareKey>,
78}
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct BatchGetResourceSharesResponse {
81    #[prost(message, repeated, tag = "1")]
82    pub resource_shares: ::prost::alloc::vec::Vec<ResourceShare>,
83}
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct ListResourceSharesRequest {
86    #[prost(string, tag = "1")]
87    pub resource_rid: ::prost::alloc::string::String,
88    #[prost(int32, tag = "2")]
89    pub page_size: i32,
90    #[prost(string, tag = "3")]
91    pub page_token: ::prost::alloc::string::String,
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct ListResourceSharesResponse {
95    #[prost(message, repeated, tag = "1")]
96    pub resource_shares: ::prost::alloc::vec::Vec<ResourceShare>,
97    #[prost(string, tag = "2")]
98    pub next_page_token: ::prost::alloc::string::String,
99}
100#[derive(Clone, PartialEq, ::prost::Message)]
101pub struct DeleteResourceShareRequest {
102    #[prost(message, optional, tag = "1")]
103    pub key: ::core::option::Option<ResourceShareKey>,
104}
105#[derive(Clone, Copy, PartialEq, ::prost::Message)]
106pub struct DeleteResourceShareResponse {}
107#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
108#[repr(i32)]
109pub enum ResourceShareRole {
110    Unspecified = 0,
111    Viewer = 1,
112}
113impl ResourceShareRole {
114    /// String value of the enum field names used in the ProtoBuf definition.
115    ///
116    /// The values are not transformed in any way and thus are considered stable
117    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
118    pub fn as_str_name(&self) -> &'static str {
119        match self {
120            Self::Unspecified => "RESOURCE_SHARE_ROLE_UNSPECIFIED",
121            Self::Viewer => "RESOURCE_SHARE_ROLE_VIEWER",
122        }
123    }
124    /// Creates an enum from field names used in the ProtoBuf definition.
125    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
126        match value {
127            "RESOURCE_SHARE_ROLE_UNSPECIFIED" => Some(Self::Unspecified),
128            "RESOURCE_SHARE_ROLE_VIEWER" => Some(Self::Viewer),
129            _ => None,
130        }
131    }
132}
133/// Generated client implementations.
134pub mod resource_share_service_client {
135    #![allow(
136        unused_variables,
137        dead_code,
138        missing_docs,
139        clippy::wildcard_imports,
140        clippy::let_unit_value,
141    )]
142    use tonic::codegen::*;
143    use tonic::codegen::http::Uri;
144    #[derive(Debug, Clone)]
145    pub struct ResourceShareServiceClient<T> {
146        inner: tonic::client::Grpc<T>,
147    }
148    impl ResourceShareServiceClient<tonic::transport::Channel> {
149        /// Attempt to create a new client by connecting to a given endpoint.
150        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
151        where
152            D: TryInto<tonic::transport::Endpoint>,
153            D::Error: Into<StdError>,
154        {
155            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
156            Ok(Self::new(conn))
157        }
158    }
159    impl<T> ResourceShareServiceClient<T>
160    where
161        T: tonic::client::GrpcService<tonic::body::Body>,
162        T::Error: Into<StdError>,
163        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
164        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
165    {
166        pub fn new(inner: T) -> Self {
167            let inner = tonic::client::Grpc::new(inner);
168            Self { inner }
169        }
170        pub fn with_origin(inner: T, origin: Uri) -> Self {
171            let inner = tonic::client::Grpc::with_origin(inner, origin);
172            Self { inner }
173        }
174        pub fn with_interceptor<F>(
175            inner: T,
176            interceptor: F,
177        ) -> ResourceShareServiceClient<InterceptedService<T, F>>
178        where
179            F: tonic::service::Interceptor,
180            T::ResponseBody: Default,
181            T: tonic::codegen::Service<
182                http::Request<tonic::body::Body>,
183                Response = http::Response<
184                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
185                >,
186            >,
187            <T as tonic::codegen::Service<
188                http::Request<tonic::body::Body>,
189            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
190        {
191            ResourceShareServiceClient::new(InterceptedService::new(inner, interceptor))
192        }
193        /// Compress requests with the given encoding.
194        ///
195        /// This requires the server to support it otherwise it might respond with an
196        /// error.
197        #[must_use]
198        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
199            self.inner = self.inner.send_compressed(encoding);
200            self
201        }
202        /// Enable decompressing responses.
203        #[must_use]
204        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
205            self.inner = self.inner.accept_compressed(encoding);
206            self
207        }
208        /// Limits the maximum size of a decoded message.
209        ///
210        /// Default: `4MB`
211        #[must_use]
212        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
213            self.inner = self.inner.max_decoding_message_size(limit);
214            self
215        }
216        /// Limits the maximum size of an encoded message.
217        ///
218        /// Default: `usize::MAX`
219        #[must_use]
220        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
221            self.inner = self.inner.max_encoding_message_size(limit);
222            self
223        }
224        pub async fn create_resource_share(
225            &mut self,
226            request: impl tonic::IntoRequest<super::CreateResourceShareRequest>,
227        ) -> std::result::Result<
228            tonic::Response<super::CreateResourceShareResponse>,
229            tonic::Status,
230        > {
231            self.inner
232                .ready()
233                .await
234                .map_err(|e| {
235                    tonic::Status::unknown(
236                        format!("Service was not ready: {}", e.into()),
237                    )
238                })?;
239            let codec = tonic::codec::ProstCodec::default();
240            let path = http::uri::PathAndQuery::from_static(
241                "/nominal.authorization.resources.v1.ResourceShareService/CreateResourceShare",
242            );
243            let mut req = request.into_request();
244            req.extensions_mut()
245                .insert(
246                    GrpcMethod::new(
247                        "nominal.authorization.resources.v1.ResourceShareService",
248                        "CreateResourceShare",
249                    ),
250                );
251            self.inner.unary(req, path, codec).await
252        }
253        pub async fn batch_get_resource_shares(
254            &mut self,
255            request: impl tonic::IntoRequest<super::BatchGetResourceSharesRequest>,
256        ) -> std::result::Result<
257            tonic::Response<super::BatchGetResourceSharesResponse>,
258            tonic::Status,
259        > {
260            self.inner
261                .ready()
262                .await
263                .map_err(|e| {
264                    tonic::Status::unknown(
265                        format!("Service was not ready: {}", e.into()),
266                    )
267                })?;
268            let codec = tonic::codec::ProstCodec::default();
269            let path = http::uri::PathAndQuery::from_static(
270                "/nominal.authorization.resources.v1.ResourceShareService/BatchGetResourceShares",
271            );
272            let mut req = request.into_request();
273            req.extensions_mut()
274                .insert(
275                    GrpcMethod::new(
276                        "nominal.authorization.resources.v1.ResourceShareService",
277                        "BatchGetResourceShares",
278                    ),
279                );
280            self.inner.unary(req, path, codec).await
281        }
282        pub async fn list_resource_shares(
283            &mut self,
284            request: impl tonic::IntoRequest<super::ListResourceSharesRequest>,
285        ) -> std::result::Result<
286            tonic::Response<super::ListResourceSharesResponse>,
287            tonic::Status,
288        > {
289            self.inner
290                .ready()
291                .await
292                .map_err(|e| {
293                    tonic::Status::unknown(
294                        format!("Service was not ready: {}", e.into()),
295                    )
296                })?;
297            let codec = tonic::codec::ProstCodec::default();
298            let path = http::uri::PathAndQuery::from_static(
299                "/nominal.authorization.resources.v1.ResourceShareService/ListResourceShares",
300            );
301            let mut req = request.into_request();
302            req.extensions_mut()
303                .insert(
304                    GrpcMethod::new(
305                        "nominal.authorization.resources.v1.ResourceShareService",
306                        "ListResourceShares",
307                    ),
308                );
309            self.inner.unary(req, path, codec).await
310        }
311        pub async fn delete_resource_share(
312            &mut self,
313            request: impl tonic::IntoRequest<super::DeleteResourceShareRequest>,
314        ) -> std::result::Result<
315            tonic::Response<super::DeleteResourceShareResponse>,
316            tonic::Status,
317        > {
318            self.inner
319                .ready()
320                .await
321                .map_err(|e| {
322                    tonic::Status::unknown(
323                        format!("Service was not ready: {}", e.into()),
324                    )
325                })?;
326            let codec = tonic::codec::ProstCodec::default();
327            let path = http::uri::PathAndQuery::from_static(
328                "/nominal.authorization.resources.v1.ResourceShareService/DeleteResourceShare",
329            );
330            let mut req = request.into_request();
331            req.extensions_mut()
332                .insert(
333                    GrpcMethod::new(
334                        "nominal.authorization.resources.v1.ResourceShareService",
335                        "DeleteResourceShare",
336                    ),
337                );
338            self.inner.unary(req, path, codec).await
339        }
340    }
341}