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