Skip to main content

nominal_api/conjure/endpoints/scout/
internal_versioning_service.rs

1use conjure_http::endpoint;
2/// These endpoints are not intended to be used directly by clients, since
3/// they require saving resource-specific state associated with new commits.
4#[conjure_http::conjure_endpoints(
5    name = "InternalVersioningService",
6    use_legacy_error_serialization
7)]
8pub trait InternalVersioningService {
9    /// Creates a root commit (no parents) and a "main" branch
10    /// pointing to that commit, for the given resource.
11    /// Throws if the resource already has a commit graph.
12    #[endpoint(
13        method = POST,
14        path = "/internal/scout/v1/versioning/{resourceRid}",
15        name = "initResourceVersioning",
16        produces = conjure_http::server::StdResponseSerializer
17    )]
18    fn init_resource_versioning(
19        &self,
20        #[auth]
21        auth_: conjure_object::BearerToken,
22        #[path(
23            name = "resourceRid",
24            decoder = conjure_http::server::conjure::FromPlainDecoder,
25            log_as = "resourceRid"
26        )]
27        resource_rid: conjure_object::ResourceIdentifier,
28        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
29        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
30    ) -> Result<
31        super::super::super::objects::scout::versioning::api::BranchAndCommit,
32        conjure_http::private::Error,
33    >;
34    /// Creates a non-permanent commit on the given branch,
35    /// Throws if the branch doesn't exist.
36    /// Throws if latestCommit is passed and is not the latest commit.
37    #[endpoint(
38        method = POST,
39        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
40        name = "saveWorkingState",
41        produces = conjure_http::server::StdResponseSerializer
42    )]
43    fn save_working_state(
44        &self,
45        #[auth]
46        auth_: conjure_object::BearerToken,
47        #[path(
48            name = "resourceRid",
49            decoder = conjure_http::server::conjure::FromPlainDecoder,
50            log_as = "resourceRid"
51        )]
52        resource_rid: conjure_object::ResourceIdentifier,
53        #[path(
54            name = "branchName",
55            decoder = conjure_http::server::conjure::FromPlainDecoder,
56            log_as = "branchName"
57        )]
58        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
59        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
60        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
61    ) -> Result<
62        super::super::super::objects::scout::versioning::api::BranchAndCommit,
63        conjure_http::private::Error,
64    >;
65    /// Creates a new permanent commit on the given branch.
66    /// Throws if the branch doesn't exist.
67    /// Throws if latestCommit is passed and is not the latest commit.
68    #[endpoint(
69        method = POST,
70        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
71        name = "commit",
72        produces = conjure_http::server::StdResponseSerializer
73    )]
74    fn commit(
75        &self,
76        #[auth]
77        auth_: conjure_object::BearerToken,
78        #[path(
79            name = "resourceRid",
80            decoder = conjure_http::server::conjure::FromPlainDecoder,
81            log_as = "resourceRid"
82        )]
83        resource_rid: conjure_object::ResourceIdentifier,
84        #[path(
85            name = "branchName",
86            decoder = conjure_http::server::conjure::FromPlainDecoder,
87            log_as = "branchName"
88        )]
89        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
90        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
91        request: super::super::super::objects::scout::versioning::api::CommitRequest,
92    ) -> Result<
93        super::super::super::objects::scout::versioning::api::BranchAndCommit,
94        conjure_http::private::Error,
95    >;
96    /// Compacts the commit graph for the resource by deleting
97    /// working state commits that match the provided strategy.
98    /// Persists commits that are pointed to by branches.
99    /// Returns the set of commits that were compacted.
100    /// Throws if the resource doesn't exist.
101    #[endpoint(
102        method = POST,
103        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
104        name = "compactCommits",
105        produces = conjure_http::server::conjure::CollectionResponseSerializer
106    )]
107    fn compact_commits(
108        &self,
109        #[auth]
110        auth_: conjure_object::BearerToken,
111        #[path(
112            name = "resourceRid",
113            decoder = conjure_http::server::conjure::FromPlainDecoder,
114            log_as = "resourceRid"
115        )]
116        resource_rid: conjure_object::ResourceIdentifier,
117        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
118        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
119    ) -> Result<
120        std::collections::BTreeSet<
121            super::super::super::objects::scout::versioning::api::CommitId,
122        >,
123        conjure_http::private::Error,
124    >;
125}
126/// These endpoints are not intended to be used directly by clients, since
127/// they require saving resource-specific state associated with new commits.
128#[conjure_http::conjure_endpoints(
129    name = "InternalVersioningService",
130    use_legacy_error_serialization
131)]
132pub trait AsyncInternalVersioningService {
133    /// Creates a root commit (no parents) and a "main" branch
134    /// pointing to that commit, for the given resource.
135    /// Throws if the resource already has a commit graph.
136    #[endpoint(
137        method = POST,
138        path = "/internal/scout/v1/versioning/{resourceRid}",
139        name = "initResourceVersioning",
140        produces = conjure_http::server::StdResponseSerializer
141    )]
142    async fn init_resource_versioning(
143        &self,
144        #[auth]
145        auth_: conjure_object::BearerToken,
146        #[path(
147            name = "resourceRid",
148            decoder = conjure_http::server::conjure::FromPlainDecoder,
149            log_as = "resourceRid"
150        )]
151        resource_rid: conjure_object::ResourceIdentifier,
152        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
153        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
154    ) -> Result<
155        super::super::super::objects::scout::versioning::api::BranchAndCommit,
156        conjure_http::private::Error,
157    >;
158    /// Creates a non-permanent commit on the given branch,
159    /// Throws if the branch doesn't exist.
160    /// Throws if latestCommit is passed and is not the latest commit.
161    #[endpoint(
162        method = POST,
163        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
164        name = "saveWorkingState",
165        produces = conjure_http::server::StdResponseSerializer
166    )]
167    async fn save_working_state(
168        &self,
169        #[auth]
170        auth_: conjure_object::BearerToken,
171        #[path(
172            name = "resourceRid",
173            decoder = conjure_http::server::conjure::FromPlainDecoder,
174            log_as = "resourceRid"
175        )]
176        resource_rid: conjure_object::ResourceIdentifier,
177        #[path(
178            name = "branchName",
179            decoder = conjure_http::server::conjure::FromPlainDecoder,
180            log_as = "branchName"
181        )]
182        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
183        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
184        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
185    ) -> Result<
186        super::super::super::objects::scout::versioning::api::BranchAndCommit,
187        conjure_http::private::Error,
188    >;
189    /// Creates a new permanent commit on the given branch.
190    /// Throws if the branch doesn't exist.
191    /// Throws if latestCommit is passed and is not the latest commit.
192    #[endpoint(
193        method = POST,
194        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
195        name = "commit",
196        produces = conjure_http::server::StdResponseSerializer
197    )]
198    async fn commit(
199        &self,
200        #[auth]
201        auth_: conjure_object::BearerToken,
202        #[path(
203            name = "resourceRid",
204            decoder = conjure_http::server::conjure::FromPlainDecoder,
205            log_as = "resourceRid"
206        )]
207        resource_rid: conjure_object::ResourceIdentifier,
208        #[path(
209            name = "branchName",
210            decoder = conjure_http::server::conjure::FromPlainDecoder,
211            log_as = "branchName"
212        )]
213        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
214        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
215        request: super::super::super::objects::scout::versioning::api::CommitRequest,
216    ) -> Result<
217        super::super::super::objects::scout::versioning::api::BranchAndCommit,
218        conjure_http::private::Error,
219    >;
220    /// Compacts the commit graph for the resource by deleting
221    /// working state commits that match the provided strategy.
222    /// Persists commits that are pointed to by branches.
223    /// Returns the set of commits that were compacted.
224    /// Throws if the resource doesn't exist.
225    #[endpoint(
226        method = POST,
227        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
228        name = "compactCommits",
229        produces = conjure_http::server::conjure::CollectionResponseSerializer
230    )]
231    async fn compact_commits(
232        &self,
233        #[auth]
234        auth_: conjure_object::BearerToken,
235        #[path(
236            name = "resourceRid",
237            decoder = conjure_http::server::conjure::FromPlainDecoder,
238            log_as = "resourceRid"
239        )]
240        resource_rid: conjure_object::ResourceIdentifier,
241        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
242        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
243    ) -> Result<
244        std::collections::BTreeSet<
245            super::super::super::objects::scout::versioning::api::CommitId,
246        >,
247        conjure_http::private::Error,
248    >;
249}
250/// These endpoints are not intended to be used directly by clients, since
251/// they require saving resource-specific state associated with new commits.
252#[conjure_http::conjure_endpoints(
253    name = "InternalVersioningService",
254    use_legacy_error_serialization,
255    local
256)]
257pub trait LocalAsyncInternalVersioningService {
258    /// Creates a root commit (no parents) and a "main" branch
259    /// pointing to that commit, for the given resource.
260    /// Throws if the resource already has a commit graph.
261    #[endpoint(
262        method = POST,
263        path = "/internal/scout/v1/versioning/{resourceRid}",
264        name = "initResourceVersioning",
265        produces = conjure_http::server::StdResponseSerializer
266    )]
267    async fn init_resource_versioning(
268        &self,
269        #[auth]
270        auth_: conjure_object::BearerToken,
271        #[path(
272            name = "resourceRid",
273            decoder = conjure_http::server::conjure::FromPlainDecoder,
274            log_as = "resourceRid"
275        )]
276        resource_rid: conjure_object::ResourceIdentifier,
277        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
278        request: super::super::super::objects::scout::versioning::api::InitResourceVersioningRequest,
279    ) -> Result<
280        super::super::super::objects::scout::versioning::api::BranchAndCommit,
281        conjure_http::private::Error,
282    >;
283    /// Creates a non-permanent commit on the given branch,
284    /// Throws if the branch doesn't exist.
285    /// Throws if latestCommit is passed and is not the latest commit.
286    #[endpoint(
287        method = POST,
288        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/working-state",
289        name = "saveWorkingState",
290        produces = conjure_http::server::StdResponseSerializer
291    )]
292    async fn save_working_state(
293        &self,
294        #[auth]
295        auth_: conjure_object::BearerToken,
296        #[path(
297            name = "resourceRid",
298            decoder = conjure_http::server::conjure::FromPlainDecoder,
299            log_as = "resourceRid"
300        )]
301        resource_rid: conjure_object::ResourceIdentifier,
302        #[path(
303            name = "branchName",
304            decoder = conjure_http::server::conjure::FromPlainDecoder,
305            log_as = "branchName"
306        )]
307        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
308        #[body(deserializer = conjure_http::server::StdRequestDeserializer, safe)]
309        request: super::super::super::objects::scout::versioning::api::SaveWorkingStateRequest,
310    ) -> Result<
311        super::super::super::objects::scout::versioning::api::BranchAndCommit,
312        conjure_http::private::Error,
313    >;
314    /// Creates a new permanent commit on the given branch.
315    /// Throws if the branch doesn't exist.
316    /// Throws if latestCommit is passed and is not the latest commit.
317    #[endpoint(
318        method = POST,
319        path = "/internal/scout/v1/versioning/{resourceRid}/branch/{branchName}/commit",
320        name = "commit",
321        produces = conjure_http::server::StdResponseSerializer
322    )]
323    async fn commit(
324        &self,
325        #[auth]
326        auth_: conjure_object::BearerToken,
327        #[path(
328            name = "resourceRid",
329            decoder = conjure_http::server::conjure::FromPlainDecoder,
330            log_as = "resourceRid"
331        )]
332        resource_rid: conjure_object::ResourceIdentifier,
333        #[path(
334            name = "branchName",
335            decoder = conjure_http::server::conjure::FromPlainDecoder,
336            log_as = "branchName"
337        )]
338        branch_name: super::super::super::objects::scout::versioning::api::BranchName,
339        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
340        request: super::super::super::objects::scout::versioning::api::CommitRequest,
341    ) -> Result<
342        super::super::super::objects::scout::versioning::api::BranchAndCommit,
343        conjure_http::private::Error,
344    >;
345    /// Compacts the commit graph for the resource by deleting
346    /// working state commits that match the provided strategy.
347    /// Persists commits that are pointed to by branches.
348    /// Returns the set of commits that were compacted.
349    /// Throws if the resource doesn't exist.
350    #[endpoint(
351        method = POST,
352        path = "/internal/scout/v1/versioning/{resourceRid}/compact-commits",
353        name = "compactCommits",
354        produces = conjure_http::server::conjure::CollectionResponseSerializer
355    )]
356    async fn compact_commits(
357        &self,
358        #[auth]
359        auth_: conjure_object::BearerToken,
360        #[path(
361            name = "resourceRid",
362            decoder = conjure_http::server::conjure::FromPlainDecoder,
363            log_as = "resourceRid"
364        )]
365        resource_rid: conjure_object::ResourceIdentifier,
366        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
367        request: super::super::super::objects::scout::versioning::api::CompactCommitsRequest,
368    ) -> Result<
369        std::collections::BTreeSet<
370            super::super::super::objects::scout::versioning::api::CommitId,
371        >,
372        conjure_http::private::Error,
373    >;
374}