Skip to main content

nominal_api/conjure/endpoints/security/api/workspace/
workspace_service.rs

1use conjure_http::endpoint;
2/// This service provides information about workspaces. Workspaces provide access control boundaries. All resources in
3/// Nominal live within a workspace.
4#[conjure_http::conjure_endpoints(
5    name = "WorkspaceService",
6    use_legacy_error_serialization
7)]
8pub trait WorkspaceService {
9    /// Gets all workspaces that the requesting user belongs to.
10    #[endpoint(
11        method = GET,
12        path = "/workspaces/v1/workspaces",
13        name = "getWorkspaces",
14        produces = conjure_http::server::conjure::CollectionResponseSerializer
15    )]
16    fn get_workspaces(
17        &self,
18        #[auth]
19        auth_: conjure_object::BearerToken,
20    ) -> Result<
21        std::collections::BTreeSet<
22            super::super::super::super::super::objects::security::api::workspace::Workspace,
23        >,
24        conjure_http::private::Error,
25    >;
26    /// Gets the workspace with the specified WorkspaceRid.
27    #[endpoint(
28        method = GET,
29        path = "/workspaces/v1/workspaces/{workspaceRid}",
30        name = "getWorkspace",
31        produces = conjure_http::server::StdResponseSerializer
32    )]
33    fn get_workspace(
34        &self,
35        #[auth]
36        auth_: conjure_object::BearerToken,
37        #[path(
38            name = "workspaceRid",
39            decoder = conjure_http::server::conjure::FromPlainDecoder,
40            log_as = "workspaceRid",
41            safe
42        )]
43        workspace_rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
44    ) -> Result<
45        super::super::super::super::super::objects::security::api::workspace::Workspace,
46        conjure_http::private::Error,
47    >;
48    /// Updates the settings of the workspace with the specified WorkspaceRid.
49    #[endpoint(
50        method = PUT,
51        path = "/workspaces/v1/workspaces/{rid}",
52        name = "updateWorkspace",
53        produces = conjure_http::server::StdResponseSerializer
54    )]
55    fn update_workspace(
56        &self,
57        #[auth]
58        auth_: conjure_object::BearerToken,
59        #[path(
60            name = "rid",
61            decoder = conjure_http::server::conjure::FromPlainDecoder,
62            safe
63        )]
64        rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
65        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
66        request: super::super::super::super::super::objects::security::api::workspace::UpdateWorkspaceRequest,
67    ) -> Result<
68        super::super::super::super::super::objects::security::api::workspace::Workspace,
69        conjure_http::private::Error,
70    >;
71    /// Gets the default workspace for the requesting user. If the user belongs to a single workspace,
72    /// that workspace is returned. Otherwise, if the user's organization has a default workspace and
73    /// the user belongs to it, that will be returned.
74    #[endpoint(
75        method = GET,
76        path = "/workspaces/v1/default-workspace",
77        name = "getDefaultWorkspace",
78        produces = conjure_http::server::conjure::CollectionResponseSerializer
79    )]
80    fn get_default_workspace(
81        &self,
82        #[auth]
83        auth_: conjure_object::BearerToken,
84    ) -> Result<
85        Option<
86            super::super::super::super::super::objects::security::api::workspace::Workspace,
87        >,
88        conjure_http::private::Error,
89    >;
90}
91/// This service provides information about workspaces. Workspaces provide access control boundaries. All resources in
92/// Nominal live within a workspace.
93#[conjure_http::conjure_endpoints(
94    name = "WorkspaceService",
95    use_legacy_error_serialization
96)]
97pub trait AsyncWorkspaceService {
98    /// Gets all workspaces that the requesting user belongs to.
99    #[endpoint(
100        method = GET,
101        path = "/workspaces/v1/workspaces",
102        name = "getWorkspaces",
103        produces = conjure_http::server::conjure::CollectionResponseSerializer
104    )]
105    async fn get_workspaces(
106        &self,
107        #[auth]
108        auth_: conjure_object::BearerToken,
109    ) -> Result<
110        std::collections::BTreeSet<
111            super::super::super::super::super::objects::security::api::workspace::Workspace,
112        >,
113        conjure_http::private::Error,
114    >;
115    /// Gets the workspace with the specified WorkspaceRid.
116    #[endpoint(
117        method = GET,
118        path = "/workspaces/v1/workspaces/{workspaceRid}",
119        name = "getWorkspace",
120        produces = conjure_http::server::StdResponseSerializer
121    )]
122    async fn get_workspace(
123        &self,
124        #[auth]
125        auth_: conjure_object::BearerToken,
126        #[path(
127            name = "workspaceRid",
128            decoder = conjure_http::server::conjure::FromPlainDecoder,
129            log_as = "workspaceRid",
130            safe
131        )]
132        workspace_rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
133    ) -> Result<
134        super::super::super::super::super::objects::security::api::workspace::Workspace,
135        conjure_http::private::Error,
136    >;
137    /// Updates the settings of the workspace with the specified WorkspaceRid.
138    #[endpoint(
139        method = PUT,
140        path = "/workspaces/v1/workspaces/{rid}",
141        name = "updateWorkspace",
142        produces = conjure_http::server::StdResponseSerializer
143    )]
144    async fn update_workspace(
145        &self,
146        #[auth]
147        auth_: conjure_object::BearerToken,
148        #[path(
149            name = "rid",
150            decoder = conjure_http::server::conjure::FromPlainDecoder,
151            safe
152        )]
153        rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
154        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
155        request: super::super::super::super::super::objects::security::api::workspace::UpdateWorkspaceRequest,
156    ) -> Result<
157        super::super::super::super::super::objects::security::api::workspace::Workspace,
158        conjure_http::private::Error,
159    >;
160    /// Gets the default workspace for the requesting user. If the user belongs to a single workspace,
161    /// that workspace is returned. Otherwise, if the user's organization has a default workspace and
162    /// the user belongs to it, that will be returned.
163    #[endpoint(
164        method = GET,
165        path = "/workspaces/v1/default-workspace",
166        name = "getDefaultWorkspace",
167        produces = conjure_http::server::conjure::CollectionResponseSerializer
168    )]
169    async fn get_default_workspace(
170        &self,
171        #[auth]
172        auth_: conjure_object::BearerToken,
173    ) -> Result<
174        Option<
175            super::super::super::super::super::objects::security::api::workspace::Workspace,
176        >,
177        conjure_http::private::Error,
178    >;
179}
180/// This service provides information about workspaces. Workspaces provide access control boundaries. All resources in
181/// Nominal live within a workspace.
182#[conjure_http::conjure_endpoints(
183    name = "WorkspaceService",
184    use_legacy_error_serialization,
185    local
186)]
187pub trait LocalAsyncWorkspaceService {
188    /// Gets all workspaces that the requesting user belongs to.
189    #[endpoint(
190        method = GET,
191        path = "/workspaces/v1/workspaces",
192        name = "getWorkspaces",
193        produces = conjure_http::server::conjure::CollectionResponseSerializer
194    )]
195    async fn get_workspaces(
196        &self,
197        #[auth]
198        auth_: conjure_object::BearerToken,
199    ) -> Result<
200        std::collections::BTreeSet<
201            super::super::super::super::super::objects::security::api::workspace::Workspace,
202        >,
203        conjure_http::private::Error,
204    >;
205    /// Gets the workspace with the specified WorkspaceRid.
206    #[endpoint(
207        method = GET,
208        path = "/workspaces/v1/workspaces/{workspaceRid}",
209        name = "getWorkspace",
210        produces = conjure_http::server::StdResponseSerializer
211    )]
212    async fn get_workspace(
213        &self,
214        #[auth]
215        auth_: conjure_object::BearerToken,
216        #[path(
217            name = "workspaceRid",
218            decoder = conjure_http::server::conjure::FromPlainDecoder,
219            log_as = "workspaceRid",
220            safe
221        )]
222        workspace_rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
223    ) -> Result<
224        super::super::super::super::super::objects::security::api::workspace::Workspace,
225        conjure_http::private::Error,
226    >;
227    /// Updates the settings of the workspace with the specified WorkspaceRid.
228    #[endpoint(
229        method = PUT,
230        path = "/workspaces/v1/workspaces/{rid}",
231        name = "updateWorkspace",
232        produces = conjure_http::server::StdResponseSerializer
233    )]
234    async fn update_workspace(
235        &self,
236        #[auth]
237        auth_: conjure_object::BearerToken,
238        #[path(
239            name = "rid",
240            decoder = conjure_http::server::conjure::FromPlainDecoder,
241            safe
242        )]
243        rid: super::super::super::super::super::objects::api::rids::WorkspaceRid,
244        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
245        request: super::super::super::super::super::objects::security::api::workspace::UpdateWorkspaceRequest,
246    ) -> Result<
247        super::super::super::super::super::objects::security::api::workspace::Workspace,
248        conjure_http::private::Error,
249    >;
250    /// Gets the default workspace for the requesting user. If the user belongs to a single workspace,
251    /// that workspace is returned. Otherwise, if the user's organization has a default workspace and
252    /// the user belongs to it, that will be returned.
253    #[endpoint(
254        method = GET,
255        path = "/workspaces/v1/default-workspace",
256        name = "getDefaultWorkspace",
257        produces = conjure_http::server::conjure::CollectionResponseSerializer
258    )]
259    async fn get_default_workspace(
260        &self,
261        #[auth]
262        auth_: conjure_object::BearerToken,
263    ) -> Result<
264        Option<
265            super::super::super::super::super::objects::security::api::workspace::Workspace,
266        >,
267        conjure_http::private::Error,
268    >;
269}