nominal_api/proto/
nominal.workspaces.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct PreferredRefNameConfiguration {
4    #[prost(message, repeated, tag = "1")]
5    pub v1: ::prost::alloc::vec::Vec<super::super::types::RefNameAndType>,
6}
7/// The request to remove a field from a workspace.
8#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9pub struct RemoveType {}
10/// The request to update the display name of the workspace. The request will replace the existing display name
11/// with the display name specified if it's provided. Otherwise, the current display name will be removed from
12/// the workspace.
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct UpdateOrRemoveWorkspaceDisplayName {
15    /// The request to update the display name of the workspace. The request will replace the existing display name
16    /// with the display name specified if it's provided. Otherwise, the current display name will be removed from
17    /// the workspace.
18    #[prost(
19        oneof = "update_or_remove_workspace_display_name::UpdateOrRemoveWorkspaceDisplayName",
20        tags = "1, 2"
21    )]
22    pub update_or_remove_workspace_display_name: ::core::option::Option<
23        update_or_remove_workspace_display_name::UpdateOrRemoveWorkspaceDisplayName,
24    >,
25}
26/// Nested message and enum types in `UpdateOrRemoveWorkspaceDisplayName`.
27pub mod update_or_remove_workspace_display_name {
28    /// The request to update the display name of the workspace. The request will replace the existing display name
29    /// with the display name specified if it's provided. Otherwise, the current display name will be removed from
30    /// the workspace.
31    #[derive(Clone, PartialEq, ::prost::Oneof)]
32    pub enum UpdateOrRemoveWorkspaceDisplayName {
33        #[prost(string, tag = "1")]
34        DisplayName(::prost::alloc::string::String),
35        #[prost(message, tag = "2")]
36        RemoveType(super::RemoveType),
37    }
38}
39/// The request to update the symbol of the workspace. The request will replace the existing symbol
40/// with the symbol specified if it's provided. Otherwise, the current symbol will be removed from
41/// the workspace.
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct UpdateOrRemoveWorkspaceSymbol {
44    /// The request to update the symbol of the workspace. The request will replace the existing symbol
45    /// with the symbol specified if it's provided. Otherwise, the current symbol will be removed from
46    /// the workspace.
47    #[prost(
48        oneof = "update_or_remove_workspace_symbol::UpdateOrRemoveWorkspaceSymbol",
49        tags = "1, 2"
50    )]
51    pub update_or_remove_workspace_symbol: ::core::option::Option<
52        update_or_remove_workspace_symbol::UpdateOrRemoveWorkspaceSymbol,
53    >,
54}
55/// Nested message and enum types in `UpdateOrRemoveWorkspaceSymbol`.
56pub mod update_or_remove_workspace_symbol {
57    /// The request to update the symbol of the workspace. The request will replace the existing symbol
58    /// with the symbol specified if it's provided. Otherwise, the current symbol will be removed from
59    /// the workspace.
60    #[derive(Clone, PartialEq, ::prost::Oneof)]
61    pub enum UpdateOrRemoveWorkspaceSymbol {
62        #[prost(message, tag = "1")]
63        Symbol(super::WorkspaceSymbol),
64        #[prost(message, tag = "2")]
65        RemoveType(super::RemoveType),
66    }
67}
68#[derive(Clone, PartialEq, ::prost::Message)]
69pub struct UpdateWorkspaceRequest {
70    #[prost(message, optional, tag = "1")]
71    pub display_name: ::core::option::Option<UpdateOrRemoveWorkspaceDisplayName>,
72    #[prost(message, optional, tag = "2")]
73    pub symbol: ::core::option::Option<UpdateOrRemoveWorkspaceSymbol>,
74    #[prost(message, optional, tag = "3")]
75    pub settings: ::core::option::Option<WorkspaceSettings>,
76}
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct Workspace {
79    /// A unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
80    #[prost(string, tag = "1")]
81    pub id: ::prost::alloc::string::String,
82    #[prost(string, tag = "2")]
83    pub rid: ::prost::alloc::string::String,
84    #[prost(string, tag = "3")]
85    pub org: ::prost::alloc::string::String,
86    #[prost(string, optional, tag = "4")]
87    pub display_name: ::core::option::Option<::prost::alloc::string::String>,
88    #[prost(message, optional, tag = "5")]
89    pub symbol: ::core::option::Option<WorkspaceSymbol>,
90    #[prost(message, optional, tag = "6")]
91    pub settings: ::core::option::Option<WorkspaceSettings>,
92}
93#[derive(Clone, PartialEq, ::prost::Message)]
94pub struct WorkspaceSettings {
95    #[prost(message, optional, tag = "1")]
96    pub ref_names: ::core::option::Option<PreferredRefNameConfiguration>,
97}
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct WorkspaceSymbol {
100    #[prost(oneof = "workspace_symbol::WorkspaceSymbol", tags = "1, 2, 3")]
101    pub workspace_symbol: ::core::option::Option<workspace_symbol::WorkspaceSymbol>,
102}
103/// Nested message and enum types in `WorkspaceSymbol`.
104pub mod workspace_symbol {
105    #[derive(Clone, PartialEq, ::prost::Oneof)]
106    pub enum WorkspaceSymbol {
107        /// Workspace icon name (e.g. castle)
108        #[prost(string, tag = "1")]
109        Icon(::prost::alloc::string::String),
110        /// Workspace emoji name (e.g. :castle:)
111        #[prost(string, tag = "2")]
112        Emoji(::prost::alloc::string::String),
113        /// Workspace image url (e.g. <https://example.com/image.png>)
114        #[prost(string, tag = "3")]
115        Image(::prost::alloc::string::String),
116    }
117}
118#[derive(Clone, Copy, PartialEq, ::prost::Message)]
119pub struct GetWorkspacesRequest {}
120#[derive(Clone, PartialEq, ::prost::Message)]
121pub struct GetWorkspacesResponse {
122    #[prost(message, repeated, tag = "1")]
123    pub workspaces: ::prost::alloc::vec::Vec<Workspace>,
124}
125#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct GetWorkspaceRequest {
127    #[prost(string, tag = "1")]
128    pub workspace_rid: ::prost::alloc::string::String,
129}
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct GetWorkspaceResponse {
132    #[prost(message, optional, tag = "1")]
133    pub workspace: ::core::option::Option<Workspace>,
134}
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct UpdateWorkspaceRequestWrapper {
137    #[prost(string, tag = "1")]
138    pub rid: ::prost::alloc::string::String,
139    #[prost(message, optional, tag = "2")]
140    pub request: ::core::option::Option<UpdateWorkspaceRequest>,
141}
142#[derive(Clone, PartialEq, ::prost::Message)]
143pub struct UpdateWorkspaceResponse {
144    #[prost(message, optional, tag = "1")]
145    pub workspace: ::core::option::Option<Workspace>,
146}
147#[derive(Clone, Copy, PartialEq, ::prost::Message)]
148pub struct GetDefaultWorkspaceRequest {}
149#[derive(Clone, PartialEq, ::prost::Message)]
150pub struct GetDefaultWorkspaceResponse {
151    #[prost(message, optional, tag = "1")]
152    pub workspace: ::core::option::Option<Workspace>,
153}
154/// buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
155#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
156#[repr(i32)]
157pub enum SecurityError {
158    /// Workspaces are hard boundaries in Nominal. Resources from different workspaces cannot be combined.
159    ForbiddenCrossWorkspaceOperation = 0,
160    /// The workspace with the specified rid was not found.
161    WorkspaceNotFound = 1,
162    /// A workspace was not specified and could not be inferred.
163    WorkspaceNotSpecified = 2,
164}
165impl SecurityError {
166    /// String value of the enum field names used in the ProtoBuf definition.
167    ///
168    /// The values are not transformed in any way and thus are considered stable
169    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
170    pub fn as_str_name(&self) -> &'static str {
171        match self {
172            Self::ForbiddenCrossWorkspaceOperation => {
173                "SECURITY_ERROR_FORBIDDEN_CROSS_WORKSPACE_OPERATION"
174            }
175            Self::WorkspaceNotFound => "SECURITY_ERROR_WORKSPACE_NOT_FOUND",
176            Self::WorkspaceNotSpecified => "SECURITY_ERROR_WORKSPACE_NOT_SPECIFIED",
177        }
178    }
179    /// Creates an enum from field names used in the ProtoBuf definition.
180    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
181        match value {
182            "SECURITY_ERROR_FORBIDDEN_CROSS_WORKSPACE_OPERATION" => {
183                Some(Self::ForbiddenCrossWorkspaceOperation)
184            }
185            "SECURITY_ERROR_WORKSPACE_NOT_FOUND" => Some(Self::WorkspaceNotFound),
186            "SECURITY_ERROR_WORKSPACE_NOT_SPECIFIED" => Some(Self::WorkspaceNotSpecified),
187            _ => None,
188        }
189    }
190}
191/// Generated client implementations.
192pub mod workspace_service_client {
193    #![allow(
194        unused_variables,
195        dead_code,
196        missing_docs,
197        clippy::wildcard_imports,
198        clippy::let_unit_value,
199    )]
200    use tonic::codegen::*;
201    use tonic::codegen::http::Uri;
202    /// This service provides information about workspaces. Workspaces provide access control boundaries. All resources in
203    /// Nominal live within a workspace.
204    #[derive(Debug, Clone)]
205    pub struct WorkspaceServiceClient<T> {
206        inner: tonic::client::Grpc<T>,
207    }
208    impl WorkspaceServiceClient<tonic::transport::Channel> {
209        /// Attempt to create a new client by connecting to a given endpoint.
210        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
211        where
212            D: TryInto<tonic::transport::Endpoint>,
213            D::Error: Into<StdError>,
214        {
215            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
216            Ok(Self::new(conn))
217        }
218    }
219    impl<T> WorkspaceServiceClient<T>
220    where
221        T: tonic::client::GrpcService<tonic::body::Body>,
222        T::Error: Into<StdError>,
223        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
224        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
225    {
226        pub fn new(inner: T) -> Self {
227            let inner = tonic::client::Grpc::new(inner);
228            Self { inner }
229        }
230        pub fn with_origin(inner: T, origin: Uri) -> Self {
231            let inner = tonic::client::Grpc::with_origin(inner, origin);
232            Self { inner }
233        }
234        pub fn with_interceptor<F>(
235            inner: T,
236            interceptor: F,
237        ) -> WorkspaceServiceClient<InterceptedService<T, F>>
238        where
239            F: tonic::service::Interceptor,
240            T::ResponseBody: Default,
241            T: tonic::codegen::Service<
242                http::Request<tonic::body::Body>,
243                Response = http::Response<
244                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
245                >,
246            >,
247            <T as tonic::codegen::Service<
248                http::Request<tonic::body::Body>,
249            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
250        {
251            WorkspaceServiceClient::new(InterceptedService::new(inner, interceptor))
252        }
253        /// Compress requests with the given encoding.
254        ///
255        /// This requires the server to support it otherwise it might respond with an
256        /// error.
257        #[must_use]
258        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
259            self.inner = self.inner.send_compressed(encoding);
260            self
261        }
262        /// Enable decompressing responses.
263        #[must_use]
264        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
265            self.inner = self.inner.accept_compressed(encoding);
266            self
267        }
268        /// Limits the maximum size of a decoded message.
269        ///
270        /// Default: `4MB`
271        #[must_use]
272        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
273            self.inner = self.inner.max_decoding_message_size(limit);
274            self
275        }
276        /// Limits the maximum size of an encoded message.
277        ///
278        /// Default: `usize::MAX`
279        #[must_use]
280        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
281            self.inner = self.inner.max_encoding_message_size(limit);
282            self
283        }
284        /// Gets all workspaces that the requesting user belongs to.
285        pub async fn get_workspaces(
286            &mut self,
287            request: impl tonic::IntoRequest<super::GetWorkspacesRequest>,
288        ) -> std::result::Result<
289            tonic::Response<super::GetWorkspacesResponse>,
290            tonic::Status,
291        > {
292            self.inner
293                .ready()
294                .await
295                .map_err(|e| {
296                    tonic::Status::unknown(
297                        format!("Service was not ready: {}", e.into()),
298                    )
299                })?;
300            let codec = tonic::codec::ProstCodec::default();
301            let path = http::uri::PathAndQuery::from_static(
302                "/nominal.workspaces.v1.WorkspaceService/GetWorkspaces",
303            );
304            let mut req = request.into_request();
305            req.extensions_mut()
306                .insert(
307                    GrpcMethod::new(
308                        "nominal.workspaces.v1.WorkspaceService",
309                        "GetWorkspaces",
310                    ),
311                );
312            self.inner.unary(req, path, codec).await
313        }
314        /// Gets the workspace with the specified WorkspaceRid.
315        pub async fn get_workspace(
316            &mut self,
317            request: impl tonic::IntoRequest<super::GetWorkspaceRequest>,
318        ) -> std::result::Result<
319            tonic::Response<super::GetWorkspaceResponse>,
320            tonic::Status,
321        > {
322            self.inner
323                .ready()
324                .await
325                .map_err(|e| {
326                    tonic::Status::unknown(
327                        format!("Service was not ready: {}", e.into()),
328                    )
329                })?;
330            let codec = tonic::codec::ProstCodec::default();
331            let path = http::uri::PathAndQuery::from_static(
332                "/nominal.workspaces.v1.WorkspaceService/GetWorkspace",
333            );
334            let mut req = request.into_request();
335            req.extensions_mut()
336                .insert(
337                    GrpcMethod::new(
338                        "nominal.workspaces.v1.WorkspaceService",
339                        "GetWorkspace",
340                    ),
341                );
342            self.inner.unary(req, path, codec).await
343        }
344        /// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
345        /// Updates the settings of the workspace with the specified WorkspaceRid.
346        pub async fn update_workspace(
347            &mut self,
348            request: impl tonic::IntoRequest<super::UpdateWorkspaceRequestWrapper>,
349        ) -> std::result::Result<
350            tonic::Response<super::UpdateWorkspaceResponse>,
351            tonic::Status,
352        > {
353            self.inner
354                .ready()
355                .await
356                .map_err(|e| {
357                    tonic::Status::unknown(
358                        format!("Service was not ready: {}", e.into()),
359                    )
360                })?;
361            let codec = tonic::codec::ProstCodec::default();
362            let path = http::uri::PathAndQuery::from_static(
363                "/nominal.workspaces.v1.WorkspaceService/UpdateWorkspace",
364            );
365            let mut req = request.into_request();
366            req.extensions_mut()
367                .insert(
368                    GrpcMethod::new(
369                        "nominal.workspaces.v1.WorkspaceService",
370                        "UpdateWorkspace",
371                    ),
372                );
373            self.inner.unary(req, path, codec).await
374        }
375        /// Gets the default workspace for the requesting user. If the user belongs to a single workspace,
376        /// that workspace is returned. Otherwise, if the user's organization has a default workspace and
377        /// the user belongs to it, that will be returned.
378        pub async fn get_default_workspace(
379            &mut self,
380            request: impl tonic::IntoRequest<super::GetDefaultWorkspaceRequest>,
381        ) -> std::result::Result<
382            tonic::Response<super::GetDefaultWorkspaceResponse>,
383            tonic::Status,
384        > {
385            self.inner
386                .ready()
387                .await
388                .map_err(|e| {
389                    tonic::Status::unknown(
390                        format!("Service was not ready: {}", e.into()),
391                    )
392                })?;
393            let codec = tonic::codec::ProstCodec::default();
394            let path = http::uri::PathAndQuery::from_static(
395                "/nominal.workspaces.v1.WorkspaceService/GetDefaultWorkspace",
396            );
397            let mut req = request.into_request();
398            req.extensions_mut()
399                .insert(
400                    GrpcMethod::new(
401                        "nominal.workspaces.v1.WorkspaceService",
402                        "GetDefaultWorkspace",
403                    ),
404                );
405            self.inner.unary(req, path, codec).await
406        }
407    }
408}