Skip to main content

nominal_api/conjure/endpoints/scout/compute/api/
compute_service.rs

1use conjure_http::endpoint;
2/// The Compute Service provides the ability to compute the output of compute graphs.
3#[conjure_http::conjure_endpoints(
4    name = "ComputeService",
5    use_legacy_error_serialization
6)]
7pub trait ComputeService {
8    /// Computes the output of the compute graph specified by a ComputeNodeRequest.
9    #[endpoint(
10        method = POST,
11        path = "/compute/v2/compute",
12        name = "compute",
13        produces = conjure_http::server::StdResponseSerializer
14    )]
15    fn compute(
16        &self,
17        #[auth]
18        auth_: conjure_object::BearerToken,
19        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
20        request: super::super::super::super::super::objects::scout::compute::api::ComputeNodeRequest,
21    ) -> Result<
22        super::super::super::super::super::objects::scout::compute::api::ComputeNodeResponse,
23        conjure_http::private::Error,
24    >;
25    /// Computes the output of the compute graph specified by a ParameterizedComputeNodeRequest. A parameterized
26    /// compute request supports multiple values for a single variable, supplied by the ParameterizedContext.
27    /// Results are returned in the same order of the request.
28    #[endpoint(
29        method = POST,
30        path = "/compute/v2/compute/parameterized",
31        name = "parameterizedCompute",
32        produces = conjure_http::server::StdResponseSerializer
33    )]
34    fn parameterized_compute(
35        &self,
36        #[auth]
37        auth_: conjure_object::BearerToken,
38        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
39        request: super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeRequest,
40    ) -> Result<
41        super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeResponse,
42        conjure_http::private::Error,
43    >;
44    /// Returns the resulting unit for the output of a compute graph. If the resulting unit is equivalent to exactly
45    /// one existing unit in the system, it will be returned (for example, a series in Coulombs divided by a series
46    /// in Volts will return an output of Farads). If the output does not have units (for example, a range output,)
47    /// the unit result will return noUnitAvailable, and if the computation was not successful, corresponding errors
48    /// are returned.
49    #[endpoint(
50        method = POST,
51        path = "/compute/v2/compute/units",
52        name = "computeUnits",
53        produces = conjure_http::server::StdResponseSerializer
54    )]
55    fn compute_units(
56        &self,
57        #[auth]
58        auth_: conjure_object::BearerToken,
59        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
60        request: super::super::super::super::super::objects::scout::compute::api::ComputeUnitsRequest,
61    ) -> Result<
62        super::super::super::super::super::objects::scout::compute::api::ComputeUnitResult,
63        conjure_http::private::Error,
64    >;
65    /// Computes the output of compute graphs specified by BatchComputeNodeRequest. Results are returned in the same
66    /// order as the request.
67    #[endpoint(
68        method = POST,
69        path = "/compute/v2/compute/batch",
70        name = "batchComputeWithUnits",
71        produces = conjure_http::server::StdResponseSerializer
72    )]
73    fn batch_compute_with_units(
74        &self,
75        #[auth]
76        auth_: conjure_object::BearerToken,
77        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
78        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsRequest,
79    ) -> Result<
80        super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsResponse,
81        conjure_http::private::Error,
82    >;
83    /// Same as computeUnits, however this endpoint functions on a batch of requests for wire efficiency purposes. An
84    /// extra note is that this method will serialize underlying conjure errors into the BatchComputeUnitResult type,
85    /// meaning callers are required to check for errors explicitly (rather than relying on exceptions being thrown).
86    #[endpoint(
87        method = POST,
88        path = "/compute/v2/compute/batch-units",
89        name = "batchComputeUnits",
90        produces = conjure_http::server::StdResponseSerializer
91    )]
92    fn batch_compute_units(
93        &self,
94        #[auth]
95        auth_: conjure_object::BearerToken,
96        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
97        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitsRequest,
98    ) -> Result<
99        super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitResult,
100        conjure_http::private::Error,
101    >;
102    /// Computes the output of the compute graph specified by a ComputeNodeRequest, as well as providing the resulting
103    /// unit for the output of a compute graph. If the resulting unit is equivalent to exactly one existing unit in the
104    /// system, it will be returned (for example, a series in Coulombs divided by a series in Volts will return an
105    /// output of Farads). If the output does not have units (for example, a range output,) the unit result will return
106    /// noUnitAvailable, and if the computation was not successful, corresponding errors are returned.
107    #[endpoint(
108        method = POST,
109        path = "/compute/v2/computeWithUnits",
110        name = "computeWithUnits",
111        produces = conjure_http::server::StdResponseSerializer
112    )]
113    fn compute_with_units(
114        &self,
115        #[auth]
116        auth_: conjure_object::BearerToken,
117        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
118        request: super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsRequest,
119    ) -> Result<
120        super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsResponse,
121        conjure_http::private::Error,
122    >;
123    /// Best-effort cancellation of active compute requests. Each ID should be the request ID that
124    /// the client originally passed when starting the request. A single request may correspond to
125    /// one or more underlying operations, all of which will be cancelled.
126    #[endpoint(
127        method = POST,
128        path = "/compute/v2/compute/batch/kill",
129        name = "batchKillRequests"
130    )]
131    fn batch_kill_requests(
132        &self,
133        #[auth]
134        auth_: conjure_object::BearerToken,
135        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
136        request: super::super::super::super::super::objects::scout::compute::api::BatchKillRequestsRequest,
137    ) -> Result<(), conjure_http::private::Error>;
138}
139/// The Compute Service provides the ability to compute the output of compute graphs.
140#[conjure_http::conjure_endpoints(
141    name = "ComputeService",
142    use_legacy_error_serialization
143)]
144pub trait AsyncComputeService {
145    /// Computes the output of the compute graph specified by a ComputeNodeRequest.
146    #[endpoint(
147        method = POST,
148        path = "/compute/v2/compute",
149        name = "compute",
150        produces = conjure_http::server::StdResponseSerializer
151    )]
152    async fn compute(
153        &self,
154        #[auth]
155        auth_: conjure_object::BearerToken,
156        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
157        request: super::super::super::super::super::objects::scout::compute::api::ComputeNodeRequest,
158    ) -> Result<
159        super::super::super::super::super::objects::scout::compute::api::ComputeNodeResponse,
160        conjure_http::private::Error,
161    >;
162    /// Computes the output of the compute graph specified by a ParameterizedComputeNodeRequest. A parameterized
163    /// compute request supports multiple values for a single variable, supplied by the ParameterizedContext.
164    /// Results are returned in the same order of the request.
165    #[endpoint(
166        method = POST,
167        path = "/compute/v2/compute/parameterized",
168        name = "parameterizedCompute",
169        produces = conjure_http::server::StdResponseSerializer
170    )]
171    async fn parameterized_compute(
172        &self,
173        #[auth]
174        auth_: conjure_object::BearerToken,
175        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
176        request: super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeRequest,
177    ) -> Result<
178        super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeResponse,
179        conjure_http::private::Error,
180    >;
181    /// Returns the resulting unit for the output of a compute graph. If the resulting unit is equivalent to exactly
182    /// one existing unit in the system, it will be returned (for example, a series in Coulombs divided by a series
183    /// in Volts will return an output of Farads). If the output does not have units (for example, a range output,)
184    /// the unit result will return noUnitAvailable, and if the computation was not successful, corresponding errors
185    /// are returned.
186    #[endpoint(
187        method = POST,
188        path = "/compute/v2/compute/units",
189        name = "computeUnits",
190        produces = conjure_http::server::StdResponseSerializer
191    )]
192    async fn compute_units(
193        &self,
194        #[auth]
195        auth_: conjure_object::BearerToken,
196        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
197        request: super::super::super::super::super::objects::scout::compute::api::ComputeUnitsRequest,
198    ) -> Result<
199        super::super::super::super::super::objects::scout::compute::api::ComputeUnitResult,
200        conjure_http::private::Error,
201    >;
202    /// Computes the output of compute graphs specified by BatchComputeNodeRequest. Results are returned in the same
203    /// order as the request.
204    #[endpoint(
205        method = POST,
206        path = "/compute/v2/compute/batch",
207        name = "batchComputeWithUnits",
208        produces = conjure_http::server::StdResponseSerializer
209    )]
210    async fn batch_compute_with_units(
211        &self,
212        #[auth]
213        auth_: conjure_object::BearerToken,
214        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
215        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsRequest,
216    ) -> Result<
217        super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsResponse,
218        conjure_http::private::Error,
219    >;
220    /// Same as computeUnits, however this endpoint functions on a batch of requests for wire efficiency purposes. An
221    /// extra note is that this method will serialize underlying conjure errors into the BatchComputeUnitResult type,
222    /// meaning callers are required to check for errors explicitly (rather than relying on exceptions being thrown).
223    #[endpoint(
224        method = POST,
225        path = "/compute/v2/compute/batch-units",
226        name = "batchComputeUnits",
227        produces = conjure_http::server::StdResponseSerializer
228    )]
229    async fn batch_compute_units(
230        &self,
231        #[auth]
232        auth_: conjure_object::BearerToken,
233        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
234        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitsRequest,
235    ) -> Result<
236        super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitResult,
237        conjure_http::private::Error,
238    >;
239    /// Computes the output of the compute graph specified by a ComputeNodeRequest, as well as providing the resulting
240    /// unit for the output of a compute graph. If the resulting unit is equivalent to exactly one existing unit in the
241    /// system, it will be returned (for example, a series in Coulombs divided by a series in Volts will return an
242    /// output of Farads). If the output does not have units (for example, a range output,) the unit result will return
243    /// noUnitAvailable, and if the computation was not successful, corresponding errors are returned.
244    #[endpoint(
245        method = POST,
246        path = "/compute/v2/computeWithUnits",
247        name = "computeWithUnits",
248        produces = conjure_http::server::StdResponseSerializer
249    )]
250    async fn compute_with_units(
251        &self,
252        #[auth]
253        auth_: conjure_object::BearerToken,
254        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
255        request: super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsRequest,
256    ) -> Result<
257        super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsResponse,
258        conjure_http::private::Error,
259    >;
260    /// Best-effort cancellation of active compute requests. Each ID should be the request ID that
261    /// the client originally passed when starting the request. A single request may correspond to
262    /// one or more underlying operations, all of which will be cancelled.
263    #[endpoint(
264        method = POST,
265        path = "/compute/v2/compute/batch/kill",
266        name = "batchKillRequests"
267    )]
268    async fn batch_kill_requests(
269        &self,
270        #[auth]
271        auth_: conjure_object::BearerToken,
272        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
273        request: super::super::super::super::super::objects::scout::compute::api::BatchKillRequestsRequest,
274    ) -> Result<(), conjure_http::private::Error>;
275}
276/// The Compute Service provides the ability to compute the output of compute graphs.
277#[conjure_http::conjure_endpoints(
278    name = "ComputeService",
279    use_legacy_error_serialization,
280    local
281)]
282pub trait LocalAsyncComputeService {
283    /// Computes the output of the compute graph specified by a ComputeNodeRequest.
284    #[endpoint(
285        method = POST,
286        path = "/compute/v2/compute",
287        name = "compute",
288        produces = conjure_http::server::StdResponseSerializer
289    )]
290    async fn compute(
291        &self,
292        #[auth]
293        auth_: conjure_object::BearerToken,
294        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
295        request: super::super::super::super::super::objects::scout::compute::api::ComputeNodeRequest,
296    ) -> Result<
297        super::super::super::super::super::objects::scout::compute::api::ComputeNodeResponse,
298        conjure_http::private::Error,
299    >;
300    /// Computes the output of the compute graph specified by a ParameterizedComputeNodeRequest. A parameterized
301    /// compute request supports multiple values for a single variable, supplied by the ParameterizedContext.
302    /// Results are returned in the same order of the request.
303    #[endpoint(
304        method = POST,
305        path = "/compute/v2/compute/parameterized",
306        name = "parameterizedCompute",
307        produces = conjure_http::server::StdResponseSerializer
308    )]
309    async fn parameterized_compute(
310        &self,
311        #[auth]
312        auth_: conjure_object::BearerToken,
313        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
314        request: super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeRequest,
315    ) -> Result<
316        super::super::super::super::super::objects::scout::compute::api::ParameterizedComputeNodeResponse,
317        conjure_http::private::Error,
318    >;
319    /// Returns the resulting unit for the output of a compute graph. If the resulting unit is equivalent to exactly
320    /// one existing unit in the system, it will be returned (for example, a series in Coulombs divided by a series
321    /// in Volts will return an output of Farads). If the output does not have units (for example, a range output,)
322    /// the unit result will return noUnitAvailable, and if the computation was not successful, corresponding errors
323    /// are returned.
324    #[endpoint(
325        method = POST,
326        path = "/compute/v2/compute/units",
327        name = "computeUnits",
328        produces = conjure_http::server::StdResponseSerializer
329    )]
330    async fn compute_units(
331        &self,
332        #[auth]
333        auth_: conjure_object::BearerToken,
334        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
335        request: super::super::super::super::super::objects::scout::compute::api::ComputeUnitsRequest,
336    ) -> Result<
337        super::super::super::super::super::objects::scout::compute::api::ComputeUnitResult,
338        conjure_http::private::Error,
339    >;
340    /// Computes the output of compute graphs specified by BatchComputeNodeRequest. Results are returned in the same
341    /// order as the request.
342    #[endpoint(
343        method = POST,
344        path = "/compute/v2/compute/batch",
345        name = "batchComputeWithUnits",
346        produces = conjure_http::server::StdResponseSerializer
347    )]
348    async fn batch_compute_with_units(
349        &self,
350        #[auth]
351        auth_: conjure_object::BearerToken,
352        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
353        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsRequest,
354    ) -> Result<
355        super::super::super::super::super::objects::scout::compute::api::BatchComputeWithUnitsResponse,
356        conjure_http::private::Error,
357    >;
358    /// Same as computeUnits, however this endpoint functions on a batch of requests for wire efficiency purposes. An
359    /// extra note is that this method will serialize underlying conjure errors into the BatchComputeUnitResult type,
360    /// meaning callers are required to check for errors explicitly (rather than relying on exceptions being thrown).
361    #[endpoint(
362        method = POST,
363        path = "/compute/v2/compute/batch-units",
364        name = "batchComputeUnits",
365        produces = conjure_http::server::StdResponseSerializer
366    )]
367    async fn batch_compute_units(
368        &self,
369        #[auth]
370        auth_: conjure_object::BearerToken,
371        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
372        request: super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitsRequest,
373    ) -> Result<
374        super::super::super::super::super::objects::scout::compute::api::BatchComputeUnitResult,
375        conjure_http::private::Error,
376    >;
377    /// Computes the output of the compute graph specified by a ComputeNodeRequest, as well as providing the resulting
378    /// unit for the output of a compute graph. If the resulting unit is equivalent to exactly one existing unit in the
379    /// system, it will be returned (for example, a series in Coulombs divided by a series in Volts will return an
380    /// output of Farads). If the output does not have units (for example, a range output,) the unit result will return
381    /// noUnitAvailable, and if the computation was not successful, corresponding errors are returned.
382    #[endpoint(
383        method = POST,
384        path = "/compute/v2/computeWithUnits",
385        name = "computeWithUnits",
386        produces = conjure_http::server::StdResponseSerializer
387    )]
388    async fn compute_with_units(
389        &self,
390        #[auth]
391        auth_: conjure_object::BearerToken,
392        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
393        request: super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsRequest,
394    ) -> Result<
395        super::super::super::super::super::objects::scout::compute::api::ComputeWithUnitsResponse,
396        conjure_http::private::Error,
397    >;
398    /// Best-effort cancellation of active compute requests. Each ID should be the request ID that
399    /// the client originally passed when starting the request. A single request may correspond to
400    /// one or more underlying operations, all of which will be cancelled.
401    #[endpoint(
402        method = POST,
403        path = "/compute/v2/compute/batch/kill",
404        name = "batchKillRequests"
405    )]
406    async fn batch_kill_requests(
407        &self,
408        #[auth]
409        auth_: conjure_object::BearerToken,
410        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
411        request: super::super::super::super::super::objects::scout::compute::api::BatchKillRequestsRequest,
412    ) -> Result<(), conjure_http::private::Error>;
413}