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