Skip to main content

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