em_client/
lib.rs

1/* Copyright (c) Fortanix, Inc.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#![allow(
7    missing_docs,
8    trivial_casts,
9    unused_variables,
10    unused_mut,
11    unused_imports,
12    unused_extern_crates,
13    non_camel_case_types,
14    unused_qualifications
15)]
16
17extern crate base64;
18#[macro_use]
19extern crate bitflags;
20#[macro_use]
21extern crate lazy_static;
22#[macro_use]
23extern crate log;
24#[macro_use]
25extern crate serde_derive;
26
27#[cfg(feature = "client")]
28#[macro_use]
29extern crate hyper;
30#[cfg(feature = "client")]
31#[macro_use]
32extern crate url;
33
34extern crate mime;
35extern crate serde;
36extern crate serde_json;
37
38extern crate chrono;
39extern crate futures;
40extern crate mbedtls;
41extern crate uuid;
42
43use futures::Stream;
44use std::convert::TryFrom;
45use std::error;
46use std::fmt;
47use std::io::Error;
48use std::ops::Deref;
49
50#[allow(unused_imports)]
51use std::collections::HashMap;
52
53#[cfg(feature = "client")]
54mod mimetypes;
55
56#[deprecated(note = "Import futures directly")]
57pub use futures::Future;
58
59pub const BASE_PATH: &'static str = "/v1";
60pub const API_VERSION: &'static str = "2.0.0";
61
62// https://en.wikipedia.org/wiki/SHA-2
63const SHA256_BYTE_LENGTH: usize = 32;
64
65const SHA256_CHAR_LENGTH: usize = SHA256_BYTE_LENGTH * 2;
66
67// Need to restore enum generation for multi-response request types
68
69/// Trait for decorating an implementation of the API with common
70/// pre/post-handling for all request types.
71///
72/// The ApiDecorator and ApiDispatch traits are similar. Only `ApiDispatch`
73/// (defined in `mod server`) has the `req` argument to `dispatch`. That
74/// aside, attmpting to combine them into a single trait would result in
75/// circular trait implementations `impl ApiDispatch for A: Api` and
76/// `impl Api for T: ApiDecorator`.
77
78pub trait ApiDecorator {
79    type Error;
80
81    fn dispatch<F, T>(&self, f: F) -> Result<T, Self::Error>
82    where
83        F: FnOnce(&dyn Api<Error = Self::Error>) -> Result<T, Self::Error>;
84}
85
86/// API trait with immutable receivers i.e. `fn api_call(&self, ...)`
87pub trait Api {
88    type Error;
89
90    /// Create a new account.
91    fn create_account(&self, body: models::AccountRequest) -> Result<models::Account, Self::Error>;
92
93    /// Delete an account.
94    fn delete_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
95
96    /// Get a specific account.
97    fn get_account(&self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error>;
98
99    /// Get all accounts.
100    fn get_accounts(&self) -> Result<models::AccountListResponse, Self::Error>;
101
102    /// Select a user's account to work on.
103    fn select_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
104
105    /// Update an account.
106    fn update_account(
107        &self,
108        account_id: uuid::Uuid,
109        body: models::AccountUpdateRequest,
110    ) -> Result<models::Account, Self::Error>;
111
112    /// Add an application.
113    fn add_application(&self, body: models::AppRequest) -> Result<models::App, Self::Error>;
114
115    /// Delete a particular app
116    fn delete_app(&self, app_id: uuid::Uuid) -> Result<(), Self::Error>;
117
118    /// Get all apps information.
119    fn get_all_apps(
120        &self,
121        name: Option<String>,
122        description: Option<String>,
123        all_search: Option<String>,
124        limit: Option<i32>,
125        offset: Option<i32>,
126        sort_by: Option<String>,
127    ) -> Result<models::GetAllAppsResponse, Self::Error>;
128
129    /// Get details of a particular app.
130    fn get_app(&self, app_id: uuid::Uuid) -> Result<models::App, Self::Error>;
131
132    /// Get an attested app's certificate.
133    fn get_app_certificate(
134        &self,
135        node_id: uuid::Uuid,
136        app_id: uuid::Uuid,
137    ) -> Result<models::Certificate, Self::Error>;
138
139    /// Get an app's certificate for a compute node.
140    fn get_app_node_certificate_details(
141        &self,
142        node_id: uuid::Uuid,
143        app_id: uuid::Uuid,
144    ) -> Result<models::CertificateDetails, Self::Error>;
145
146    /// Get all the unique labels across all the applications within selected account
147    fn get_apps_unique_labels(&self) -> Result<models::LabelsCount, Self::Error>;
148
149    /// Update details of a particular app.
150    fn update_app(
151        &self,
152        app_id: uuid::Uuid,
153        body: models::AppBodyUpdateRequest,
154    ) -> Result<models::App, Self::Error>;
155
156    /// Add an app config.
157    fn create_application_config(
158        &self,
159        body: models::ApplicationConfig,
160    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
161
162    /// Delete a particular app config
163    fn delete_application_config(&self, config_id: String) -> Result<(), Self::Error>;
164
165    /// Get all app configs
166    fn get_all_application_configs(
167        &self,
168        name: Option<String>,
169        description: Option<String>,
170        image_id: Option<uuid::Uuid>,
171        limit: Option<i32>,
172        offset: Option<i32>,
173    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error>;
174
175    /// Get details of a particular app config.
176    fn get_application_config(
177        &self,
178        config_id: String,
179    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
180
181    /// Get app config
182    fn get_runtime_application_config(
183        &self,
184        expected_hash: &[u8; 32],
185    ) -> Result<models::RuntimeAppConfig, Self::Error>;
186
187    /// Get details of a particular runtime app config.
188    fn get_specific_runtime_application_config(
189        &self,
190        config_id: String,
191    ) -> Result<models::RuntimeAppConfig, Self::Error>;
192
193    /// Update details of a particular app config.
194    fn update_application_config(
195        &self,
196        config_id: String,
197        body: models::UpdateApplicationConfigRequest,
198    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
199
200    /// Approve a request.
201    fn approve_approval_request(
202        &self,
203        request_id: uuid::Uuid,
204        body: Option<models::ApproveRequest>,
205    ) -> Result<models::ApprovalRequest, Self::Error>;
206
207    /// Create approval request.
208    fn create_approval_request(
209        &self,
210        body: models::ApprovalRequestRequest,
211    ) -> Result<models::ApprovalRequest, Self::Error>;
212
213    /// Delete an approval request.
214    fn delete_approval_request(&self, request_id: uuid::Uuid) -> Result<(), Self::Error>;
215
216    /// Deny a request.
217    fn deny_approval_request(
218        &self,
219        request_id: uuid::Uuid,
220        body: Option<models::DenyRequest>,
221    ) -> Result<models::ApprovalRequest, Self::Error>;
222
223    /// Get all approval requests
224    fn get_all_approval_requests(
225        &self,
226        requester: Option<uuid::Uuid>,
227        reviewer: Option<uuid::Uuid>,
228        subject: Option<uuid::Uuid>,
229        status: Option<String>,
230        all_search: Option<String>,
231        sort_by: Option<String>,
232        limit: Option<i32>,
233        offset: Option<i32>,
234    ) -> Result<models::GetAllApprovalRequests, Self::Error>;
235
236    /// Get an approval request.
237    fn get_approval_request(
238        &self,
239        request_id: uuid::Uuid,
240    ) -> Result<models::ApprovalRequest, Self::Error>;
241
242    /// Get the result for an approved or failed request.
243    fn get_approval_request_result(
244        &self,
245        request_id: uuid::Uuid,
246    ) -> Result<models::ApprovableResult, Self::Error>;
247
248    /// User authentication
249    fn authenticate_user(
250        &self,
251        body: Option<models::AuthRequest>,
252    ) -> Result<models::AuthResponse, Self::Error>;
253
254    /// Convert a docker image and create a new image.
255    fn convert_app_build(
256        &self,
257        body: models::ConvertAppBuildRequest,
258    ) -> Result<models::Build, Self::Error>;
259
260    /// Create a new image.
261    fn create_build(&self, body: models::CreateBuildRequest) -> Result<models::Build, Self::Error>;
262
263    /// Delete a particular image.
264    fn delete_build(&self, build_id: uuid::Uuid) -> Result<(), Self::Error>;
265
266    /// Get all images information.
267    fn get_all_builds(
268        &self,
269        all_search: Option<String>,
270        docker_image_name: Option<String>,
271        config_id: Option<String>,
272        deployed_status: Option<String>,
273        status: Option<String>,
274        limit: Option<i32>,
275        offset: Option<i32>,
276        sort_by: Option<String>,
277    ) -> Result<models::GetAllBuildsResponse, Self::Error>;
278
279    /// Get details of a particular image.
280    fn get_build(&self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error>;
281
282    /// Get all deployments of an image.
283    fn get_build_deployments(
284        &self,
285        build_id: uuid::Uuid,
286        status: Option<String>,
287        all_search: Option<String>,
288        sort_by: Option<String>,
289        limit: Option<i32>,
290        offset: Option<i32>,
291    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error>;
292
293    /// Update details of a particular image.
294    fn update_build(
295        &self,
296        build_id: uuid::Uuid,
297        body: models::BuildUpdateRequest,
298    ) -> Result<models::Build, Self::Error>;
299
300    /// Retrieve a certificate.
301    fn get_certificate(&self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error>;
302
303    /// Request a new certificate for an Enclave application
304    fn new_certificate(
305        &self,
306        body: models::NewCertificateRequest,
307    ) -> Result<models::TaskResult, Self::Error>;
308
309    fn create_dataset(
310        &self,
311        body: models::CreateDatasetRequest,
312    ) -> Result<models::Dataset, Self::Error>;
313
314    fn delete_dataset(&self, dataset_id: uuid::Uuid) -> Result<(), Self::Error>;
315
316    /// Get all datasets
317    fn get_all_datasets(
318        &self,
319        name: Option<String>,
320        description: Option<String>,
321        limit: Option<i32>,
322        offset: Option<i32>,
323    ) -> Result<models::GetAllDatasetsResponse, Self::Error>;
324
325    fn get_dataset(&self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error>;
326
327    fn update_dataset(
328        &self,
329        dataset_id: uuid::Uuid,
330        body: models::DatasetUpdateRequest,
331    ) -> Result<models::Dataset, Self::Error>;
332
333    /// Deactivate a particular compute node.
334    fn deactivate_node(&self, node_id: uuid::Uuid) -> Result<(), Self::Error>;
335
336    /// Get all compute nodes information.
337    fn get_all_nodes(
338        &self,
339        name: Option<String>,
340        description: Option<String>,
341        sgx_version: Option<String>,
342        all_search: Option<String>,
343        status: Option<String>,
344        limit: Option<i32>,
345        offset: Option<i32>,
346        sort_by: Option<String>,
347    ) -> Result<models::GetAllNodesResponse, Self::Error>;
348
349    /// Get details of a particular compute node.
350    fn get_node(&self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error>;
351
352    /// Get an attested compute node's certificate.
353    fn get_node_certificate(&self, node_id: uuid::Uuid)
354        -> Result<models::Certificate, Self::Error>;
355
356    /// Get a compute node's certificate.
357    fn get_node_certificate_details(
358        &self,
359        node_id: uuid::Uuid,
360    ) -> Result<models::CertificateDetails, Self::Error>;
361
362    /// Get all the unique labels across all the nodes within selected account
363    fn get_nodes_unique_labels(&self) -> Result<models::LabelsCount, Self::Error>;
364
365    /// Provision a new compute node.
366    fn provision_node(
367        &self,
368        body: models::NodeProvisionRequest,
369    ) -> Result<models::TaskResult, Self::Error>;
370
371    /// Update details of a particular compute node.
372    fn update_node(
373        &self,
374        node_id: uuid::Uuid,
375        body: models::NodeUpdateRequest,
376    ) -> Result<models::Node, Self::Error>;
377
378    /// Called periodically by a compute node.
379    fn update_node_status(
380        &self,
381        body: models::NodeStatusRequest,
382    ) -> Result<models::NodeStatusResponse, Self::Error>;
383
384    /// Add a new registry to an account
385    fn create_registry(
386        &self,
387        registry_request: models::RegistryRequest,
388    ) -> Result<models::Registry, Self::Error>;
389
390    /// Delete registry
391    fn delete_registry(&self, registry_id: uuid::Uuid) -> Result<(), Self::Error>;
392
393    /// Get details of all registry in the account
394    fn get_all_registries(&self) -> Result<Vec<models::Registry>, Self::Error>;
395
396    /// Get details of a particular registry
397    fn get_registry(&self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error>;
398
399    /// Get details of the registry that will be used for the particular app images
400    fn get_registry_for_app(
401        &self,
402        app_id: uuid::Uuid,
403    ) -> Result<models::AppRegistryResponse, Self::Error>;
404
405    /// Get details of the registry that will be used for the particular image
406    fn get_registry_for_image(
407        &self,
408        image_name: String,
409    ) -> Result<models::ImageRegistryResponse, Self::Error>;
410
411    /// Update a particular registry details
412    fn update_registry(
413        &self,
414        registry_id: uuid::Uuid,
415        body: models::UpdateRegistryRequest,
416    ) -> Result<models::Registry, Self::Error>;
417
418    /// Get Manager Version.
419    fn get_manager_version(&self) -> Result<models::VersionResponse, Self::Error>;
420
421    /// Get all the tasks.
422    fn get_all_tasks(
423        &self,
424        task_type: Option<String>,
425        status: Option<String>,
426        requester: Option<String>,
427        approver: Option<String>,
428        all_search: Option<String>,
429        limit: Option<i32>,
430        offset: Option<i32>,
431        sort_by: Option<String>,
432        base_filters: Option<String>,
433    ) -> Result<models::GetAllTasksResponse, Self::Error>;
434
435    /// Get details of a particular task.
436    fn get_task(&self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error>;
437
438    /// Get status and result of a particular task.
439    fn get_task_status(&self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error>;
440
441    /// Update status of approver and task.
442    fn update_task(
443        &self,
444        task_id: uuid::Uuid,
445        body: models::TaskUpdateRequest,
446    ) -> Result<models::TaskResult, Self::Error>;
447
448    /// Convert an application to run in EnclaveOS.
449    fn convert_app(
450        &self,
451        body: models::ConversionRequest,
452    ) -> Result<models::ConversionResponse, Self::Error>;
453
454    /// Current user accepts latest terms and conditions.
455    fn accept_terms_and_conditions(&self) -> Result<(), Self::Error>;
456
457    /// Change user password.
458    fn change_password(&self, body: models::PasswordChangeRequest) -> Result<(), Self::Error>;
459
460    /// Confirms user's email address.
461    fn confirm_email(
462        &self,
463        body: models::ConfirmEmailRequest,
464    ) -> Result<models::ConfirmEmailResponse, Self::Error>;
465
466    /// Create a new user.
467    fn create_user(&self, body: models::SignupRequest) -> Result<models::User, Self::Error>;
468
469    /// Completely delete a user profile from system
470    fn delete_user_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
471
472    /// Removed user's association with an account.
473    fn delete_user_from_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
474
475    /// Initiate password reset sequence for a user.
476    fn forgot_password(&self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error>;
477
478    /// Get all user's information.
479    fn get_all_users(
480        &self,
481        all_search: Option<String>,
482        limit: Option<i32>,
483        offset: Option<i32>,
484        sort_by: Option<String>,
485    ) -> Result<models::GetAllUsersResponse, Self::Error>;
486
487    /// Get details of the current logged in user.
488    fn get_logged_in_user(&self) -> Result<models::User, Self::Error>;
489
490    /// Get details of a particular user.
491    fn get_user(&self, user_id: uuid::Uuid) -> Result<models::User, Self::Error>;
492
493    /// Invite a user.
494    fn invite_user(&self, body: models::InviteUserRequest) -> Result<models::User, Self::Error>;
495
496    /// Process a user's pending account invitations.
497    fn process_invitations(&self, body: models::ProcessInviteRequest) -> Result<(), Self::Error>;
498
499    /// Resend email with link to confirm user's email address.
500    fn resend_confirm_email(&self) -> Result<(), Self::Error>;
501
502    /// Resend invite to the user to join a specific account.
503    fn resend_invitation(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
504
505    /// Reset a user's password.
506    fn reset_password(
507        &self,
508        user_id: uuid::Uuid,
509        body: models::PasswordResetRequest,
510    ) -> Result<(), Self::Error>;
511
512    /// Update status, name, and the role of a user. User with MANAGER access role can only update another user.
513    fn update_user(
514        &self,
515        user_id: uuid::Uuid,
516        body: models::UpdateUserRequest,
517    ) -> Result<models::User, Self::Error>;
518
519    /// Validates password reset token for the user.
520    fn validate_password_reset_token(
521        &self,
522        user_id: uuid::Uuid,
523        body: models::ValidateTokenRequest,
524    ) -> Result<models::ValidateTokenResponse, Self::Error>;
525
526    fn create_workflow_graph(
527        &self,
528        body: models::CreateWorkflowGraph,
529    ) -> Result<models::WorkflowGraph, Self::Error>;
530
531    /// Delete a particular draft workflow
532    fn delete_workflow_graph(&self, graph_id: uuid::Uuid) -> Result<(), Self::Error>;
533
534    fn get_all_workflow_graphs(
535        &self,
536        name: Option<String>,
537        description: Option<String>,
538        all_search: Option<String>,
539        parent_graph_id: Option<String>,
540        sort_by: Option<String>,
541        limit: Option<i32>,
542        offset: Option<i32>,
543    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error>;
544
545    /// Get details of a particular draft workflow
546    fn get_workflow_graph(
547        &self,
548        graph_id: uuid::Uuid,
549    ) -> Result<models::WorkflowGraph, Self::Error>;
550
551    fn update_workflow_graph(
552        &self,
553        graph_id: uuid::Uuid,
554        body: models::UpdateWorkflowGraph,
555    ) -> Result<models::WorkflowGraph, Self::Error>;
556
557    fn create_final_workflow_graph(
558        &self,
559        body: models::CreateFinalWorkflowGraph,
560    ) -> Result<models::FinalWorkflow, Self::Error>;
561
562    /// Delete a particular final workflow
563    fn delete_final_workflow_graph(
564        &self,
565        graph_id: uuid::Uuid,
566        version: String,
567    ) -> Result<(), Self::Error>;
568
569    fn get_all_final_workflow_graphs(
570        &self,
571        name: Option<String>,
572        description: Option<String>,
573        all_search: Option<String>,
574        sort_by: Option<String>,
575        limit: Option<i32>,
576        offset: Option<i32>,
577    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error>;
578
579    /// Get details of a particular final workflow version
580    fn get_final_workflow_graph(
581        &self,
582        graph_id: uuid::Uuid,
583        version: String,
584    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
585
586    /// Get details of a particular final workflow
587    fn get_full_final_workflow_graph(
588        &self,
589        graph_id: uuid::Uuid,
590    ) -> Result<models::FinalWorkflow, Self::Error>;
591
592    /// Create a new version for a particular final workflow
593    fn update_final_workflow_graph(
594        &self,
595        graph_id: uuid::Uuid,
596        body: models::CreateWorkflowVersionRequest,
597    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
598
599    /// Get zone details.
600    fn get_zone(&self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error>;
601
602    /// Get the authentication token.
603    fn get_zone_join_token(
604        &self,
605        zone_id: uuid::Uuid,
606    ) -> Result<models::ZoneJoinToken, Self::Error>;
607
608    /// Get all zones.
609    fn get_zones(&self) -> Result<Vec<models::Zone>, Self::Error>;
610}
611
612/// API trait with mutable receivers i.e. `fn api_call(&mut self, ...)`
613pub trait ApiMut {
614    type Error;
615
616    /// Create a new account.
617    fn create_account(
618        &mut self,
619        body: models::AccountRequest,
620    ) -> Result<models::Account, Self::Error>;
621
622    /// Delete an account.
623    fn delete_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
624
625    /// Get a specific account.
626    fn get_account(&mut self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error>;
627
628    /// Get all accounts.
629    fn get_accounts(&mut self) -> Result<models::AccountListResponse, Self::Error>;
630
631    /// Select a user's account to work on.
632    fn select_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
633
634    /// Update an account.
635    fn update_account(
636        &mut self,
637        account_id: uuid::Uuid,
638        body: models::AccountUpdateRequest,
639    ) -> Result<models::Account, Self::Error>;
640
641    /// Add an application.
642    fn add_application(&mut self, body: models::AppRequest) -> Result<models::App, Self::Error>;
643
644    /// Delete a particular app
645    fn delete_app(&mut self, app_id: uuid::Uuid) -> Result<(), Self::Error>;
646
647    /// Get all apps information.
648    fn get_all_apps(
649        &mut self,
650        name: Option<String>,
651        description: Option<String>,
652        all_search: Option<String>,
653        limit: Option<i32>,
654        offset: Option<i32>,
655        sort_by: Option<String>,
656    ) -> Result<models::GetAllAppsResponse, Self::Error>;
657
658    /// Get details of a particular app.
659    fn get_app(&mut self, app_id: uuid::Uuid) -> Result<models::App, Self::Error>;
660
661    /// Get an attested app's certificate.
662    fn get_app_certificate(
663        &mut self,
664        node_id: uuid::Uuid,
665        app_id: uuid::Uuid,
666    ) -> Result<models::Certificate, Self::Error>;
667
668    /// Get an app's certificate for a compute node.
669    fn get_app_node_certificate_details(
670        &mut self,
671        node_id: uuid::Uuid,
672        app_id: uuid::Uuid,
673    ) -> Result<models::CertificateDetails, Self::Error>;
674
675    /// Get all the unique labels across all the applications within selected account
676    fn get_apps_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error>;
677
678    /// Update details of a particular app.
679    fn update_app(
680        &mut self,
681        app_id: uuid::Uuid,
682        body: models::AppBodyUpdateRequest,
683    ) -> Result<models::App, Self::Error>;
684
685    /// Add an app config.
686    fn create_application_config(
687        &mut self,
688        body: models::ApplicationConfig,
689    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
690
691    /// Delete a particular app config
692    fn delete_application_config(&mut self, config_id: String) -> Result<(), Self::Error>;
693
694    /// Get all app configs
695    fn get_all_application_configs(
696        &mut self,
697        name: Option<String>,
698        description: Option<String>,
699        image_id: Option<uuid::Uuid>,
700        limit: Option<i32>,
701        offset: Option<i32>,
702    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error>;
703
704    /// Get details of a particular app config.
705    fn get_application_config(
706        &mut self,
707        config_id: String,
708    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
709
710    /// Get app config
711    fn get_runtime_application_config(
712        &mut self,
713        expected_hash: &[u8; 32],
714    ) -> Result<models::RuntimeAppConfig, Self::Error>;
715
716    /// Get details of a particular runtime app config.
717    fn get_specific_runtime_application_config(
718        &mut self,
719        config_id: String,
720    ) -> Result<models::RuntimeAppConfig, Self::Error>;
721
722    /// Update details of a particular app config.
723    fn update_application_config(
724        &mut self,
725        config_id: String,
726        body: models::UpdateApplicationConfigRequest,
727    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
728
729    /// Approve a request.
730    fn approve_approval_request(
731        &mut self,
732        request_id: uuid::Uuid,
733        body: Option<models::ApproveRequest>,
734    ) -> Result<models::ApprovalRequest, Self::Error>;
735
736    /// Create approval request.
737    fn create_approval_request(
738        &mut self,
739        body: models::ApprovalRequestRequest,
740    ) -> Result<models::ApprovalRequest, Self::Error>;
741
742    /// Delete an approval request.
743    fn delete_approval_request(&mut self, request_id: uuid::Uuid) -> Result<(), Self::Error>;
744
745    /// Deny a request.
746    fn deny_approval_request(
747        &mut self,
748        request_id: uuid::Uuid,
749        body: Option<models::DenyRequest>,
750    ) -> Result<models::ApprovalRequest, Self::Error>;
751
752    /// Get all approval requests
753    fn get_all_approval_requests(
754        &mut self,
755        requester: Option<uuid::Uuid>,
756        reviewer: Option<uuid::Uuid>,
757        subject: Option<uuid::Uuid>,
758        status: Option<String>,
759        all_search: Option<String>,
760        sort_by: Option<String>,
761        limit: Option<i32>,
762        offset: Option<i32>,
763    ) -> Result<models::GetAllApprovalRequests, Self::Error>;
764
765    /// Get an approval request.
766    fn get_approval_request(
767        &mut self,
768        request_id: uuid::Uuid,
769    ) -> Result<models::ApprovalRequest, Self::Error>;
770
771    /// Get the result for an approved or failed request.
772    fn get_approval_request_result(
773        &mut self,
774        request_id: uuid::Uuid,
775    ) -> Result<models::ApprovableResult, Self::Error>;
776
777    /// User authentication
778    fn authenticate_user(
779        &mut self,
780        body: Option<models::AuthRequest>,
781    ) -> Result<models::AuthResponse, Self::Error>;
782
783    /// Convert a docker image and create a new image.
784    fn convert_app_build(
785        &mut self,
786        body: models::ConvertAppBuildRequest,
787    ) -> Result<models::Build, Self::Error>;
788
789    /// Create a new image.
790    fn create_build(
791        &mut self,
792        body: models::CreateBuildRequest,
793    ) -> Result<models::Build, Self::Error>;
794
795    /// Delete a particular image.
796    fn delete_build(&mut self, build_id: uuid::Uuid) -> Result<(), Self::Error>;
797
798    /// Get all images information.
799    fn get_all_builds(
800        &mut self,
801        all_search: Option<String>,
802        docker_image_name: Option<String>,
803        config_id: Option<String>,
804        deployed_status: Option<String>,
805        status: Option<String>,
806        limit: Option<i32>,
807        offset: Option<i32>,
808        sort_by: Option<String>,
809    ) -> Result<models::GetAllBuildsResponse, Self::Error>;
810
811    /// Get details of a particular image.
812    fn get_build(&mut self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error>;
813
814    /// Get all deployments of an image.
815    fn get_build_deployments(
816        &mut self,
817        build_id: uuid::Uuid,
818        status: Option<String>,
819        all_search: Option<String>,
820        sort_by: Option<String>,
821        limit: Option<i32>,
822        offset: Option<i32>,
823    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error>;
824
825    /// Update details of a particular image.
826    fn update_build(
827        &mut self,
828        build_id: uuid::Uuid,
829        body: models::BuildUpdateRequest,
830    ) -> Result<models::Build, Self::Error>;
831
832    /// Retrieve a certificate.
833    fn get_certificate(&mut self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error>;
834
835    /// Request a new certificate for an Enclave application
836    fn new_certificate(
837        &mut self,
838        body: models::NewCertificateRequest,
839    ) -> Result<models::TaskResult, Self::Error>;
840
841    fn create_dataset(
842        &mut self,
843        body: models::CreateDatasetRequest,
844    ) -> Result<models::Dataset, Self::Error>;
845
846    fn delete_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<(), Self::Error>;
847
848    /// Get all datasets
849    fn get_all_datasets(
850        &mut self,
851        name: Option<String>,
852        description: Option<String>,
853        limit: Option<i32>,
854        offset: Option<i32>,
855    ) -> Result<models::GetAllDatasetsResponse, Self::Error>;
856
857    fn get_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error>;
858
859    fn update_dataset(
860        &mut self,
861        dataset_id: uuid::Uuid,
862        body: models::DatasetUpdateRequest,
863    ) -> Result<models::Dataset, Self::Error>;
864
865    /// Deactivate a particular compute node.
866    fn deactivate_node(&mut self, node_id: uuid::Uuid) -> Result<(), Self::Error>;
867
868    /// Get all compute nodes information.
869    fn get_all_nodes(
870        &mut self,
871        name: Option<String>,
872        description: Option<String>,
873        sgx_version: Option<String>,
874        all_search: Option<String>,
875        status: Option<String>,
876        limit: Option<i32>,
877        offset: Option<i32>,
878        sort_by: Option<String>,
879    ) -> Result<models::GetAllNodesResponse, Self::Error>;
880
881    /// Get details of a particular compute node.
882    fn get_node(&mut self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error>;
883
884    /// Get an attested compute node's certificate.
885    fn get_node_certificate(
886        &mut self,
887        node_id: uuid::Uuid,
888    ) -> Result<models::Certificate, Self::Error>;
889
890    /// Get a compute node's certificate.
891    fn get_node_certificate_details(
892        &mut self,
893        node_id: uuid::Uuid,
894    ) -> Result<models::CertificateDetails, Self::Error>;
895
896    /// Get all the unique labels across all the nodes within selected account
897    fn get_nodes_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error>;
898
899    /// Provision a new compute node.
900    fn provision_node(
901        &mut self,
902        body: models::NodeProvisionRequest,
903    ) -> Result<models::TaskResult, Self::Error>;
904
905    /// Update details of a particular compute node.
906    fn update_node(
907        &mut self,
908        node_id: uuid::Uuid,
909        body: models::NodeUpdateRequest,
910    ) -> Result<models::Node, Self::Error>;
911
912    /// Called periodically by a compute node.
913    fn update_node_status(
914        &mut self,
915        body: models::NodeStatusRequest,
916    ) -> Result<models::NodeStatusResponse, Self::Error>;
917
918    /// Add a new registry to an account
919    fn create_registry(
920        &mut self,
921        registry_request: models::RegistryRequest,
922    ) -> Result<models::Registry, Self::Error>;
923
924    /// Delete registry
925    fn delete_registry(&mut self, registry_id: uuid::Uuid) -> Result<(), Self::Error>;
926
927    /// Get details of all registry in the account
928    fn get_all_registries(&mut self) -> Result<Vec<models::Registry>, Self::Error>;
929
930    /// Get details of a particular registry
931    fn get_registry(&mut self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error>;
932
933    /// Get details of the registry that will be used for the particular app images
934    fn get_registry_for_app(
935        &mut self,
936        app_id: uuid::Uuid,
937    ) -> Result<models::AppRegistryResponse, Self::Error>;
938
939    /// Get details of the registry that will be used for the particular image
940    fn get_registry_for_image(
941        &mut self,
942        image_name: String,
943    ) -> Result<models::ImageRegistryResponse, Self::Error>;
944
945    /// Update a particular registry details
946    fn update_registry(
947        &mut self,
948        registry_id: uuid::Uuid,
949        body: models::UpdateRegistryRequest,
950    ) -> Result<models::Registry, Self::Error>;
951
952    /// Get Manager Version.
953    fn get_manager_version(&mut self) -> Result<models::VersionResponse, Self::Error>;
954
955    /// Get all the tasks.
956    fn get_all_tasks(
957        &mut self,
958        task_type: Option<String>,
959        status: Option<String>,
960        requester: Option<String>,
961        approver: Option<String>,
962        all_search: Option<String>,
963        limit: Option<i32>,
964        offset: Option<i32>,
965        sort_by: Option<String>,
966        base_filters: Option<String>,
967    ) -> Result<models::GetAllTasksResponse, Self::Error>;
968
969    /// Get details of a particular task.
970    fn get_task(&mut self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error>;
971
972    /// Get status and result of a particular task.
973    fn get_task_status(&mut self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error>;
974
975    /// Update status of approver and task.
976    fn update_task(
977        &mut self,
978        task_id: uuid::Uuid,
979        body: models::TaskUpdateRequest,
980    ) -> Result<models::TaskResult, Self::Error>;
981
982    /// Convert an application to run in EnclaveOS.
983    fn convert_app(
984        &mut self,
985        body: models::ConversionRequest,
986    ) -> Result<models::ConversionResponse, Self::Error>;
987
988    /// Current user accepts latest terms and conditions.
989    fn accept_terms_and_conditions(&mut self) -> Result<(), Self::Error>;
990
991    /// Change user password.
992    fn change_password(&mut self, body: models::PasswordChangeRequest) -> Result<(), Self::Error>;
993
994    /// Confirms user's email address.
995    fn confirm_email(
996        &mut self,
997        body: models::ConfirmEmailRequest,
998    ) -> Result<models::ConfirmEmailResponse, Self::Error>;
999
1000    /// Create a new user.
1001    fn create_user(&mut self, body: models::SignupRequest) -> Result<models::User, Self::Error>;
1002
1003    /// Completely delete a user profile from system
1004    fn delete_user_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
1005
1006    /// Removed user's association with an account.
1007    fn delete_user_from_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
1008
1009    /// Initiate password reset sequence for a user.
1010    fn forgot_password(&mut self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error>;
1011
1012    /// Get all user's information.
1013    fn get_all_users(
1014        &mut self,
1015        all_search: Option<String>,
1016        limit: Option<i32>,
1017        offset: Option<i32>,
1018        sort_by: Option<String>,
1019    ) -> Result<models::GetAllUsersResponse, Self::Error>;
1020
1021    /// Get details of the current logged in user.
1022    fn get_logged_in_user(&mut self) -> Result<models::User, Self::Error>;
1023
1024    /// Get details of a particular user.
1025    fn get_user(&mut self, user_id: uuid::Uuid) -> Result<models::User, Self::Error>;
1026
1027    /// Invite a user.
1028    fn invite_user(&mut self, body: models::InviteUserRequest)
1029        -> Result<models::User, Self::Error>;
1030
1031    /// Process a user's pending account invitations.
1032    fn process_invitations(
1033        &mut self,
1034        body: models::ProcessInviteRequest,
1035    ) -> Result<(), Self::Error>;
1036
1037    /// Resend email with link to confirm user's email address.
1038    fn resend_confirm_email(&mut self) -> Result<(), Self::Error>;
1039
1040    /// Resend invite to the user to join a specific account.
1041    fn resend_invitation(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
1042
1043    /// Reset a user's password.
1044    fn reset_password(
1045        &mut self,
1046        user_id: uuid::Uuid,
1047        body: models::PasswordResetRequest,
1048    ) -> Result<(), Self::Error>;
1049
1050    /// Update status, name, and the role of a user. User with MANAGER access role can only update another user.
1051    fn update_user(
1052        &mut self,
1053        user_id: uuid::Uuid,
1054        body: models::UpdateUserRequest,
1055    ) -> Result<models::User, Self::Error>;
1056
1057    /// Validates password reset token for the user.
1058    fn validate_password_reset_token(
1059        &mut self,
1060        user_id: uuid::Uuid,
1061        body: models::ValidateTokenRequest,
1062    ) -> Result<models::ValidateTokenResponse, Self::Error>;
1063
1064    fn create_workflow_graph(
1065        &mut self,
1066        body: models::CreateWorkflowGraph,
1067    ) -> Result<models::WorkflowGraph, Self::Error>;
1068
1069    /// Delete a particular draft workflow
1070    fn delete_workflow_graph(&mut self, graph_id: uuid::Uuid) -> Result<(), Self::Error>;
1071
1072    fn get_all_workflow_graphs(
1073        &mut self,
1074        name: Option<String>,
1075        description: Option<String>,
1076        all_search: Option<String>,
1077        parent_graph_id: Option<String>,
1078        sort_by: Option<String>,
1079        limit: Option<i32>,
1080        offset: Option<i32>,
1081    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error>;
1082
1083    /// Get details of a particular draft workflow
1084    fn get_workflow_graph(
1085        &mut self,
1086        graph_id: uuid::Uuid,
1087    ) -> Result<models::WorkflowGraph, Self::Error>;
1088
1089    fn update_workflow_graph(
1090        &mut self,
1091        graph_id: uuid::Uuid,
1092        body: models::UpdateWorkflowGraph,
1093    ) -> Result<models::WorkflowGraph, Self::Error>;
1094
1095    fn create_final_workflow_graph(
1096        &mut self,
1097        body: models::CreateFinalWorkflowGraph,
1098    ) -> Result<models::FinalWorkflow, Self::Error>;
1099
1100    /// Delete a particular final workflow
1101    fn delete_final_workflow_graph(
1102        &mut self,
1103        graph_id: uuid::Uuid,
1104        version: String,
1105    ) -> Result<(), Self::Error>;
1106
1107    fn get_all_final_workflow_graphs(
1108        &mut self,
1109        name: Option<String>,
1110        description: Option<String>,
1111        all_search: Option<String>,
1112        sort_by: Option<String>,
1113        limit: Option<i32>,
1114        offset: Option<i32>,
1115    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error>;
1116
1117    /// Get details of a particular final workflow version
1118    fn get_final_workflow_graph(
1119        &mut self,
1120        graph_id: uuid::Uuid,
1121        version: String,
1122    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
1123
1124    /// Get details of a particular final workflow
1125    fn get_full_final_workflow_graph(
1126        &mut self,
1127        graph_id: uuid::Uuid,
1128    ) -> Result<models::FinalWorkflow, Self::Error>;
1129
1130    /// Create a new version for a particular final workflow
1131    fn update_final_workflow_graph(
1132        &mut self,
1133        graph_id: uuid::Uuid,
1134        body: models::CreateWorkflowVersionRequest,
1135    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
1136
1137    /// Get zone details.
1138    fn get_zone(&mut self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error>;
1139
1140    /// Get the authentication token.
1141    fn get_zone_join_token(
1142        &mut self,
1143        zone_id: uuid::Uuid,
1144    ) -> Result<models::ZoneJoinToken, Self::Error>;
1145
1146    /// Get all zones.
1147    fn get_zones(&mut self) -> Result<Vec<models::Zone>, Self::Error>;
1148}
1149
1150/*
1151 * We want to implement Api for types that implement each of the API category
1152 * traits individually. We do this indirectly via ApiDecorator and a wrapper
1153 * type ApiCombiner, because the compiler won't allow two blanket `for T`
1154 * implementations of the same trait (the trait bounds are not sufficent to
1155 * ensure that the two implementations can never overlap).
1156 */
1157
1158pub struct ApiCombiner<'a, T>(&'a T);
1159
1160impl<T, E> ApiDecorator for T
1161where
1162    T: AccountsApi<Error = E>
1163        + AppApi<Error = E>
1164        + ApplicationConfigApi<Error = E>
1165        + ApprovalRequestsApi<Error = E>
1166        + AuthApi<Error = E>
1167        + BuildApi<Error = E>
1168        + CertificateApi<Error = E>
1169        + DatasetApi<Error = E>
1170        + NodeApi<Error = E>
1171        + RegistryApi<Error = E>
1172        + SystemApi<Error = E>
1173        + TaskApi<Error = E>
1174        + ToolsApi<Error = E>
1175        + UsersApi<Error = E>
1176        + WorkflowApi<Error = E>
1177        + WorkflowFinalApi<Error = E>
1178        + ZoneApi<Error = E>,
1179{
1180    type Error = E;
1181
1182    fn dispatch<F, U>(&self, f: F) -> Result<U, Self::Error>
1183    where
1184        F: FnOnce(&dyn Api<Error = E>) -> Result<U, Self::Error>,
1185    {
1186        f(&ApiCombiner(self))
1187    }
1188}
1189
1190/// Implements with functions of the form `fn api_call(self, ...) { CategoryApi::api_call(self.0, ...) }`
1191impl<'a, T, E> Api for ApiCombiner<'a, T>
1192where
1193    T: AccountsApi<Error = E>
1194        + AppApi<Error = E>
1195        + ApplicationConfigApi<Error = E>
1196        + ApprovalRequestsApi<Error = E>
1197        + AuthApi<Error = E>
1198        + BuildApi<Error = E>
1199        + CertificateApi<Error = E>
1200        + DatasetApi<Error = E>
1201        + NodeApi<Error = E>
1202        + RegistryApi<Error = E>
1203        + SystemApi<Error = E>
1204        + TaskApi<Error = E>
1205        + ToolsApi<Error = E>
1206        + UsersApi<Error = E>
1207        + WorkflowApi<Error = E>
1208        + WorkflowFinalApi<Error = E>
1209        + ZoneApi<Error = E>
1210        + 'a,
1211{
1212    type Error = E;
1213
1214    fn create_account(&self, body: models::AccountRequest) -> Result<models::Account, Self::Error> {
1215        AccountsApi::create_account(self.0, body)
1216    }
1217
1218    fn delete_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
1219        AccountsApi::delete_account(self.0, account_id)
1220    }
1221
1222    fn get_account(&self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error> {
1223        AccountsApi::get_account(self.0, account_id)
1224    }
1225
1226    fn get_accounts(&self) -> Result<models::AccountListResponse, Self::Error> {
1227        AccountsApi::get_accounts(self.0)
1228    }
1229
1230    fn select_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
1231        AccountsApi::select_account(self.0, account_id)
1232    }
1233
1234    fn update_account(
1235        &self,
1236        account_id: uuid::Uuid,
1237        body: models::AccountUpdateRequest,
1238    ) -> Result<models::Account, Self::Error> {
1239        AccountsApi::update_account(self.0, account_id, body)
1240    }
1241
1242    fn add_application(&self, body: models::AppRequest) -> Result<models::App, Self::Error> {
1243        AppApi::add_application(self.0, body)
1244    }
1245
1246    fn delete_app(&self, app_id: uuid::Uuid) -> Result<(), Self::Error> {
1247        AppApi::delete_app(self.0, app_id)
1248    }
1249
1250    fn get_all_apps(
1251        &self,
1252        name: Option<String>,
1253        description: Option<String>,
1254        all_search: Option<String>,
1255        limit: Option<i32>,
1256        offset: Option<i32>,
1257        sort_by: Option<String>,
1258    ) -> Result<models::GetAllAppsResponse, Self::Error> {
1259        AppApi::get_all_apps(
1260            self.0,
1261            name,
1262            description,
1263            all_search,
1264            limit,
1265            offset,
1266            sort_by,
1267        )
1268    }
1269
1270    fn get_app(&self, app_id: uuid::Uuid) -> Result<models::App, Self::Error> {
1271        AppApi::get_app(self.0, app_id)
1272    }
1273
1274    fn get_app_certificate(
1275        &self,
1276        node_id: uuid::Uuid,
1277        app_id: uuid::Uuid,
1278    ) -> Result<models::Certificate, Self::Error> {
1279        AppApi::get_app_certificate(self.0, node_id, app_id)
1280    }
1281
1282    fn get_app_node_certificate_details(
1283        &self,
1284        node_id: uuid::Uuid,
1285        app_id: uuid::Uuid,
1286    ) -> Result<models::CertificateDetails, Self::Error> {
1287        AppApi::get_app_node_certificate_details(self.0, node_id, app_id)
1288    }
1289
1290    fn get_apps_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
1291        AppApi::get_apps_unique_labels(self.0)
1292    }
1293
1294    fn update_app(
1295        &self,
1296        app_id: uuid::Uuid,
1297        body: models::AppBodyUpdateRequest,
1298    ) -> Result<models::App, Self::Error> {
1299        AppApi::update_app(self.0, app_id, body)
1300    }
1301
1302    fn create_application_config(
1303        &self,
1304        body: models::ApplicationConfig,
1305    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
1306        ApplicationConfigApi::create_application_config(self.0, body)
1307    }
1308
1309    fn delete_application_config(&self, config_id: String) -> Result<(), Self::Error> {
1310        ApplicationConfigApi::delete_application_config(self.0, config_id)
1311    }
1312
1313    fn get_all_application_configs(
1314        &self,
1315        name: Option<String>,
1316        description: Option<String>,
1317        image_id: Option<uuid::Uuid>,
1318        limit: Option<i32>,
1319        offset: Option<i32>,
1320    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error> {
1321        ApplicationConfigApi::get_all_application_configs(
1322            self.0,
1323            name,
1324            description,
1325            image_id,
1326            limit,
1327            offset,
1328        )
1329    }
1330
1331    fn get_application_config(
1332        &self,
1333        config_id: String,
1334    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
1335        ApplicationConfigApi::get_application_config(self.0, config_id)
1336    }
1337
1338    fn get_runtime_application_config(
1339        &self,
1340        expected_hash: &[u8; 32],
1341    ) -> Result<models::RuntimeAppConfig, Self::Error> {
1342        ApplicationConfigApi::get_runtime_application_config(self.0, expected_hash)
1343    }
1344
1345    fn get_specific_runtime_application_config(
1346        &self,
1347        config_id: String,
1348    ) -> Result<models::RuntimeAppConfig, Self::Error> {
1349        ApplicationConfigApi::get_specific_runtime_application_config(self.0, config_id)
1350    }
1351
1352    fn update_application_config(
1353        &self,
1354        config_id: String,
1355        body: models::UpdateApplicationConfigRequest,
1356    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
1357        ApplicationConfigApi::update_application_config(self.0, config_id, body)
1358    }
1359
1360    fn approve_approval_request(
1361        &self,
1362        request_id: uuid::Uuid,
1363        body: Option<models::ApproveRequest>,
1364    ) -> Result<models::ApprovalRequest, Self::Error> {
1365        ApprovalRequestsApi::approve_approval_request(self.0, request_id, body)
1366    }
1367
1368    fn create_approval_request(
1369        &self,
1370        body: models::ApprovalRequestRequest,
1371    ) -> Result<models::ApprovalRequest, Self::Error> {
1372        ApprovalRequestsApi::create_approval_request(self.0, body)
1373    }
1374
1375    fn delete_approval_request(&self, request_id: uuid::Uuid) -> Result<(), Self::Error> {
1376        ApprovalRequestsApi::delete_approval_request(self.0, request_id)
1377    }
1378
1379    fn deny_approval_request(
1380        &self,
1381        request_id: uuid::Uuid,
1382        body: Option<models::DenyRequest>,
1383    ) -> Result<models::ApprovalRequest, Self::Error> {
1384        ApprovalRequestsApi::deny_approval_request(self.0, request_id, body)
1385    }
1386
1387    fn get_all_approval_requests(
1388        &self,
1389        requester: Option<uuid::Uuid>,
1390        reviewer: Option<uuid::Uuid>,
1391        subject: Option<uuid::Uuid>,
1392        status: Option<String>,
1393        all_search: Option<String>,
1394        sort_by: Option<String>,
1395        limit: Option<i32>,
1396        offset: Option<i32>,
1397    ) -> Result<models::GetAllApprovalRequests, Self::Error> {
1398        ApprovalRequestsApi::get_all_approval_requests(
1399            self.0, requester, reviewer, subject, status, all_search, sort_by, limit, offset,
1400        )
1401    }
1402
1403    fn get_approval_request(
1404        &self,
1405        request_id: uuid::Uuid,
1406    ) -> Result<models::ApprovalRequest, Self::Error> {
1407        ApprovalRequestsApi::get_approval_request(self.0, request_id)
1408    }
1409
1410    fn get_approval_request_result(
1411        &self,
1412        request_id: uuid::Uuid,
1413    ) -> Result<models::ApprovableResult, Self::Error> {
1414        ApprovalRequestsApi::get_approval_request_result(self.0, request_id)
1415    }
1416
1417    fn authenticate_user(
1418        &self,
1419        body: Option<models::AuthRequest>,
1420    ) -> Result<models::AuthResponse, Self::Error> {
1421        AuthApi::authenticate_user(self.0, body)
1422    }
1423
1424    fn convert_app_build(
1425        &self,
1426        body: models::ConvertAppBuildRequest,
1427    ) -> Result<models::Build, Self::Error> {
1428        BuildApi::convert_app_build(self.0, body)
1429    }
1430
1431    fn create_build(&self, body: models::CreateBuildRequest) -> Result<models::Build, Self::Error> {
1432        BuildApi::create_build(self.0, body)
1433    }
1434
1435    fn delete_build(&self, build_id: uuid::Uuid) -> Result<(), Self::Error> {
1436        BuildApi::delete_build(self.0, build_id)
1437    }
1438
1439    fn get_all_builds(
1440        &self,
1441        all_search: Option<String>,
1442        docker_image_name: Option<String>,
1443        config_id: Option<String>,
1444        deployed_status: Option<String>,
1445        status: Option<String>,
1446        limit: Option<i32>,
1447        offset: Option<i32>,
1448        sort_by: Option<String>,
1449    ) -> Result<models::GetAllBuildsResponse, Self::Error> {
1450        BuildApi::get_all_builds(
1451            self.0,
1452            all_search,
1453            docker_image_name,
1454            config_id,
1455            deployed_status,
1456            status,
1457            limit,
1458            offset,
1459            sort_by,
1460        )
1461    }
1462
1463    fn get_build(&self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error> {
1464        BuildApi::get_build(self.0, build_id)
1465    }
1466
1467    fn get_build_deployments(
1468        &self,
1469        build_id: uuid::Uuid,
1470        status: Option<String>,
1471        all_search: Option<String>,
1472        sort_by: Option<String>,
1473        limit: Option<i32>,
1474        offset: Option<i32>,
1475    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error> {
1476        BuildApi::get_build_deployments(
1477            self.0, build_id, status, all_search, sort_by, limit, offset,
1478        )
1479    }
1480
1481    fn update_build(
1482        &self,
1483        build_id: uuid::Uuid,
1484        body: models::BuildUpdateRequest,
1485    ) -> Result<models::Build, Self::Error> {
1486        BuildApi::update_build(self.0, build_id, body)
1487    }
1488
1489    fn get_certificate(&self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error> {
1490        CertificateApi::get_certificate(self.0, cert_id)
1491    }
1492
1493    fn new_certificate(
1494        &self,
1495        body: models::NewCertificateRequest,
1496    ) -> Result<models::TaskResult, Self::Error> {
1497        CertificateApi::new_certificate(self.0, body)
1498    }
1499
1500    fn create_dataset(
1501        &self,
1502        body: models::CreateDatasetRequest,
1503    ) -> Result<models::Dataset, Self::Error> {
1504        DatasetApi::create_dataset(self.0, body)
1505    }
1506
1507    fn delete_dataset(&self, dataset_id: uuid::Uuid) -> Result<(), Self::Error> {
1508        DatasetApi::delete_dataset(self.0, dataset_id)
1509    }
1510
1511    fn get_all_datasets(
1512        &self,
1513        name: Option<String>,
1514        description: Option<String>,
1515        limit: Option<i32>,
1516        offset: Option<i32>,
1517    ) -> Result<models::GetAllDatasetsResponse, Self::Error> {
1518        DatasetApi::get_all_datasets(self.0, name, description, limit, offset)
1519    }
1520
1521    fn get_dataset(&self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error> {
1522        DatasetApi::get_dataset(self.0, dataset_id)
1523    }
1524
1525    fn update_dataset(
1526        &self,
1527        dataset_id: uuid::Uuid,
1528        body: models::DatasetUpdateRequest,
1529    ) -> Result<models::Dataset, Self::Error> {
1530        DatasetApi::update_dataset(self.0, dataset_id, body)
1531    }
1532
1533    fn deactivate_node(&self, node_id: uuid::Uuid) -> Result<(), Self::Error> {
1534        NodeApi::deactivate_node(self.0, node_id)
1535    }
1536
1537    fn get_all_nodes(
1538        &self,
1539        name: Option<String>,
1540        description: Option<String>,
1541        sgx_version: Option<String>,
1542        all_search: Option<String>,
1543        status: Option<String>,
1544        limit: Option<i32>,
1545        offset: Option<i32>,
1546        sort_by: Option<String>,
1547    ) -> Result<models::GetAllNodesResponse, Self::Error> {
1548        NodeApi::get_all_nodes(
1549            self.0,
1550            name,
1551            description,
1552            sgx_version,
1553            all_search,
1554            status,
1555            limit,
1556            offset,
1557            sort_by,
1558        )
1559    }
1560
1561    fn get_node(&self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error> {
1562        NodeApi::get_node(self.0, node_id)
1563    }
1564
1565    fn get_node_certificate(
1566        &self,
1567        node_id: uuid::Uuid,
1568    ) -> Result<models::Certificate, Self::Error> {
1569        NodeApi::get_node_certificate(self.0, node_id)
1570    }
1571
1572    fn get_node_certificate_details(
1573        &self,
1574        node_id: uuid::Uuid,
1575    ) -> Result<models::CertificateDetails, Self::Error> {
1576        NodeApi::get_node_certificate_details(self.0, node_id)
1577    }
1578
1579    fn get_nodes_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
1580        NodeApi::get_nodes_unique_labels(self.0)
1581    }
1582
1583    fn provision_node(
1584        &self,
1585        body: models::NodeProvisionRequest,
1586    ) -> Result<models::TaskResult, Self::Error> {
1587        NodeApi::provision_node(self.0, body)
1588    }
1589
1590    fn update_node(
1591        &self,
1592        node_id: uuid::Uuid,
1593        body: models::NodeUpdateRequest,
1594    ) -> Result<models::Node, Self::Error> {
1595        NodeApi::update_node(self.0, node_id, body)
1596    }
1597
1598    fn update_node_status(
1599        &self,
1600        body: models::NodeStatusRequest,
1601    ) -> Result<models::NodeStatusResponse, Self::Error> {
1602        NodeApi::update_node_status(self.0, body)
1603    }
1604
1605    fn create_registry(
1606        &self,
1607        registry_request: models::RegistryRequest,
1608    ) -> Result<models::Registry, Self::Error> {
1609        RegistryApi::create_registry(self.0, registry_request)
1610    }
1611
1612    fn delete_registry(&self, registry_id: uuid::Uuid) -> Result<(), Self::Error> {
1613        RegistryApi::delete_registry(self.0, registry_id)
1614    }
1615
1616    fn get_all_registries(&self) -> Result<Vec<models::Registry>, Self::Error> {
1617        RegistryApi::get_all_registries(self.0)
1618    }
1619
1620    fn get_registry(&self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error> {
1621        RegistryApi::get_registry(self.0, registry_id)
1622    }
1623
1624    fn get_registry_for_app(
1625        &self,
1626        app_id: uuid::Uuid,
1627    ) -> Result<models::AppRegistryResponse, Self::Error> {
1628        RegistryApi::get_registry_for_app(self.0, app_id)
1629    }
1630
1631    fn get_registry_for_image(
1632        &self,
1633        image_name: String,
1634    ) -> Result<models::ImageRegistryResponse, Self::Error> {
1635        RegistryApi::get_registry_for_image(self.0, image_name)
1636    }
1637
1638    fn update_registry(
1639        &self,
1640        registry_id: uuid::Uuid,
1641        body: models::UpdateRegistryRequest,
1642    ) -> Result<models::Registry, Self::Error> {
1643        RegistryApi::update_registry(self.0, registry_id, body)
1644    }
1645
1646    fn get_manager_version(&self) -> Result<models::VersionResponse, Self::Error> {
1647        SystemApi::get_manager_version(self.0)
1648    }
1649
1650    fn get_all_tasks(
1651        &self,
1652        task_type: Option<String>,
1653        status: Option<String>,
1654        requester: Option<String>,
1655        approver: Option<String>,
1656        all_search: Option<String>,
1657        limit: Option<i32>,
1658        offset: Option<i32>,
1659        sort_by: Option<String>,
1660        base_filters: Option<String>,
1661    ) -> Result<models::GetAllTasksResponse, Self::Error> {
1662        TaskApi::get_all_tasks(
1663            self.0,
1664            task_type,
1665            status,
1666            requester,
1667            approver,
1668            all_search,
1669            limit,
1670            offset,
1671            sort_by,
1672            base_filters,
1673        )
1674    }
1675
1676    fn get_task(&self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error> {
1677        TaskApi::get_task(self.0, task_id)
1678    }
1679
1680    fn get_task_status(&self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error> {
1681        TaskApi::get_task_status(self.0, task_id)
1682    }
1683
1684    fn update_task(
1685        &self,
1686        task_id: uuid::Uuid,
1687        body: models::TaskUpdateRequest,
1688    ) -> Result<models::TaskResult, Self::Error> {
1689        TaskApi::update_task(self.0, task_id, body)
1690    }
1691
1692    fn convert_app(
1693        &self,
1694        body: models::ConversionRequest,
1695    ) -> Result<models::ConversionResponse, Self::Error> {
1696        ToolsApi::convert_app(self.0, body)
1697    }
1698
1699    fn accept_terms_and_conditions(&self) -> Result<(), Self::Error> {
1700        UsersApi::accept_terms_and_conditions(self.0)
1701    }
1702
1703    fn change_password(&self, body: models::PasswordChangeRequest) -> Result<(), Self::Error> {
1704        UsersApi::change_password(self.0, body)
1705    }
1706
1707    fn confirm_email(
1708        &self,
1709        body: models::ConfirmEmailRequest,
1710    ) -> Result<models::ConfirmEmailResponse, Self::Error> {
1711        UsersApi::confirm_email(self.0, body)
1712    }
1713
1714    fn create_user(&self, body: models::SignupRequest) -> Result<models::User, Self::Error> {
1715        UsersApi::create_user(self.0, body)
1716    }
1717
1718    fn delete_user_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
1719        UsersApi::delete_user_account(self.0, user_id)
1720    }
1721
1722    fn delete_user_from_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
1723        UsersApi::delete_user_from_account(self.0, user_id)
1724    }
1725
1726    fn forgot_password(&self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error> {
1727        UsersApi::forgot_password(self.0, body)
1728    }
1729
1730    fn get_all_users(
1731        &self,
1732        all_search: Option<String>,
1733        limit: Option<i32>,
1734        offset: Option<i32>,
1735        sort_by: Option<String>,
1736    ) -> Result<models::GetAllUsersResponse, Self::Error> {
1737        UsersApi::get_all_users(self.0, all_search, limit, offset, sort_by)
1738    }
1739
1740    fn get_logged_in_user(&self) -> Result<models::User, Self::Error> {
1741        UsersApi::get_logged_in_user(self.0)
1742    }
1743
1744    fn get_user(&self, user_id: uuid::Uuid) -> Result<models::User, Self::Error> {
1745        UsersApi::get_user(self.0, user_id)
1746    }
1747
1748    fn invite_user(&self, body: models::InviteUserRequest) -> Result<models::User, Self::Error> {
1749        UsersApi::invite_user(self.0, body)
1750    }
1751
1752    fn process_invitations(&self, body: models::ProcessInviteRequest) -> Result<(), Self::Error> {
1753        UsersApi::process_invitations(self.0, body)
1754    }
1755
1756    fn resend_confirm_email(&self) -> Result<(), Self::Error> {
1757        UsersApi::resend_confirm_email(self.0)
1758    }
1759
1760    fn resend_invitation(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
1761        UsersApi::resend_invitation(self.0, user_id)
1762    }
1763
1764    fn reset_password(
1765        &self,
1766        user_id: uuid::Uuid,
1767        body: models::PasswordResetRequest,
1768    ) -> Result<(), Self::Error> {
1769        UsersApi::reset_password(self.0, user_id, body)
1770    }
1771
1772    fn update_user(
1773        &self,
1774        user_id: uuid::Uuid,
1775        body: models::UpdateUserRequest,
1776    ) -> Result<models::User, Self::Error> {
1777        UsersApi::update_user(self.0, user_id, body)
1778    }
1779
1780    fn validate_password_reset_token(
1781        &self,
1782        user_id: uuid::Uuid,
1783        body: models::ValidateTokenRequest,
1784    ) -> Result<models::ValidateTokenResponse, Self::Error> {
1785        UsersApi::validate_password_reset_token(self.0, user_id, body)
1786    }
1787
1788    fn create_workflow_graph(
1789        &self,
1790        body: models::CreateWorkflowGraph,
1791    ) -> Result<models::WorkflowGraph, Self::Error> {
1792        WorkflowApi::create_workflow_graph(self.0, body)
1793    }
1794
1795    fn delete_workflow_graph(&self, graph_id: uuid::Uuid) -> Result<(), Self::Error> {
1796        WorkflowApi::delete_workflow_graph(self.0, graph_id)
1797    }
1798
1799    fn get_all_workflow_graphs(
1800        &self,
1801        name: Option<String>,
1802        description: Option<String>,
1803        all_search: Option<String>,
1804        parent_graph_id: Option<String>,
1805        sort_by: Option<String>,
1806        limit: Option<i32>,
1807        offset: Option<i32>,
1808    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error> {
1809        WorkflowApi::get_all_workflow_graphs(
1810            self.0,
1811            name,
1812            description,
1813            all_search,
1814            parent_graph_id,
1815            sort_by,
1816            limit,
1817            offset,
1818        )
1819    }
1820
1821    fn get_workflow_graph(
1822        &self,
1823        graph_id: uuid::Uuid,
1824    ) -> Result<models::WorkflowGraph, Self::Error> {
1825        WorkflowApi::get_workflow_graph(self.0, graph_id)
1826    }
1827
1828    fn update_workflow_graph(
1829        &self,
1830        graph_id: uuid::Uuid,
1831        body: models::UpdateWorkflowGraph,
1832    ) -> Result<models::WorkflowGraph, Self::Error> {
1833        WorkflowApi::update_workflow_graph(self.0, graph_id, body)
1834    }
1835
1836    fn create_final_workflow_graph(
1837        &self,
1838        body: models::CreateFinalWorkflowGraph,
1839    ) -> Result<models::FinalWorkflow, Self::Error> {
1840        WorkflowFinalApi::create_final_workflow_graph(self.0, body)
1841    }
1842
1843    fn delete_final_workflow_graph(
1844        &self,
1845        graph_id: uuid::Uuid,
1846        version: String,
1847    ) -> Result<(), Self::Error> {
1848        WorkflowFinalApi::delete_final_workflow_graph(self.0, graph_id, version)
1849    }
1850
1851    fn get_all_final_workflow_graphs(
1852        &self,
1853        name: Option<String>,
1854        description: Option<String>,
1855        all_search: Option<String>,
1856        sort_by: Option<String>,
1857        limit: Option<i32>,
1858        offset: Option<i32>,
1859    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error> {
1860        WorkflowFinalApi::get_all_final_workflow_graphs(
1861            self.0,
1862            name,
1863            description,
1864            all_search,
1865            sort_by,
1866            limit,
1867            offset,
1868        )
1869    }
1870
1871    fn get_final_workflow_graph(
1872        &self,
1873        graph_id: uuid::Uuid,
1874        version: String,
1875    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
1876        WorkflowFinalApi::get_final_workflow_graph(self.0, graph_id, version)
1877    }
1878
1879    fn get_full_final_workflow_graph(
1880        &self,
1881        graph_id: uuid::Uuid,
1882    ) -> Result<models::FinalWorkflow, Self::Error> {
1883        WorkflowFinalApi::get_full_final_workflow_graph(self.0, graph_id)
1884    }
1885
1886    fn update_final_workflow_graph(
1887        &self,
1888        graph_id: uuid::Uuid,
1889        body: models::CreateWorkflowVersionRequest,
1890    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
1891        WorkflowFinalApi::update_final_workflow_graph(self.0, graph_id, body)
1892    }
1893
1894    fn get_zone(&self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error> {
1895        ZoneApi::get_zone(self.0, zone_id)
1896    }
1897
1898    fn get_zone_join_token(
1899        &self,
1900        zone_id: uuid::Uuid,
1901    ) -> Result<models::ZoneJoinToken, Self::Error> {
1902        ZoneApi::get_zone_join_token(self.0, zone_id)
1903    }
1904
1905    fn get_zones(&self) -> Result<Vec<models::Zone>, Self::Error> {
1906        ZoneApi::get_zones(self.0)
1907    }
1908}
1909
1910/// Implements with functions of the form `fn api_call(&self, ...) { self.dispatch(|a| Api::api_call(a, ...)) }`
1911impl<T, E> Api for T
1912where
1913    T: ApiDecorator<Error = E>,
1914{
1915    type Error = E;
1916
1917    fn create_account(&self, body: models::AccountRequest) -> Result<models::Account, Self::Error> {
1918        self.dispatch(|a| Api::create_account(a, body))
1919    }
1920
1921    fn delete_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
1922        self.dispatch(|a| Api::delete_account(a, account_id))
1923    }
1924
1925    fn get_account(&self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error> {
1926        self.dispatch(|a| Api::get_account(a, account_id))
1927    }
1928
1929    fn get_accounts(&self) -> Result<models::AccountListResponse, Self::Error> {
1930        self.dispatch(|a| Api::get_accounts(a))
1931    }
1932
1933    fn select_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
1934        self.dispatch(|a| Api::select_account(a, account_id))
1935    }
1936
1937    fn update_account(
1938        &self,
1939        account_id: uuid::Uuid,
1940        body: models::AccountUpdateRequest,
1941    ) -> Result<models::Account, Self::Error> {
1942        self.dispatch(|a| Api::update_account(a, account_id, body))
1943    }
1944
1945    fn add_application(&self, body: models::AppRequest) -> Result<models::App, Self::Error> {
1946        self.dispatch(|a| Api::add_application(a, body))
1947    }
1948
1949    fn delete_app(&self, app_id: uuid::Uuid) -> Result<(), Self::Error> {
1950        self.dispatch(|a| Api::delete_app(a, app_id))
1951    }
1952
1953    fn get_all_apps(
1954        &self,
1955        name: Option<String>,
1956        description: Option<String>,
1957        all_search: Option<String>,
1958        limit: Option<i32>,
1959        offset: Option<i32>,
1960        sort_by: Option<String>,
1961    ) -> Result<models::GetAllAppsResponse, Self::Error> {
1962        self.dispatch(|a| {
1963            Api::get_all_apps(a, name, description, all_search, limit, offset, sort_by)
1964        })
1965    }
1966
1967    fn get_app(&self, app_id: uuid::Uuid) -> Result<models::App, Self::Error> {
1968        self.dispatch(|a| Api::get_app(a, app_id))
1969    }
1970
1971    fn get_app_certificate(
1972        &self,
1973        node_id: uuid::Uuid,
1974        app_id: uuid::Uuid,
1975    ) -> Result<models::Certificate, Self::Error> {
1976        self.dispatch(|a| Api::get_app_certificate(a, node_id, app_id))
1977    }
1978
1979    fn get_app_node_certificate_details(
1980        &self,
1981        node_id: uuid::Uuid,
1982        app_id: uuid::Uuid,
1983    ) -> Result<models::CertificateDetails, Self::Error> {
1984        self.dispatch(|a| Api::get_app_node_certificate_details(a, node_id, app_id))
1985    }
1986
1987    fn get_apps_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
1988        self.dispatch(|a| Api::get_apps_unique_labels(a))
1989    }
1990
1991    fn update_app(
1992        &self,
1993        app_id: uuid::Uuid,
1994        body: models::AppBodyUpdateRequest,
1995    ) -> Result<models::App, Self::Error> {
1996        self.dispatch(|a| Api::update_app(a, app_id, body))
1997    }
1998
1999    fn create_application_config(
2000        &self,
2001        body: models::ApplicationConfig,
2002    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2003        self.dispatch(|a| Api::create_application_config(a, body))
2004    }
2005
2006    fn delete_application_config(&self, config_id: String) -> Result<(), Self::Error> {
2007        self.dispatch(|a| Api::delete_application_config(a, config_id))
2008    }
2009
2010    fn get_all_application_configs(
2011        &self,
2012        name: Option<String>,
2013        description: Option<String>,
2014        image_id: Option<uuid::Uuid>,
2015        limit: Option<i32>,
2016        offset: Option<i32>,
2017    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error> {
2018        self.dispatch(|a| {
2019            Api::get_all_application_configs(a, name, description, image_id, limit, offset)
2020        })
2021    }
2022
2023    fn get_application_config(
2024        &self,
2025        config_id: String,
2026    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2027        self.dispatch(|a| Api::get_application_config(a, config_id))
2028    }
2029
2030    fn get_runtime_application_config(
2031        &self,
2032        expected_hash: &[u8; 32],
2033    ) -> Result<models::RuntimeAppConfig, Self::Error> {
2034        self.dispatch(|a| Api::get_runtime_application_config(a, expected_hash))
2035    }
2036
2037    fn get_specific_runtime_application_config(
2038        &self,
2039        config_id: String,
2040    ) -> Result<models::RuntimeAppConfig, Self::Error> {
2041        self.dispatch(|a| Api::get_specific_runtime_application_config(a, config_id))
2042    }
2043
2044    fn update_application_config(
2045        &self,
2046        config_id: String,
2047        body: models::UpdateApplicationConfigRequest,
2048    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2049        self.dispatch(|a| Api::update_application_config(a, config_id, body))
2050    }
2051
2052    fn approve_approval_request(
2053        &self,
2054        request_id: uuid::Uuid,
2055        body: Option<models::ApproveRequest>,
2056    ) -> Result<models::ApprovalRequest, Self::Error> {
2057        self.dispatch(|a| Api::approve_approval_request(a, request_id, body))
2058    }
2059
2060    fn create_approval_request(
2061        &self,
2062        body: models::ApprovalRequestRequest,
2063    ) -> Result<models::ApprovalRequest, Self::Error> {
2064        self.dispatch(|a| Api::create_approval_request(a, body))
2065    }
2066
2067    fn delete_approval_request(&self, request_id: uuid::Uuid) -> Result<(), Self::Error> {
2068        self.dispatch(|a| Api::delete_approval_request(a, request_id))
2069    }
2070
2071    fn deny_approval_request(
2072        &self,
2073        request_id: uuid::Uuid,
2074        body: Option<models::DenyRequest>,
2075    ) -> Result<models::ApprovalRequest, Self::Error> {
2076        self.dispatch(|a| Api::deny_approval_request(a, request_id, body))
2077    }
2078
2079    fn get_all_approval_requests(
2080        &self,
2081        requester: Option<uuid::Uuid>,
2082        reviewer: Option<uuid::Uuid>,
2083        subject: Option<uuid::Uuid>,
2084        status: Option<String>,
2085        all_search: Option<String>,
2086        sort_by: Option<String>,
2087        limit: Option<i32>,
2088        offset: Option<i32>,
2089    ) -> Result<models::GetAllApprovalRequests, Self::Error> {
2090        self.dispatch(|a| {
2091            Api::get_all_approval_requests(
2092                a, requester, reviewer, subject, status, all_search, sort_by, limit, offset,
2093            )
2094        })
2095    }
2096
2097    fn get_approval_request(
2098        &self,
2099        request_id: uuid::Uuid,
2100    ) -> Result<models::ApprovalRequest, Self::Error> {
2101        self.dispatch(|a| Api::get_approval_request(a, request_id))
2102    }
2103
2104    fn get_approval_request_result(
2105        &self,
2106        request_id: uuid::Uuid,
2107    ) -> Result<models::ApprovableResult, Self::Error> {
2108        self.dispatch(|a| Api::get_approval_request_result(a, request_id))
2109    }
2110
2111    fn authenticate_user(
2112        &self,
2113        body: Option<models::AuthRequest>,
2114    ) -> Result<models::AuthResponse, Self::Error> {
2115        self.dispatch(|a| Api::authenticate_user(a, body))
2116    }
2117
2118    fn convert_app_build(
2119        &self,
2120        body: models::ConvertAppBuildRequest,
2121    ) -> Result<models::Build, Self::Error> {
2122        self.dispatch(|a| Api::convert_app_build(a, body))
2123    }
2124
2125    fn create_build(&self, body: models::CreateBuildRequest) -> Result<models::Build, Self::Error> {
2126        self.dispatch(|a| Api::create_build(a, body))
2127    }
2128
2129    fn delete_build(&self, build_id: uuid::Uuid) -> Result<(), Self::Error> {
2130        self.dispatch(|a| Api::delete_build(a, build_id))
2131    }
2132
2133    fn get_all_builds(
2134        &self,
2135        all_search: Option<String>,
2136        docker_image_name: Option<String>,
2137        config_id: Option<String>,
2138        deployed_status: Option<String>,
2139        status: Option<String>,
2140        limit: Option<i32>,
2141        offset: Option<i32>,
2142        sort_by: Option<String>,
2143    ) -> Result<models::GetAllBuildsResponse, Self::Error> {
2144        self.dispatch(|a| {
2145            Api::get_all_builds(
2146                a,
2147                all_search,
2148                docker_image_name,
2149                config_id,
2150                deployed_status,
2151                status,
2152                limit,
2153                offset,
2154                sort_by,
2155            )
2156        })
2157    }
2158
2159    fn get_build(&self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error> {
2160        self.dispatch(|a| Api::get_build(a, build_id))
2161    }
2162
2163    fn get_build_deployments(
2164        &self,
2165        build_id: uuid::Uuid,
2166        status: Option<String>,
2167        all_search: Option<String>,
2168        sort_by: Option<String>,
2169        limit: Option<i32>,
2170        offset: Option<i32>,
2171    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error> {
2172        self.dispatch(|a| {
2173            Api::get_build_deployments(a, build_id, status, all_search, sort_by, limit, offset)
2174        })
2175    }
2176
2177    fn update_build(
2178        &self,
2179        build_id: uuid::Uuid,
2180        body: models::BuildUpdateRequest,
2181    ) -> Result<models::Build, Self::Error> {
2182        self.dispatch(|a| Api::update_build(a, build_id, body))
2183    }
2184
2185    fn get_certificate(&self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error> {
2186        self.dispatch(|a| Api::get_certificate(a, cert_id))
2187    }
2188
2189    fn new_certificate(
2190        &self,
2191        body: models::NewCertificateRequest,
2192    ) -> Result<models::TaskResult, Self::Error> {
2193        self.dispatch(|a| Api::new_certificate(a, body))
2194    }
2195
2196    fn create_dataset(
2197        &self,
2198        body: models::CreateDatasetRequest,
2199    ) -> Result<models::Dataset, Self::Error> {
2200        self.dispatch(|a| Api::create_dataset(a, body))
2201    }
2202
2203    fn delete_dataset(&self, dataset_id: uuid::Uuid) -> Result<(), Self::Error> {
2204        self.dispatch(|a| Api::delete_dataset(a, dataset_id))
2205    }
2206
2207    fn get_all_datasets(
2208        &self,
2209        name: Option<String>,
2210        description: Option<String>,
2211        limit: Option<i32>,
2212        offset: Option<i32>,
2213    ) -> Result<models::GetAllDatasetsResponse, Self::Error> {
2214        self.dispatch(|a| Api::get_all_datasets(a, name, description, limit, offset))
2215    }
2216
2217    fn get_dataset(&self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error> {
2218        self.dispatch(|a| Api::get_dataset(a, dataset_id))
2219    }
2220
2221    fn update_dataset(
2222        &self,
2223        dataset_id: uuid::Uuid,
2224        body: models::DatasetUpdateRequest,
2225    ) -> Result<models::Dataset, Self::Error> {
2226        self.dispatch(|a| Api::update_dataset(a, dataset_id, body))
2227    }
2228
2229    fn deactivate_node(&self, node_id: uuid::Uuid) -> Result<(), Self::Error> {
2230        self.dispatch(|a| Api::deactivate_node(a, node_id))
2231    }
2232
2233    fn get_all_nodes(
2234        &self,
2235        name: Option<String>,
2236        description: Option<String>,
2237        sgx_version: Option<String>,
2238        all_search: Option<String>,
2239        status: Option<String>,
2240        limit: Option<i32>,
2241        offset: Option<i32>,
2242        sort_by: Option<String>,
2243    ) -> Result<models::GetAllNodesResponse, Self::Error> {
2244        self.dispatch(|a| {
2245            Api::get_all_nodes(
2246                a,
2247                name,
2248                description,
2249                sgx_version,
2250                all_search,
2251                status,
2252                limit,
2253                offset,
2254                sort_by,
2255            )
2256        })
2257    }
2258
2259    fn get_node(&self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error> {
2260        self.dispatch(|a| Api::get_node(a, node_id))
2261    }
2262
2263    fn get_node_certificate(
2264        &self,
2265        node_id: uuid::Uuid,
2266    ) -> Result<models::Certificate, Self::Error> {
2267        self.dispatch(|a| Api::get_node_certificate(a, node_id))
2268    }
2269
2270    fn get_node_certificate_details(
2271        &self,
2272        node_id: uuid::Uuid,
2273    ) -> Result<models::CertificateDetails, Self::Error> {
2274        self.dispatch(|a| Api::get_node_certificate_details(a, node_id))
2275    }
2276
2277    fn get_nodes_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
2278        self.dispatch(|a| Api::get_nodes_unique_labels(a))
2279    }
2280
2281    fn provision_node(
2282        &self,
2283        body: models::NodeProvisionRequest,
2284    ) -> Result<models::TaskResult, Self::Error> {
2285        self.dispatch(|a| Api::provision_node(a, body))
2286    }
2287
2288    fn update_node(
2289        &self,
2290        node_id: uuid::Uuid,
2291        body: models::NodeUpdateRequest,
2292    ) -> Result<models::Node, Self::Error> {
2293        self.dispatch(|a| Api::update_node(a, node_id, body))
2294    }
2295
2296    fn update_node_status(
2297        &self,
2298        body: models::NodeStatusRequest,
2299    ) -> Result<models::NodeStatusResponse, Self::Error> {
2300        self.dispatch(|a| Api::update_node_status(a, body))
2301    }
2302
2303    fn create_registry(
2304        &self,
2305        registry_request: models::RegistryRequest,
2306    ) -> Result<models::Registry, Self::Error> {
2307        self.dispatch(|a| Api::create_registry(a, registry_request))
2308    }
2309
2310    fn delete_registry(&self, registry_id: uuid::Uuid) -> Result<(), Self::Error> {
2311        self.dispatch(|a| Api::delete_registry(a, registry_id))
2312    }
2313
2314    fn get_all_registries(&self) -> Result<Vec<models::Registry>, Self::Error> {
2315        self.dispatch(|a| Api::get_all_registries(a))
2316    }
2317
2318    fn get_registry(&self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error> {
2319        self.dispatch(|a| Api::get_registry(a, registry_id))
2320    }
2321
2322    fn get_registry_for_app(
2323        &self,
2324        app_id: uuid::Uuid,
2325    ) -> Result<models::AppRegistryResponse, Self::Error> {
2326        self.dispatch(|a| Api::get_registry_for_app(a, app_id))
2327    }
2328
2329    fn get_registry_for_image(
2330        &self,
2331        image_name: String,
2332    ) -> Result<models::ImageRegistryResponse, Self::Error> {
2333        self.dispatch(|a| Api::get_registry_for_image(a, image_name))
2334    }
2335
2336    fn update_registry(
2337        &self,
2338        registry_id: uuid::Uuid,
2339        body: models::UpdateRegistryRequest,
2340    ) -> Result<models::Registry, Self::Error> {
2341        self.dispatch(|a| Api::update_registry(a, registry_id, body))
2342    }
2343
2344    fn get_manager_version(&self) -> Result<models::VersionResponse, Self::Error> {
2345        self.dispatch(|a| Api::get_manager_version(a))
2346    }
2347
2348    fn get_all_tasks(
2349        &self,
2350        task_type: Option<String>,
2351        status: Option<String>,
2352        requester: Option<String>,
2353        approver: Option<String>,
2354        all_search: Option<String>,
2355        limit: Option<i32>,
2356        offset: Option<i32>,
2357        sort_by: Option<String>,
2358        base_filters: Option<String>,
2359    ) -> Result<models::GetAllTasksResponse, Self::Error> {
2360        self.dispatch(|a| {
2361            Api::get_all_tasks(
2362                a,
2363                task_type,
2364                status,
2365                requester,
2366                approver,
2367                all_search,
2368                limit,
2369                offset,
2370                sort_by,
2371                base_filters,
2372            )
2373        })
2374    }
2375
2376    fn get_task(&self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error> {
2377        self.dispatch(|a| Api::get_task(a, task_id))
2378    }
2379
2380    fn get_task_status(&self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error> {
2381        self.dispatch(|a| Api::get_task_status(a, task_id))
2382    }
2383
2384    fn update_task(
2385        &self,
2386        task_id: uuid::Uuid,
2387        body: models::TaskUpdateRequest,
2388    ) -> Result<models::TaskResult, Self::Error> {
2389        self.dispatch(|a| Api::update_task(a, task_id, body))
2390    }
2391
2392    fn convert_app(
2393        &self,
2394        body: models::ConversionRequest,
2395    ) -> Result<models::ConversionResponse, Self::Error> {
2396        self.dispatch(|a| Api::convert_app(a, body))
2397    }
2398
2399    fn accept_terms_and_conditions(&self) -> Result<(), Self::Error> {
2400        self.dispatch(|a| Api::accept_terms_and_conditions(a))
2401    }
2402
2403    fn change_password(&self, body: models::PasswordChangeRequest) -> Result<(), Self::Error> {
2404        self.dispatch(|a| Api::change_password(a, body))
2405    }
2406
2407    fn confirm_email(
2408        &self,
2409        body: models::ConfirmEmailRequest,
2410    ) -> Result<models::ConfirmEmailResponse, Self::Error> {
2411        self.dispatch(|a| Api::confirm_email(a, body))
2412    }
2413
2414    fn create_user(&self, body: models::SignupRequest) -> Result<models::User, Self::Error> {
2415        self.dispatch(|a| Api::create_user(a, body))
2416    }
2417
2418    fn delete_user_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
2419        self.dispatch(|a| Api::delete_user_account(a, user_id))
2420    }
2421
2422    fn delete_user_from_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
2423        self.dispatch(|a| Api::delete_user_from_account(a, user_id))
2424    }
2425
2426    fn forgot_password(&self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error> {
2427        self.dispatch(|a| Api::forgot_password(a, body))
2428    }
2429
2430    fn get_all_users(
2431        &self,
2432        all_search: Option<String>,
2433        limit: Option<i32>,
2434        offset: Option<i32>,
2435        sort_by: Option<String>,
2436    ) -> Result<models::GetAllUsersResponse, Self::Error> {
2437        self.dispatch(|a| Api::get_all_users(a, all_search, limit, offset, sort_by))
2438    }
2439
2440    fn get_logged_in_user(&self) -> Result<models::User, Self::Error> {
2441        self.dispatch(|a| Api::get_logged_in_user(a))
2442    }
2443
2444    fn get_user(&self, user_id: uuid::Uuid) -> Result<models::User, Self::Error> {
2445        self.dispatch(|a| Api::get_user(a, user_id))
2446    }
2447
2448    fn invite_user(&self, body: models::InviteUserRequest) -> Result<models::User, Self::Error> {
2449        self.dispatch(|a| Api::invite_user(a, body))
2450    }
2451
2452    fn process_invitations(&self, body: models::ProcessInviteRequest) -> Result<(), Self::Error> {
2453        self.dispatch(|a| Api::process_invitations(a, body))
2454    }
2455
2456    fn resend_confirm_email(&self) -> Result<(), Self::Error> {
2457        self.dispatch(|a| Api::resend_confirm_email(a))
2458    }
2459
2460    fn resend_invitation(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
2461        self.dispatch(|a| Api::resend_invitation(a, user_id))
2462    }
2463
2464    fn reset_password(
2465        &self,
2466        user_id: uuid::Uuid,
2467        body: models::PasswordResetRequest,
2468    ) -> Result<(), Self::Error> {
2469        self.dispatch(|a| Api::reset_password(a, user_id, body))
2470    }
2471
2472    fn update_user(
2473        &self,
2474        user_id: uuid::Uuid,
2475        body: models::UpdateUserRequest,
2476    ) -> Result<models::User, Self::Error> {
2477        self.dispatch(|a| Api::update_user(a, user_id, body))
2478    }
2479
2480    fn validate_password_reset_token(
2481        &self,
2482        user_id: uuid::Uuid,
2483        body: models::ValidateTokenRequest,
2484    ) -> Result<models::ValidateTokenResponse, Self::Error> {
2485        self.dispatch(|a| Api::validate_password_reset_token(a, user_id, body))
2486    }
2487
2488    fn create_workflow_graph(
2489        &self,
2490        body: models::CreateWorkflowGraph,
2491    ) -> Result<models::WorkflowGraph, Self::Error> {
2492        self.dispatch(|a| Api::create_workflow_graph(a, body))
2493    }
2494
2495    fn delete_workflow_graph(&self, graph_id: uuid::Uuid) -> Result<(), Self::Error> {
2496        self.dispatch(|a| Api::delete_workflow_graph(a, graph_id))
2497    }
2498
2499    fn get_all_workflow_graphs(
2500        &self,
2501        name: Option<String>,
2502        description: Option<String>,
2503        all_search: Option<String>,
2504        parent_graph_id: Option<String>,
2505        sort_by: Option<String>,
2506        limit: Option<i32>,
2507        offset: Option<i32>,
2508    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error> {
2509        self.dispatch(|a| {
2510            Api::get_all_workflow_graphs(
2511                a,
2512                name,
2513                description,
2514                all_search,
2515                parent_graph_id,
2516                sort_by,
2517                limit,
2518                offset,
2519            )
2520        })
2521    }
2522
2523    fn get_workflow_graph(
2524        &self,
2525        graph_id: uuid::Uuid,
2526    ) -> Result<models::WorkflowGraph, Self::Error> {
2527        self.dispatch(|a| Api::get_workflow_graph(a, graph_id))
2528    }
2529
2530    fn update_workflow_graph(
2531        &self,
2532        graph_id: uuid::Uuid,
2533        body: models::UpdateWorkflowGraph,
2534    ) -> Result<models::WorkflowGraph, Self::Error> {
2535        self.dispatch(|a| Api::update_workflow_graph(a, graph_id, body))
2536    }
2537
2538    fn create_final_workflow_graph(
2539        &self,
2540        body: models::CreateFinalWorkflowGraph,
2541    ) -> Result<models::FinalWorkflow, Self::Error> {
2542        self.dispatch(|a| Api::create_final_workflow_graph(a, body))
2543    }
2544
2545    fn delete_final_workflow_graph(
2546        &self,
2547        graph_id: uuid::Uuid,
2548        version: String,
2549    ) -> Result<(), Self::Error> {
2550        self.dispatch(|a| Api::delete_final_workflow_graph(a, graph_id, version))
2551    }
2552
2553    fn get_all_final_workflow_graphs(
2554        &self,
2555        name: Option<String>,
2556        description: Option<String>,
2557        all_search: Option<String>,
2558        sort_by: Option<String>,
2559        limit: Option<i32>,
2560        offset: Option<i32>,
2561    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error> {
2562        self.dispatch(|a| {
2563            Api::get_all_final_workflow_graphs(
2564                a,
2565                name,
2566                description,
2567                all_search,
2568                sort_by,
2569                limit,
2570                offset,
2571            )
2572        })
2573    }
2574
2575    fn get_final_workflow_graph(
2576        &self,
2577        graph_id: uuid::Uuid,
2578        version: String,
2579    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
2580        self.dispatch(|a| Api::get_final_workflow_graph(a, graph_id, version))
2581    }
2582
2583    fn get_full_final_workflow_graph(
2584        &self,
2585        graph_id: uuid::Uuid,
2586    ) -> Result<models::FinalWorkflow, Self::Error> {
2587        self.dispatch(|a| Api::get_full_final_workflow_graph(a, graph_id))
2588    }
2589
2590    fn update_final_workflow_graph(
2591        &self,
2592        graph_id: uuid::Uuid,
2593        body: models::CreateWorkflowVersionRequest,
2594    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
2595        self.dispatch(|a| Api::update_final_workflow_graph(a, graph_id, body))
2596    }
2597
2598    fn get_zone(&self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error> {
2599        self.dispatch(|a| Api::get_zone(a, zone_id))
2600    }
2601
2602    fn get_zone_join_token(
2603        &self,
2604        zone_id: uuid::Uuid,
2605    ) -> Result<models::ZoneJoinToken, Self::Error> {
2606        self.dispatch(|a| Api::get_zone_join_token(a, zone_id))
2607    }
2608
2609    fn get_zones(&self) -> Result<Vec<models::Zone>, Self::Error> {
2610        self.dispatch(|a| Api::get_zones(a))
2611    }
2612}
2613
2614/// Implements with functions of the form `fn api_call(&mut self, ...) { self.api_call(...) }`
2615impl<T, E> ApiMut for T
2616where
2617    T: AccountsApiMut<Error = E>
2618        + AppApiMut<Error = E>
2619        + ApplicationConfigApiMut<Error = E>
2620        + ApprovalRequestsApiMut<Error = E>
2621        + AuthApiMut<Error = E>
2622        + BuildApiMut<Error = E>
2623        + CertificateApiMut<Error = E>
2624        + DatasetApiMut<Error = E>
2625        + NodeApiMut<Error = E>
2626        + RegistryApiMut<Error = E>
2627        + SystemApiMut<Error = E>
2628        + TaskApiMut<Error = E>
2629        + ToolsApiMut<Error = E>
2630        + UsersApiMut<Error = E>
2631        + WorkflowApiMut<Error = E>
2632        + WorkflowFinalApiMut<Error = E>
2633        + ZoneApiMut<Error = E>,
2634{
2635    type Error = E;
2636
2637    fn create_account(
2638        &mut self,
2639        body: models::AccountRequest,
2640    ) -> Result<models::Account, Self::Error> {
2641        self.create_account(body)
2642    }
2643
2644    fn delete_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
2645        self.delete_account(account_id)
2646    }
2647
2648    fn get_account(&mut self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error> {
2649        self.get_account(account_id)
2650    }
2651
2652    fn get_accounts(&mut self) -> Result<models::AccountListResponse, Self::Error> {
2653        self.get_accounts()
2654    }
2655
2656    fn select_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
2657        self.select_account(account_id)
2658    }
2659
2660    fn update_account(
2661        &mut self,
2662        account_id: uuid::Uuid,
2663        body: models::AccountUpdateRequest,
2664    ) -> Result<models::Account, Self::Error> {
2665        self.update_account(account_id, body)
2666    }
2667
2668    fn add_application(&mut self, body: models::AppRequest) -> Result<models::App, Self::Error> {
2669        self.add_application(body)
2670    }
2671
2672    fn delete_app(&mut self, app_id: uuid::Uuid) -> Result<(), Self::Error> {
2673        self.delete_app(app_id)
2674    }
2675
2676    fn get_all_apps(
2677        &mut self,
2678        name: Option<String>,
2679        description: Option<String>,
2680        all_search: Option<String>,
2681        limit: Option<i32>,
2682        offset: Option<i32>,
2683        sort_by: Option<String>,
2684    ) -> Result<models::GetAllAppsResponse, Self::Error> {
2685        self.get_all_apps(name, description, all_search, limit, offset, sort_by)
2686    }
2687
2688    fn get_app(&mut self, app_id: uuid::Uuid) -> Result<models::App, Self::Error> {
2689        self.get_app(app_id)
2690    }
2691
2692    fn get_app_certificate(
2693        &mut self,
2694        node_id: uuid::Uuid,
2695        app_id: uuid::Uuid,
2696    ) -> Result<models::Certificate, Self::Error> {
2697        self.get_app_certificate(node_id, app_id)
2698    }
2699
2700    fn get_app_node_certificate_details(
2701        &mut self,
2702        node_id: uuid::Uuid,
2703        app_id: uuid::Uuid,
2704    ) -> Result<models::CertificateDetails, Self::Error> {
2705        self.get_app_node_certificate_details(node_id, app_id)
2706    }
2707
2708    fn get_apps_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error> {
2709        self.get_apps_unique_labels()
2710    }
2711
2712    fn update_app(
2713        &mut self,
2714        app_id: uuid::Uuid,
2715        body: models::AppBodyUpdateRequest,
2716    ) -> Result<models::App, Self::Error> {
2717        self.update_app(app_id, body)
2718    }
2719
2720    fn create_application_config(
2721        &mut self,
2722        body: models::ApplicationConfig,
2723    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2724        self.create_application_config(body)
2725    }
2726
2727    fn delete_application_config(&mut self, config_id: String) -> Result<(), Self::Error> {
2728        self.delete_application_config(config_id)
2729    }
2730
2731    fn get_all_application_configs(
2732        &mut self,
2733        name: Option<String>,
2734        description: Option<String>,
2735        image_id: Option<uuid::Uuid>,
2736        limit: Option<i32>,
2737        offset: Option<i32>,
2738    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error> {
2739        self.get_all_application_configs(name, description, image_id, limit, offset)
2740    }
2741
2742    fn get_application_config(
2743        &mut self,
2744        config_id: String,
2745    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2746        self.get_application_config(config_id)
2747    }
2748
2749    fn get_runtime_application_config(
2750        &mut self,
2751        expected_hash: &[u8; 32],
2752    ) -> Result<models::RuntimeAppConfig, Self::Error> {
2753        self.get_runtime_application_config(expected_hash)
2754    }
2755
2756    fn get_specific_runtime_application_config(
2757        &mut self,
2758        config_id: String,
2759    ) -> Result<models::RuntimeAppConfig, Self::Error> {
2760        self.get_specific_runtime_application_config(config_id)
2761    }
2762
2763    fn update_application_config(
2764        &mut self,
2765        config_id: String,
2766        body: models::UpdateApplicationConfigRequest,
2767    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
2768        self.update_application_config(config_id, body)
2769    }
2770
2771    fn approve_approval_request(
2772        &mut self,
2773        request_id: uuid::Uuid,
2774        body: Option<models::ApproveRequest>,
2775    ) -> Result<models::ApprovalRequest, Self::Error> {
2776        self.approve_approval_request(request_id, body)
2777    }
2778
2779    fn create_approval_request(
2780        &mut self,
2781        body: models::ApprovalRequestRequest,
2782    ) -> Result<models::ApprovalRequest, Self::Error> {
2783        self.create_approval_request(body)
2784    }
2785
2786    fn delete_approval_request(&mut self, request_id: uuid::Uuid) -> Result<(), Self::Error> {
2787        self.delete_approval_request(request_id)
2788    }
2789
2790    fn deny_approval_request(
2791        &mut self,
2792        request_id: uuid::Uuid,
2793        body: Option<models::DenyRequest>,
2794    ) -> Result<models::ApprovalRequest, Self::Error> {
2795        self.deny_approval_request(request_id, body)
2796    }
2797
2798    fn get_all_approval_requests(
2799        &mut self,
2800        requester: Option<uuid::Uuid>,
2801        reviewer: Option<uuid::Uuid>,
2802        subject: Option<uuid::Uuid>,
2803        status: Option<String>,
2804        all_search: Option<String>,
2805        sort_by: Option<String>,
2806        limit: Option<i32>,
2807        offset: Option<i32>,
2808    ) -> Result<models::GetAllApprovalRequests, Self::Error> {
2809        self.get_all_approval_requests(
2810            requester, reviewer, subject, status, all_search, sort_by, limit, offset,
2811        )
2812    }
2813
2814    fn get_approval_request(
2815        &mut self,
2816        request_id: uuid::Uuid,
2817    ) -> Result<models::ApprovalRequest, Self::Error> {
2818        self.get_approval_request(request_id)
2819    }
2820
2821    fn get_approval_request_result(
2822        &mut self,
2823        request_id: uuid::Uuid,
2824    ) -> Result<models::ApprovableResult, Self::Error> {
2825        self.get_approval_request_result(request_id)
2826    }
2827
2828    fn authenticate_user(
2829        &mut self,
2830        body: Option<models::AuthRequest>,
2831    ) -> Result<models::AuthResponse, Self::Error> {
2832        self.authenticate_user(body)
2833    }
2834
2835    fn convert_app_build(
2836        &mut self,
2837        body: models::ConvertAppBuildRequest,
2838    ) -> Result<models::Build, Self::Error> {
2839        self.convert_app_build(body)
2840    }
2841
2842    fn create_build(
2843        &mut self,
2844        body: models::CreateBuildRequest,
2845    ) -> Result<models::Build, Self::Error> {
2846        self.create_build(body)
2847    }
2848
2849    fn delete_build(&mut self, build_id: uuid::Uuid) -> Result<(), Self::Error> {
2850        self.delete_build(build_id)
2851    }
2852
2853    fn get_all_builds(
2854        &mut self,
2855        all_search: Option<String>,
2856        docker_image_name: Option<String>,
2857        config_id: Option<String>,
2858        deployed_status: Option<String>,
2859        status: Option<String>,
2860        limit: Option<i32>,
2861        offset: Option<i32>,
2862        sort_by: Option<String>,
2863    ) -> Result<models::GetAllBuildsResponse, Self::Error> {
2864        self.get_all_builds(
2865            all_search,
2866            docker_image_name,
2867            config_id,
2868            deployed_status,
2869            status,
2870            limit,
2871            offset,
2872            sort_by,
2873        )
2874    }
2875
2876    fn get_build(&mut self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error> {
2877        self.get_build(build_id)
2878    }
2879
2880    fn get_build_deployments(
2881        &mut self,
2882        build_id: uuid::Uuid,
2883        status: Option<String>,
2884        all_search: Option<String>,
2885        sort_by: Option<String>,
2886        limit: Option<i32>,
2887        offset: Option<i32>,
2888    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error> {
2889        self.get_build_deployments(build_id, status, all_search, sort_by, limit, offset)
2890    }
2891
2892    fn update_build(
2893        &mut self,
2894        build_id: uuid::Uuid,
2895        body: models::BuildUpdateRequest,
2896    ) -> Result<models::Build, Self::Error> {
2897        self.update_build(build_id, body)
2898    }
2899
2900    fn get_certificate(&mut self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error> {
2901        self.get_certificate(cert_id)
2902    }
2903
2904    fn new_certificate(
2905        &mut self,
2906        body: models::NewCertificateRequest,
2907    ) -> Result<models::TaskResult, Self::Error> {
2908        self.new_certificate(body)
2909    }
2910
2911    fn create_dataset(
2912        &mut self,
2913        body: models::CreateDatasetRequest,
2914    ) -> Result<models::Dataset, Self::Error> {
2915        self.create_dataset(body)
2916    }
2917
2918    fn delete_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<(), Self::Error> {
2919        self.delete_dataset(dataset_id)
2920    }
2921
2922    fn get_all_datasets(
2923        &mut self,
2924        name: Option<String>,
2925        description: Option<String>,
2926        limit: Option<i32>,
2927        offset: Option<i32>,
2928    ) -> Result<models::GetAllDatasetsResponse, Self::Error> {
2929        self.get_all_datasets(name, description, limit, offset)
2930    }
2931
2932    fn get_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error> {
2933        self.get_dataset(dataset_id)
2934    }
2935
2936    fn update_dataset(
2937        &mut self,
2938        dataset_id: uuid::Uuid,
2939        body: models::DatasetUpdateRequest,
2940    ) -> Result<models::Dataset, Self::Error> {
2941        self.update_dataset(dataset_id, body)
2942    }
2943
2944    fn deactivate_node(&mut self, node_id: uuid::Uuid) -> Result<(), Self::Error> {
2945        self.deactivate_node(node_id)
2946    }
2947
2948    fn get_all_nodes(
2949        &mut self,
2950        name: Option<String>,
2951        description: Option<String>,
2952        sgx_version: Option<String>,
2953        all_search: Option<String>,
2954        status: Option<String>,
2955        limit: Option<i32>,
2956        offset: Option<i32>,
2957        sort_by: Option<String>,
2958    ) -> Result<models::GetAllNodesResponse, Self::Error> {
2959        self.get_all_nodes(
2960            name,
2961            description,
2962            sgx_version,
2963            all_search,
2964            status,
2965            limit,
2966            offset,
2967            sort_by,
2968        )
2969    }
2970
2971    fn get_node(&mut self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error> {
2972        self.get_node(node_id)
2973    }
2974
2975    fn get_node_certificate(
2976        &mut self,
2977        node_id: uuid::Uuid,
2978    ) -> Result<models::Certificate, Self::Error> {
2979        self.get_node_certificate(node_id)
2980    }
2981
2982    fn get_node_certificate_details(
2983        &mut self,
2984        node_id: uuid::Uuid,
2985    ) -> Result<models::CertificateDetails, Self::Error> {
2986        self.get_node_certificate_details(node_id)
2987    }
2988
2989    fn get_nodes_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error> {
2990        self.get_nodes_unique_labels()
2991    }
2992
2993    fn provision_node(
2994        &mut self,
2995        body: models::NodeProvisionRequest,
2996    ) -> Result<models::TaskResult, Self::Error> {
2997        self.provision_node(body)
2998    }
2999
3000    fn update_node(
3001        &mut self,
3002        node_id: uuid::Uuid,
3003        body: models::NodeUpdateRequest,
3004    ) -> Result<models::Node, Self::Error> {
3005        self.update_node(node_id, body)
3006    }
3007
3008    fn update_node_status(
3009        &mut self,
3010        body: models::NodeStatusRequest,
3011    ) -> Result<models::NodeStatusResponse, Self::Error> {
3012        self.update_node_status(body)
3013    }
3014
3015    fn create_registry(
3016        &mut self,
3017        registry_request: models::RegistryRequest,
3018    ) -> Result<models::Registry, Self::Error> {
3019        self.create_registry(registry_request)
3020    }
3021
3022    fn delete_registry(&mut self, registry_id: uuid::Uuid) -> Result<(), Self::Error> {
3023        self.delete_registry(registry_id)
3024    }
3025
3026    fn get_all_registries(&mut self) -> Result<Vec<models::Registry>, Self::Error> {
3027        self.get_all_registries()
3028    }
3029
3030    fn get_registry(&mut self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error> {
3031        self.get_registry(registry_id)
3032    }
3033
3034    fn get_registry_for_app(
3035        &mut self,
3036        app_id: uuid::Uuid,
3037    ) -> Result<models::AppRegistryResponse, Self::Error> {
3038        self.get_registry_for_app(app_id)
3039    }
3040
3041    fn get_registry_for_image(
3042        &mut self,
3043        image_name: String,
3044    ) -> Result<models::ImageRegistryResponse, Self::Error> {
3045        self.get_registry_for_image(image_name)
3046    }
3047
3048    fn update_registry(
3049        &mut self,
3050        registry_id: uuid::Uuid,
3051        body: models::UpdateRegistryRequest,
3052    ) -> Result<models::Registry, Self::Error> {
3053        self.update_registry(registry_id, body)
3054    }
3055
3056    fn get_manager_version(&mut self) -> Result<models::VersionResponse, Self::Error> {
3057        self.get_manager_version()
3058    }
3059
3060    fn get_all_tasks(
3061        &mut self,
3062        task_type: Option<String>,
3063        status: Option<String>,
3064        requester: Option<String>,
3065        approver: Option<String>,
3066        all_search: Option<String>,
3067        limit: Option<i32>,
3068        offset: Option<i32>,
3069        sort_by: Option<String>,
3070        base_filters: Option<String>,
3071    ) -> Result<models::GetAllTasksResponse, Self::Error> {
3072        self.get_all_tasks(
3073            task_type,
3074            status,
3075            requester,
3076            approver,
3077            all_search,
3078            limit,
3079            offset,
3080            sort_by,
3081            base_filters,
3082        )
3083    }
3084
3085    fn get_task(&mut self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error> {
3086        self.get_task(task_id)
3087    }
3088
3089    fn get_task_status(&mut self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error> {
3090        self.get_task_status(task_id)
3091    }
3092
3093    fn update_task(
3094        &mut self,
3095        task_id: uuid::Uuid,
3096        body: models::TaskUpdateRequest,
3097    ) -> Result<models::TaskResult, Self::Error> {
3098        self.update_task(task_id, body)
3099    }
3100
3101    fn convert_app(
3102        &mut self,
3103        body: models::ConversionRequest,
3104    ) -> Result<models::ConversionResponse, Self::Error> {
3105        self.convert_app(body)
3106    }
3107
3108    fn accept_terms_and_conditions(&mut self) -> Result<(), Self::Error> {
3109        self.accept_terms_and_conditions()
3110    }
3111
3112    fn change_password(&mut self, body: models::PasswordChangeRequest) -> Result<(), Self::Error> {
3113        self.change_password(body)
3114    }
3115
3116    fn confirm_email(
3117        &mut self,
3118        body: models::ConfirmEmailRequest,
3119    ) -> Result<models::ConfirmEmailResponse, Self::Error> {
3120        self.confirm_email(body)
3121    }
3122
3123    fn create_user(&mut self, body: models::SignupRequest) -> Result<models::User, Self::Error> {
3124        self.create_user(body)
3125    }
3126
3127    fn delete_user_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3128        self.delete_user_account(user_id)
3129    }
3130
3131    fn delete_user_from_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3132        self.delete_user_from_account(user_id)
3133    }
3134
3135    fn forgot_password(&mut self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error> {
3136        self.forgot_password(body)
3137    }
3138
3139    fn get_all_users(
3140        &mut self,
3141        all_search: Option<String>,
3142        limit: Option<i32>,
3143        offset: Option<i32>,
3144        sort_by: Option<String>,
3145    ) -> Result<models::GetAllUsersResponse, Self::Error> {
3146        self.get_all_users(all_search, limit, offset, sort_by)
3147    }
3148
3149    fn get_logged_in_user(&mut self) -> Result<models::User, Self::Error> {
3150        self.get_logged_in_user()
3151    }
3152
3153    fn get_user(&mut self, user_id: uuid::Uuid) -> Result<models::User, Self::Error> {
3154        self.get_user(user_id)
3155    }
3156
3157    fn invite_user(
3158        &mut self,
3159        body: models::InviteUserRequest,
3160    ) -> Result<models::User, Self::Error> {
3161        self.invite_user(body)
3162    }
3163
3164    fn process_invitations(
3165        &mut self,
3166        body: models::ProcessInviteRequest,
3167    ) -> Result<(), Self::Error> {
3168        self.process_invitations(body)
3169    }
3170
3171    fn resend_confirm_email(&mut self) -> Result<(), Self::Error> {
3172        self.resend_confirm_email()
3173    }
3174
3175    fn resend_invitation(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3176        self.resend_invitation(user_id)
3177    }
3178
3179    fn reset_password(
3180        &mut self,
3181        user_id: uuid::Uuid,
3182        body: models::PasswordResetRequest,
3183    ) -> Result<(), Self::Error> {
3184        self.reset_password(user_id, body)
3185    }
3186
3187    fn update_user(
3188        &mut self,
3189        user_id: uuid::Uuid,
3190        body: models::UpdateUserRequest,
3191    ) -> Result<models::User, Self::Error> {
3192        self.update_user(user_id, body)
3193    }
3194
3195    fn validate_password_reset_token(
3196        &mut self,
3197        user_id: uuid::Uuid,
3198        body: models::ValidateTokenRequest,
3199    ) -> Result<models::ValidateTokenResponse, Self::Error> {
3200        self.validate_password_reset_token(user_id, body)
3201    }
3202
3203    fn create_workflow_graph(
3204        &mut self,
3205        body: models::CreateWorkflowGraph,
3206    ) -> Result<models::WorkflowGraph, Self::Error> {
3207        self.create_workflow_graph(body)
3208    }
3209
3210    fn delete_workflow_graph(&mut self, graph_id: uuid::Uuid) -> Result<(), Self::Error> {
3211        self.delete_workflow_graph(graph_id)
3212    }
3213
3214    fn get_all_workflow_graphs(
3215        &mut self,
3216        name: Option<String>,
3217        description: Option<String>,
3218        all_search: Option<String>,
3219        parent_graph_id: Option<String>,
3220        sort_by: Option<String>,
3221        limit: Option<i32>,
3222        offset: Option<i32>,
3223    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error> {
3224        self.get_all_workflow_graphs(
3225            name,
3226            description,
3227            all_search,
3228            parent_graph_id,
3229            sort_by,
3230            limit,
3231            offset,
3232        )
3233    }
3234
3235    fn get_workflow_graph(
3236        &mut self,
3237        graph_id: uuid::Uuid,
3238    ) -> Result<models::WorkflowGraph, Self::Error> {
3239        self.get_workflow_graph(graph_id)
3240    }
3241
3242    fn update_workflow_graph(
3243        &mut self,
3244        graph_id: uuid::Uuid,
3245        body: models::UpdateWorkflowGraph,
3246    ) -> Result<models::WorkflowGraph, Self::Error> {
3247        self.update_workflow_graph(graph_id, body)
3248    }
3249
3250    fn create_final_workflow_graph(
3251        &mut self,
3252        body: models::CreateFinalWorkflowGraph,
3253    ) -> Result<models::FinalWorkflow, Self::Error> {
3254        self.create_final_workflow_graph(body)
3255    }
3256
3257    fn delete_final_workflow_graph(
3258        &mut self,
3259        graph_id: uuid::Uuid,
3260        version: String,
3261    ) -> Result<(), Self::Error> {
3262        self.delete_final_workflow_graph(graph_id, version)
3263    }
3264
3265    fn get_all_final_workflow_graphs(
3266        &mut self,
3267        name: Option<String>,
3268        description: Option<String>,
3269        all_search: Option<String>,
3270        sort_by: Option<String>,
3271        limit: Option<i32>,
3272        offset: Option<i32>,
3273    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error> {
3274        self.get_all_final_workflow_graphs(name, description, all_search, sort_by, limit, offset)
3275    }
3276
3277    fn get_final_workflow_graph(
3278        &mut self,
3279        graph_id: uuid::Uuid,
3280        version: String,
3281    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
3282        self.get_final_workflow_graph(graph_id, version)
3283    }
3284
3285    fn get_full_final_workflow_graph(
3286        &mut self,
3287        graph_id: uuid::Uuid,
3288    ) -> Result<models::FinalWorkflow, Self::Error> {
3289        self.get_full_final_workflow_graph(graph_id)
3290    }
3291
3292    fn update_final_workflow_graph(
3293        &mut self,
3294        graph_id: uuid::Uuid,
3295        body: models::CreateWorkflowVersionRequest,
3296    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
3297        self.update_final_workflow_graph(graph_id, body)
3298    }
3299
3300    fn get_zone(&mut self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error> {
3301        self.get_zone(zone_id)
3302    }
3303
3304    fn get_zone_join_token(
3305        &mut self,
3306        zone_id: uuid::Uuid,
3307    ) -> Result<models::ZoneJoinToken, Self::Error> {
3308        self.get_zone_join_token(zone_id)
3309    }
3310
3311    fn get_zones(&mut self) -> Result<Vec<models::Zone>, Self::Error> {
3312        self.get_zones()
3313    }
3314}
3315
3316impl<T, E> Api for std::cell::RefCell<T>
3317where
3318    T: ApiMut<Error = E>,
3319{
3320    type Error = E;
3321
3322    fn create_account(&self, body: models::AccountRequest) -> Result<models::Account, Self::Error> {
3323        self.borrow_mut().create_account(body)
3324    }
3325
3326    fn delete_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
3327        self.borrow_mut().delete_account(account_id)
3328    }
3329
3330    fn get_account(&self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error> {
3331        self.borrow_mut().get_account(account_id)
3332    }
3333
3334    fn get_accounts(&self) -> Result<models::AccountListResponse, Self::Error> {
3335        self.borrow_mut().get_accounts()
3336    }
3337
3338    fn select_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
3339        self.borrow_mut().select_account(account_id)
3340    }
3341
3342    fn update_account(
3343        &self,
3344        account_id: uuid::Uuid,
3345        body: models::AccountUpdateRequest,
3346    ) -> Result<models::Account, Self::Error> {
3347        self.borrow_mut().update_account(account_id, body)
3348    }
3349
3350    fn add_application(&self, body: models::AppRequest) -> Result<models::App, Self::Error> {
3351        self.borrow_mut().add_application(body)
3352    }
3353
3354    fn delete_app(&self, app_id: uuid::Uuid) -> Result<(), Self::Error> {
3355        self.borrow_mut().delete_app(app_id)
3356    }
3357
3358    fn get_all_apps(
3359        &self,
3360        name: Option<String>,
3361        description: Option<String>,
3362        all_search: Option<String>,
3363        limit: Option<i32>,
3364        offset: Option<i32>,
3365        sort_by: Option<String>,
3366    ) -> Result<models::GetAllAppsResponse, Self::Error> {
3367        self.borrow_mut()
3368            .get_all_apps(name, description, all_search, limit, offset, sort_by)
3369    }
3370
3371    fn get_app(&self, app_id: uuid::Uuid) -> Result<models::App, Self::Error> {
3372        self.borrow_mut().get_app(app_id)
3373    }
3374
3375    fn get_app_certificate(
3376        &self,
3377        node_id: uuid::Uuid,
3378        app_id: uuid::Uuid,
3379    ) -> Result<models::Certificate, Self::Error> {
3380        self.borrow_mut().get_app_certificate(node_id, app_id)
3381    }
3382
3383    fn get_app_node_certificate_details(
3384        &self,
3385        node_id: uuid::Uuid,
3386        app_id: uuid::Uuid,
3387    ) -> Result<models::CertificateDetails, Self::Error> {
3388        self.borrow_mut()
3389            .get_app_node_certificate_details(node_id, app_id)
3390    }
3391
3392    fn get_apps_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
3393        self.borrow_mut().get_apps_unique_labels()
3394    }
3395
3396    fn update_app(
3397        &self,
3398        app_id: uuid::Uuid,
3399        body: models::AppBodyUpdateRequest,
3400    ) -> Result<models::App, Self::Error> {
3401        self.borrow_mut().update_app(app_id, body)
3402    }
3403
3404    fn create_application_config(
3405        &self,
3406        body: models::ApplicationConfig,
3407    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
3408        self.borrow_mut().create_application_config(body)
3409    }
3410
3411    fn delete_application_config(&self, config_id: String) -> Result<(), Self::Error> {
3412        self.borrow_mut().delete_application_config(config_id)
3413    }
3414
3415    fn get_all_application_configs(
3416        &self,
3417        name: Option<String>,
3418        description: Option<String>,
3419        image_id: Option<uuid::Uuid>,
3420        limit: Option<i32>,
3421        offset: Option<i32>,
3422    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error> {
3423        self.borrow_mut()
3424            .get_all_application_configs(name, description, image_id, limit, offset)
3425    }
3426
3427    fn get_application_config(
3428        &self,
3429        config_id: String,
3430    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
3431        self.borrow_mut().get_application_config(config_id)
3432    }
3433
3434    fn get_runtime_application_config(
3435        &self,
3436        expected_hash: &[u8; 32],
3437    ) -> Result<models::RuntimeAppConfig, Self::Error> {
3438        self.borrow_mut()
3439            .get_runtime_application_config(expected_hash)
3440    }
3441
3442    fn get_specific_runtime_application_config(
3443        &self,
3444        config_id: String,
3445    ) -> Result<models::RuntimeAppConfig, Self::Error> {
3446        self.borrow_mut()
3447            .get_specific_runtime_application_config(config_id)
3448    }
3449
3450    fn update_application_config(
3451        &self,
3452        config_id: String,
3453        body: models::UpdateApplicationConfigRequest,
3454    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
3455        self.borrow_mut().update_application_config(config_id, body)
3456    }
3457
3458    fn approve_approval_request(
3459        &self,
3460        request_id: uuid::Uuid,
3461        body: Option<models::ApproveRequest>,
3462    ) -> Result<models::ApprovalRequest, Self::Error> {
3463        self.borrow_mut().approve_approval_request(request_id, body)
3464    }
3465
3466    fn create_approval_request(
3467        &self,
3468        body: models::ApprovalRequestRequest,
3469    ) -> Result<models::ApprovalRequest, Self::Error> {
3470        self.borrow_mut().create_approval_request(body)
3471    }
3472
3473    fn delete_approval_request(&self, request_id: uuid::Uuid) -> Result<(), Self::Error> {
3474        self.borrow_mut().delete_approval_request(request_id)
3475    }
3476
3477    fn deny_approval_request(
3478        &self,
3479        request_id: uuid::Uuid,
3480        body: Option<models::DenyRequest>,
3481    ) -> Result<models::ApprovalRequest, Self::Error> {
3482        self.borrow_mut().deny_approval_request(request_id, body)
3483    }
3484
3485    fn get_all_approval_requests(
3486        &self,
3487        requester: Option<uuid::Uuid>,
3488        reviewer: Option<uuid::Uuid>,
3489        subject: Option<uuid::Uuid>,
3490        status: Option<String>,
3491        all_search: Option<String>,
3492        sort_by: Option<String>,
3493        limit: Option<i32>,
3494        offset: Option<i32>,
3495    ) -> Result<models::GetAllApprovalRequests, Self::Error> {
3496        self.borrow_mut().get_all_approval_requests(
3497            requester, reviewer, subject, status, all_search, sort_by, limit, offset,
3498        )
3499    }
3500
3501    fn get_approval_request(
3502        &self,
3503        request_id: uuid::Uuid,
3504    ) -> Result<models::ApprovalRequest, Self::Error> {
3505        self.borrow_mut().get_approval_request(request_id)
3506    }
3507
3508    fn get_approval_request_result(
3509        &self,
3510        request_id: uuid::Uuid,
3511    ) -> Result<models::ApprovableResult, Self::Error> {
3512        self.borrow_mut().get_approval_request_result(request_id)
3513    }
3514
3515    fn authenticate_user(
3516        &self,
3517        body: Option<models::AuthRequest>,
3518    ) -> Result<models::AuthResponse, Self::Error> {
3519        self.borrow_mut().authenticate_user(body)
3520    }
3521
3522    fn convert_app_build(
3523        &self,
3524        body: models::ConvertAppBuildRequest,
3525    ) -> Result<models::Build, Self::Error> {
3526        self.borrow_mut().convert_app_build(body)
3527    }
3528
3529    fn create_build(&self, body: models::CreateBuildRequest) -> Result<models::Build, Self::Error> {
3530        self.borrow_mut().create_build(body)
3531    }
3532
3533    fn delete_build(&self, build_id: uuid::Uuid) -> Result<(), Self::Error> {
3534        self.borrow_mut().delete_build(build_id)
3535    }
3536
3537    fn get_all_builds(
3538        &self,
3539        all_search: Option<String>,
3540        docker_image_name: Option<String>,
3541        config_id: Option<String>,
3542        deployed_status: Option<String>,
3543        status: Option<String>,
3544        limit: Option<i32>,
3545        offset: Option<i32>,
3546        sort_by: Option<String>,
3547    ) -> Result<models::GetAllBuildsResponse, Self::Error> {
3548        self.borrow_mut().get_all_builds(
3549            all_search,
3550            docker_image_name,
3551            config_id,
3552            deployed_status,
3553            status,
3554            limit,
3555            offset,
3556            sort_by,
3557        )
3558    }
3559
3560    fn get_build(&self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error> {
3561        self.borrow_mut().get_build(build_id)
3562    }
3563
3564    fn get_build_deployments(
3565        &self,
3566        build_id: uuid::Uuid,
3567        status: Option<String>,
3568        all_search: Option<String>,
3569        sort_by: Option<String>,
3570        limit: Option<i32>,
3571        offset: Option<i32>,
3572    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error> {
3573        self.borrow_mut()
3574            .get_build_deployments(build_id, status, all_search, sort_by, limit, offset)
3575    }
3576
3577    fn update_build(
3578        &self,
3579        build_id: uuid::Uuid,
3580        body: models::BuildUpdateRequest,
3581    ) -> Result<models::Build, Self::Error> {
3582        self.borrow_mut().update_build(build_id, body)
3583    }
3584
3585    fn get_certificate(&self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error> {
3586        self.borrow_mut().get_certificate(cert_id)
3587    }
3588
3589    fn new_certificate(
3590        &self,
3591        body: models::NewCertificateRequest,
3592    ) -> Result<models::TaskResult, Self::Error> {
3593        self.borrow_mut().new_certificate(body)
3594    }
3595
3596    fn create_dataset(
3597        &self,
3598        body: models::CreateDatasetRequest,
3599    ) -> Result<models::Dataset, Self::Error> {
3600        self.borrow_mut().create_dataset(body)
3601    }
3602
3603    fn delete_dataset(&self, dataset_id: uuid::Uuid) -> Result<(), Self::Error> {
3604        self.borrow_mut().delete_dataset(dataset_id)
3605    }
3606
3607    fn get_all_datasets(
3608        &self,
3609        name: Option<String>,
3610        description: Option<String>,
3611        limit: Option<i32>,
3612        offset: Option<i32>,
3613    ) -> Result<models::GetAllDatasetsResponse, Self::Error> {
3614        self.borrow_mut()
3615            .get_all_datasets(name, description, limit, offset)
3616    }
3617
3618    fn get_dataset(&self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error> {
3619        self.borrow_mut().get_dataset(dataset_id)
3620    }
3621
3622    fn update_dataset(
3623        &self,
3624        dataset_id: uuid::Uuid,
3625        body: models::DatasetUpdateRequest,
3626    ) -> Result<models::Dataset, Self::Error> {
3627        self.borrow_mut().update_dataset(dataset_id, body)
3628    }
3629
3630    fn deactivate_node(&self, node_id: uuid::Uuid) -> Result<(), Self::Error> {
3631        self.borrow_mut().deactivate_node(node_id)
3632    }
3633
3634    fn get_all_nodes(
3635        &self,
3636        name: Option<String>,
3637        description: Option<String>,
3638        sgx_version: Option<String>,
3639        all_search: Option<String>,
3640        status: Option<String>,
3641        limit: Option<i32>,
3642        offset: Option<i32>,
3643        sort_by: Option<String>,
3644    ) -> Result<models::GetAllNodesResponse, Self::Error> {
3645        self.borrow_mut().get_all_nodes(
3646            name,
3647            description,
3648            sgx_version,
3649            all_search,
3650            status,
3651            limit,
3652            offset,
3653            sort_by,
3654        )
3655    }
3656
3657    fn get_node(&self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error> {
3658        self.borrow_mut().get_node(node_id)
3659    }
3660
3661    fn get_node_certificate(
3662        &self,
3663        node_id: uuid::Uuid,
3664    ) -> Result<models::Certificate, Self::Error> {
3665        self.borrow_mut().get_node_certificate(node_id)
3666    }
3667
3668    fn get_node_certificate_details(
3669        &self,
3670        node_id: uuid::Uuid,
3671    ) -> Result<models::CertificateDetails, Self::Error> {
3672        self.borrow_mut().get_node_certificate_details(node_id)
3673    }
3674
3675    fn get_nodes_unique_labels(&self) -> Result<models::LabelsCount, Self::Error> {
3676        self.borrow_mut().get_nodes_unique_labels()
3677    }
3678
3679    fn provision_node(
3680        &self,
3681        body: models::NodeProvisionRequest,
3682    ) -> Result<models::TaskResult, Self::Error> {
3683        self.borrow_mut().provision_node(body)
3684    }
3685
3686    fn update_node(
3687        &self,
3688        node_id: uuid::Uuid,
3689        body: models::NodeUpdateRequest,
3690    ) -> Result<models::Node, Self::Error> {
3691        self.borrow_mut().update_node(node_id, body)
3692    }
3693
3694    fn update_node_status(
3695        &self,
3696        body: models::NodeStatusRequest,
3697    ) -> Result<models::NodeStatusResponse, Self::Error> {
3698        self.borrow_mut().update_node_status(body)
3699    }
3700
3701    fn create_registry(
3702        &self,
3703        registry_request: models::RegistryRequest,
3704    ) -> Result<models::Registry, Self::Error> {
3705        self.borrow_mut().create_registry(registry_request)
3706    }
3707
3708    fn delete_registry(&self, registry_id: uuid::Uuid) -> Result<(), Self::Error> {
3709        self.borrow_mut().delete_registry(registry_id)
3710    }
3711
3712    fn get_all_registries(&self) -> Result<Vec<models::Registry>, Self::Error> {
3713        self.borrow_mut().get_all_registries()
3714    }
3715
3716    fn get_registry(&self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error> {
3717        self.borrow_mut().get_registry(registry_id)
3718    }
3719
3720    fn get_registry_for_app(
3721        &self,
3722        app_id: uuid::Uuid,
3723    ) -> Result<models::AppRegistryResponse, Self::Error> {
3724        self.borrow_mut().get_registry_for_app(app_id)
3725    }
3726
3727    fn get_registry_for_image(
3728        &self,
3729        image_name: String,
3730    ) -> Result<models::ImageRegistryResponse, Self::Error> {
3731        self.borrow_mut().get_registry_for_image(image_name)
3732    }
3733
3734    fn update_registry(
3735        &self,
3736        registry_id: uuid::Uuid,
3737        body: models::UpdateRegistryRequest,
3738    ) -> Result<models::Registry, Self::Error> {
3739        self.borrow_mut().update_registry(registry_id, body)
3740    }
3741
3742    fn get_manager_version(&self) -> Result<models::VersionResponse, Self::Error> {
3743        self.borrow_mut().get_manager_version()
3744    }
3745
3746    fn get_all_tasks(
3747        &self,
3748        task_type: Option<String>,
3749        status: Option<String>,
3750        requester: Option<String>,
3751        approver: Option<String>,
3752        all_search: Option<String>,
3753        limit: Option<i32>,
3754        offset: Option<i32>,
3755        sort_by: Option<String>,
3756        base_filters: Option<String>,
3757    ) -> Result<models::GetAllTasksResponse, Self::Error> {
3758        self.borrow_mut().get_all_tasks(
3759            task_type,
3760            status,
3761            requester,
3762            approver,
3763            all_search,
3764            limit,
3765            offset,
3766            sort_by,
3767            base_filters,
3768        )
3769    }
3770
3771    fn get_task(&self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error> {
3772        self.borrow_mut().get_task(task_id)
3773    }
3774
3775    fn get_task_status(&self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error> {
3776        self.borrow_mut().get_task_status(task_id)
3777    }
3778
3779    fn update_task(
3780        &self,
3781        task_id: uuid::Uuid,
3782        body: models::TaskUpdateRequest,
3783    ) -> Result<models::TaskResult, Self::Error> {
3784        self.borrow_mut().update_task(task_id, body)
3785    }
3786
3787    fn convert_app(
3788        &self,
3789        body: models::ConversionRequest,
3790    ) -> Result<models::ConversionResponse, Self::Error> {
3791        self.borrow_mut().convert_app(body)
3792    }
3793
3794    fn accept_terms_and_conditions(&self) -> Result<(), Self::Error> {
3795        self.borrow_mut().accept_terms_and_conditions()
3796    }
3797
3798    fn change_password(&self, body: models::PasswordChangeRequest) -> Result<(), Self::Error> {
3799        self.borrow_mut().change_password(body)
3800    }
3801
3802    fn confirm_email(
3803        &self,
3804        body: models::ConfirmEmailRequest,
3805    ) -> Result<models::ConfirmEmailResponse, Self::Error> {
3806        self.borrow_mut().confirm_email(body)
3807    }
3808
3809    fn create_user(&self, body: models::SignupRequest) -> Result<models::User, Self::Error> {
3810        self.borrow_mut().create_user(body)
3811    }
3812
3813    fn delete_user_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3814        self.borrow_mut().delete_user_account(user_id)
3815    }
3816
3817    fn delete_user_from_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3818        self.borrow_mut().delete_user_from_account(user_id)
3819    }
3820
3821    fn forgot_password(&self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error> {
3822        self.borrow_mut().forgot_password(body)
3823    }
3824
3825    fn get_all_users(
3826        &self,
3827        all_search: Option<String>,
3828        limit: Option<i32>,
3829        offset: Option<i32>,
3830        sort_by: Option<String>,
3831    ) -> Result<models::GetAllUsersResponse, Self::Error> {
3832        self.borrow_mut()
3833            .get_all_users(all_search, limit, offset, sort_by)
3834    }
3835
3836    fn get_logged_in_user(&self) -> Result<models::User, Self::Error> {
3837        self.borrow_mut().get_logged_in_user()
3838    }
3839
3840    fn get_user(&self, user_id: uuid::Uuid) -> Result<models::User, Self::Error> {
3841        self.borrow_mut().get_user(user_id)
3842    }
3843
3844    fn invite_user(&self, body: models::InviteUserRequest) -> Result<models::User, Self::Error> {
3845        self.borrow_mut().invite_user(body)
3846    }
3847
3848    fn process_invitations(&self, body: models::ProcessInviteRequest) -> Result<(), Self::Error> {
3849        self.borrow_mut().process_invitations(body)
3850    }
3851
3852    fn resend_confirm_email(&self) -> Result<(), Self::Error> {
3853        self.borrow_mut().resend_confirm_email()
3854    }
3855
3856    fn resend_invitation(&self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
3857        self.borrow_mut().resend_invitation(user_id)
3858    }
3859
3860    fn reset_password(
3861        &self,
3862        user_id: uuid::Uuid,
3863        body: models::PasswordResetRequest,
3864    ) -> Result<(), Self::Error> {
3865        self.borrow_mut().reset_password(user_id, body)
3866    }
3867
3868    fn update_user(
3869        &self,
3870        user_id: uuid::Uuid,
3871        body: models::UpdateUserRequest,
3872    ) -> Result<models::User, Self::Error> {
3873        self.borrow_mut().update_user(user_id, body)
3874    }
3875
3876    fn validate_password_reset_token(
3877        &self,
3878        user_id: uuid::Uuid,
3879        body: models::ValidateTokenRequest,
3880    ) -> Result<models::ValidateTokenResponse, Self::Error> {
3881        self.borrow_mut()
3882            .validate_password_reset_token(user_id, body)
3883    }
3884
3885    fn create_workflow_graph(
3886        &self,
3887        body: models::CreateWorkflowGraph,
3888    ) -> Result<models::WorkflowGraph, Self::Error> {
3889        self.borrow_mut().create_workflow_graph(body)
3890    }
3891
3892    fn delete_workflow_graph(&self, graph_id: uuid::Uuid) -> Result<(), Self::Error> {
3893        self.borrow_mut().delete_workflow_graph(graph_id)
3894    }
3895
3896    fn get_all_workflow_graphs(
3897        &self,
3898        name: Option<String>,
3899        description: Option<String>,
3900        all_search: Option<String>,
3901        parent_graph_id: Option<String>,
3902        sort_by: Option<String>,
3903        limit: Option<i32>,
3904        offset: Option<i32>,
3905    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error> {
3906        self.borrow_mut().get_all_workflow_graphs(
3907            name,
3908            description,
3909            all_search,
3910            parent_graph_id,
3911            sort_by,
3912            limit,
3913            offset,
3914        )
3915    }
3916
3917    fn get_workflow_graph(
3918        &self,
3919        graph_id: uuid::Uuid,
3920    ) -> Result<models::WorkflowGraph, Self::Error> {
3921        self.borrow_mut().get_workflow_graph(graph_id)
3922    }
3923
3924    fn update_workflow_graph(
3925        &self,
3926        graph_id: uuid::Uuid,
3927        body: models::UpdateWorkflowGraph,
3928    ) -> Result<models::WorkflowGraph, Self::Error> {
3929        self.borrow_mut().update_workflow_graph(graph_id, body)
3930    }
3931
3932    fn create_final_workflow_graph(
3933        &self,
3934        body: models::CreateFinalWorkflowGraph,
3935    ) -> Result<models::FinalWorkflow, Self::Error> {
3936        self.borrow_mut().create_final_workflow_graph(body)
3937    }
3938
3939    fn delete_final_workflow_graph(
3940        &self,
3941        graph_id: uuid::Uuid,
3942        version: String,
3943    ) -> Result<(), Self::Error> {
3944        self.borrow_mut()
3945            .delete_final_workflow_graph(graph_id, version)
3946    }
3947
3948    fn get_all_final_workflow_graphs(
3949        &self,
3950        name: Option<String>,
3951        description: Option<String>,
3952        all_search: Option<String>,
3953        sort_by: Option<String>,
3954        limit: Option<i32>,
3955        offset: Option<i32>,
3956    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error> {
3957        self.borrow_mut().get_all_final_workflow_graphs(
3958            name,
3959            description,
3960            all_search,
3961            sort_by,
3962            limit,
3963            offset,
3964        )
3965    }
3966
3967    fn get_final_workflow_graph(
3968        &self,
3969        graph_id: uuid::Uuid,
3970        version: String,
3971    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
3972        self.borrow_mut()
3973            .get_final_workflow_graph(graph_id, version)
3974    }
3975
3976    fn get_full_final_workflow_graph(
3977        &self,
3978        graph_id: uuid::Uuid,
3979    ) -> Result<models::FinalWorkflow, Self::Error> {
3980        self.borrow_mut().get_full_final_workflow_graph(graph_id)
3981    }
3982
3983    fn update_final_workflow_graph(
3984        &self,
3985        graph_id: uuid::Uuid,
3986        body: models::CreateWorkflowVersionRequest,
3987    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
3988        self.borrow_mut()
3989            .update_final_workflow_graph(graph_id, body)
3990    }
3991
3992    fn get_zone(&self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error> {
3993        self.borrow_mut().get_zone(zone_id)
3994    }
3995
3996    fn get_zone_join_token(
3997        &self,
3998        zone_id: uuid::Uuid,
3999    ) -> Result<models::ZoneJoinToken, Self::Error> {
4000        self.borrow_mut().get_zone_join_token(zone_id)
4001    }
4002
4003    fn get_zones(&self) -> Result<Vec<models::Zone>, Self::Error> {
4004        self.borrow_mut().get_zones()
4005    }
4006}
4007
4008pub trait AccountsApi {
4009    type Error;
4010
4011    /// Create a new account.
4012    fn create_account(&self, body: models::AccountRequest) -> Result<models::Account, Self::Error>;
4013
4014    /// Delete an account.
4015    fn delete_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
4016
4017    /// Get a specific account.
4018    fn get_account(&self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error>;
4019
4020    /// Get all accounts.
4021    fn get_accounts(&self) -> Result<models::AccountListResponse, Self::Error>;
4022
4023    /// Select a user's account to work on.
4024    fn select_account(&self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
4025
4026    /// Update an account.
4027    fn update_account(
4028        &self,
4029        account_id: uuid::Uuid,
4030        body: models::AccountUpdateRequest,
4031    ) -> Result<models::Account, Self::Error>;
4032}
4033
4034pub trait AccountsApiMut {
4035    type Error;
4036
4037    /// Create a new account.
4038    fn create_account(
4039        &mut self,
4040        body: models::AccountRequest,
4041    ) -> Result<models::Account, Self::Error>;
4042
4043    /// Delete an account.
4044    fn delete_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
4045
4046    /// Get a specific account.
4047    fn get_account(&mut self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error>;
4048
4049    /// Get all accounts.
4050    fn get_accounts(&mut self) -> Result<models::AccountListResponse, Self::Error>;
4051
4052    /// Select a user's account to work on.
4053    fn select_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error>;
4054
4055    /// Update an account.
4056    fn update_account(
4057        &mut self,
4058        account_id: uuid::Uuid,
4059        body: models::AccountUpdateRequest,
4060    ) -> Result<models::Account, Self::Error>;
4061}
4062
4063// This is mostly so that we don't have to convert all the malbork APIs to
4064// ApiMut at once.
4065impl<T, E> AccountsApiMut for T
4066where
4067    T: AccountsApi<Error = E>,
4068{
4069    type Error = E;
4070
4071    fn create_account(
4072        &mut self,
4073        body: models::AccountRequest,
4074    ) -> Result<models::Account, Self::Error> {
4075        <T as AccountsApi>::create_account(self, body)
4076    }
4077
4078    fn delete_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
4079        <T as AccountsApi>::delete_account(self, account_id)
4080    }
4081
4082    fn get_account(&mut self, account_id: uuid::Uuid) -> Result<models::Account, Self::Error> {
4083        <T as AccountsApi>::get_account(self, account_id)
4084    }
4085
4086    fn get_accounts(&mut self) -> Result<models::AccountListResponse, Self::Error> {
4087        <T as AccountsApi>::get_accounts(self)
4088    }
4089
4090    fn select_account(&mut self, account_id: uuid::Uuid) -> Result<(), Self::Error> {
4091        <T as AccountsApi>::select_account(self, account_id)
4092    }
4093
4094    fn update_account(
4095        &mut self,
4096        account_id: uuid::Uuid,
4097        body: models::AccountUpdateRequest,
4098    ) -> Result<models::Account, Self::Error> {
4099        <T as AccountsApi>::update_account(self, account_id, body)
4100    }
4101}
4102
4103pub trait AppApi {
4104    type Error;
4105
4106    /// Add an application.
4107    fn add_application(&self, body: models::AppRequest) -> Result<models::App, Self::Error>;
4108
4109    /// Delete a particular app
4110    fn delete_app(&self, app_id: uuid::Uuid) -> Result<(), Self::Error>;
4111
4112    /// Get all apps information.
4113    fn get_all_apps(
4114        &self,
4115        name: Option<String>,
4116        description: Option<String>,
4117        all_search: Option<String>,
4118        limit: Option<i32>,
4119        offset: Option<i32>,
4120        sort_by: Option<String>,
4121    ) -> Result<models::GetAllAppsResponse, Self::Error>;
4122
4123    /// Get details of a particular app.
4124    fn get_app(&self, app_id: uuid::Uuid) -> Result<models::App, Self::Error>;
4125
4126    /// Get an attested app's certificate.
4127    fn get_app_certificate(
4128        &self,
4129        node_id: uuid::Uuid,
4130        app_id: uuid::Uuid,
4131    ) -> Result<models::Certificate, Self::Error>;
4132
4133    /// Get an app's certificate for a compute node.
4134    fn get_app_node_certificate_details(
4135        &self,
4136        node_id: uuid::Uuid,
4137        app_id: uuid::Uuid,
4138    ) -> Result<models::CertificateDetails, Self::Error>;
4139
4140    /// Get all the unique labels across all the applications within selected account
4141    fn get_apps_unique_labels(&self) -> Result<models::LabelsCount, Self::Error>;
4142
4143    /// Update details of a particular app.
4144    fn update_app(
4145        &self,
4146        app_id: uuid::Uuid,
4147        body: models::AppBodyUpdateRequest,
4148    ) -> Result<models::App, Self::Error>;
4149}
4150
4151pub trait AppApiMut {
4152    type Error;
4153
4154    /// Add an application.
4155    fn add_application(&mut self, body: models::AppRequest) -> Result<models::App, Self::Error>;
4156
4157    /// Delete a particular app
4158    fn delete_app(&mut self, app_id: uuid::Uuid) -> Result<(), Self::Error>;
4159
4160    /// Get all apps information.
4161    fn get_all_apps(
4162        &mut self,
4163        name: Option<String>,
4164        description: Option<String>,
4165        all_search: Option<String>,
4166        limit: Option<i32>,
4167        offset: Option<i32>,
4168        sort_by: Option<String>,
4169    ) -> Result<models::GetAllAppsResponse, Self::Error>;
4170
4171    /// Get details of a particular app.
4172    fn get_app(&mut self, app_id: uuid::Uuid) -> Result<models::App, Self::Error>;
4173
4174    /// Get an attested app's certificate.
4175    fn get_app_certificate(
4176        &mut self,
4177        node_id: uuid::Uuid,
4178        app_id: uuid::Uuid,
4179    ) -> Result<models::Certificate, Self::Error>;
4180
4181    /// Get an app's certificate for a compute node.
4182    fn get_app_node_certificate_details(
4183        &mut self,
4184        node_id: uuid::Uuid,
4185        app_id: uuid::Uuid,
4186    ) -> Result<models::CertificateDetails, Self::Error>;
4187
4188    /// Get all the unique labels across all the applications within selected account
4189    fn get_apps_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error>;
4190
4191    /// Update details of a particular app.
4192    fn update_app(
4193        &mut self,
4194        app_id: uuid::Uuid,
4195        body: models::AppBodyUpdateRequest,
4196    ) -> Result<models::App, Self::Error>;
4197}
4198
4199// This is mostly so that we don't have to convert all the malbork APIs to
4200// ApiMut at once.
4201impl<T, E> AppApiMut for T
4202where
4203    T: AppApi<Error = E>,
4204{
4205    type Error = E;
4206
4207    fn add_application(&mut self, body: models::AppRequest) -> Result<models::App, Self::Error> {
4208        <T as AppApi>::add_application(self, body)
4209    }
4210
4211    fn delete_app(&mut self, app_id: uuid::Uuid) -> Result<(), Self::Error> {
4212        <T as AppApi>::delete_app(self, app_id)
4213    }
4214
4215    fn get_all_apps(
4216        &mut self,
4217        name: Option<String>,
4218        description: Option<String>,
4219        all_search: Option<String>,
4220        limit: Option<i32>,
4221        offset: Option<i32>,
4222        sort_by: Option<String>,
4223    ) -> Result<models::GetAllAppsResponse, Self::Error> {
4224        <T as AppApi>::get_all_apps(self, name, description, all_search, limit, offset, sort_by)
4225    }
4226
4227    fn get_app(&mut self, app_id: uuid::Uuid) -> Result<models::App, Self::Error> {
4228        <T as AppApi>::get_app(self, app_id)
4229    }
4230
4231    fn get_app_certificate(
4232        &mut self,
4233        node_id: uuid::Uuid,
4234        app_id: uuid::Uuid,
4235    ) -> Result<models::Certificate, Self::Error> {
4236        <T as AppApi>::get_app_certificate(self, node_id, app_id)
4237    }
4238
4239    fn get_app_node_certificate_details(
4240        &mut self,
4241        node_id: uuid::Uuid,
4242        app_id: uuid::Uuid,
4243    ) -> Result<models::CertificateDetails, Self::Error> {
4244        <T as AppApi>::get_app_node_certificate_details(self, node_id, app_id)
4245    }
4246
4247    fn get_apps_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error> {
4248        <T as AppApi>::get_apps_unique_labels(self)
4249    }
4250
4251    fn update_app(
4252        &mut self,
4253        app_id: uuid::Uuid,
4254        body: models::AppBodyUpdateRequest,
4255    ) -> Result<models::App, Self::Error> {
4256        <T as AppApi>::update_app(self, app_id, body)
4257    }
4258}
4259
4260pub trait ApplicationConfigApi {
4261    type Error;
4262
4263    /// Add an app config.
4264    fn create_application_config(
4265        &self,
4266        body: models::ApplicationConfig,
4267    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4268
4269    /// Delete a particular app config
4270    fn delete_application_config(&self, config_id: String) -> Result<(), Self::Error>;
4271
4272    /// Get all app configs
4273    fn get_all_application_configs(
4274        &self,
4275        name: Option<String>,
4276        description: Option<String>,
4277        image_id: Option<uuid::Uuid>,
4278        limit: Option<i32>,
4279        offset: Option<i32>,
4280    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error>;
4281
4282    /// Get details of a particular app config.
4283    fn get_application_config(
4284        &self,
4285        config_id: String,
4286    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4287
4288    /// Get app config
4289    fn get_runtime_application_config(
4290        &self,
4291        expected_hash: &[u8; 32],
4292    ) -> Result<models::RuntimeAppConfig, Self::Error>;
4293
4294    /// Get details of a particular runtime app config.
4295    fn get_specific_runtime_application_config(
4296        &self,
4297        config_id: String,
4298    ) -> Result<models::RuntimeAppConfig, Self::Error>;
4299
4300    /// Update details of a particular app config.
4301    fn update_application_config(
4302        &self,
4303        config_id: String,
4304        body: models::UpdateApplicationConfigRequest,
4305    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4306}
4307
4308pub trait ApplicationConfigApiMut {
4309    type Error;
4310
4311    /// Add an app config.
4312    fn create_application_config(
4313        &mut self,
4314        body: models::ApplicationConfig,
4315    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4316
4317    /// Delete a particular app config
4318    fn delete_application_config(&mut self, config_id: String) -> Result<(), Self::Error>;
4319
4320    /// Get all app configs
4321    fn get_all_application_configs(
4322        &mut self,
4323        name: Option<String>,
4324        description: Option<String>,
4325        image_id: Option<uuid::Uuid>,
4326        limit: Option<i32>,
4327        offset: Option<i32>,
4328    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error>;
4329
4330    /// Get details of a particular app config.
4331    fn get_application_config(
4332        &mut self,
4333        config_id: String,
4334    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4335
4336    /// Get app config
4337    fn get_runtime_application_config(
4338        &mut self,
4339        expected_hash: &[u8; 32],
4340    ) -> Result<models::RuntimeAppConfig, Self::Error>;
4341
4342    /// Get details of a particular runtime app config.
4343    fn get_specific_runtime_application_config(
4344        &mut self,
4345        config_id: String,
4346    ) -> Result<models::RuntimeAppConfig, Self::Error>;
4347
4348    /// Update details of a particular app config.
4349    fn update_application_config(
4350        &mut self,
4351        config_id: String,
4352        body: models::UpdateApplicationConfigRequest,
4353    ) -> Result<models::ApplicationConfigResponse, Self::Error>;
4354}
4355
4356// This is mostly so that we don't have to convert all the malbork APIs to
4357// ApiMut at once.
4358impl<T, E> ApplicationConfigApiMut for T
4359where
4360    T: ApplicationConfigApi<Error = E>,
4361{
4362    type Error = E;
4363
4364    fn create_application_config(
4365        &mut self,
4366        body: models::ApplicationConfig,
4367    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
4368        <T as ApplicationConfigApi>::create_application_config(self, body)
4369    }
4370
4371    fn delete_application_config(&mut self, config_id: String) -> Result<(), Self::Error> {
4372        <T as ApplicationConfigApi>::delete_application_config(self, config_id)
4373    }
4374
4375    fn get_all_application_configs(
4376        &mut self,
4377        name: Option<String>,
4378        description: Option<String>,
4379        image_id: Option<uuid::Uuid>,
4380        limit: Option<i32>,
4381        offset: Option<i32>,
4382    ) -> Result<models::GetAllApplicationConfigsResponse, Self::Error> {
4383        <T as ApplicationConfigApi>::get_all_application_configs(
4384            self,
4385            name,
4386            description,
4387            image_id,
4388            limit,
4389            offset,
4390        )
4391    }
4392
4393    fn get_application_config(
4394        &mut self,
4395        config_id: String,
4396    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
4397        <T as ApplicationConfigApi>::get_application_config(self, config_id)
4398    }
4399
4400    fn get_runtime_application_config(
4401        &mut self,
4402        expected_hash: &[u8; 32],
4403    ) -> Result<models::RuntimeAppConfig, Self::Error> {
4404        <T as ApplicationConfigApi>::get_runtime_application_config(self, expected_hash)
4405    }
4406
4407    fn get_specific_runtime_application_config(
4408        &mut self,
4409        config_id: String,
4410    ) -> Result<models::RuntimeAppConfig, Self::Error> {
4411        <T as ApplicationConfigApi>::get_specific_runtime_application_config(self, config_id)
4412    }
4413
4414    fn update_application_config(
4415        &mut self,
4416        config_id: String,
4417        body: models::UpdateApplicationConfigRequest,
4418    ) -> Result<models::ApplicationConfigResponse, Self::Error> {
4419        <T as ApplicationConfigApi>::update_application_config(self, config_id, body)
4420    }
4421}
4422
4423pub trait ApprovalRequestsApi {
4424    type Error;
4425
4426    /// Approve a request.
4427    fn approve_approval_request(
4428        &self,
4429        request_id: uuid::Uuid,
4430        body: Option<models::ApproveRequest>,
4431    ) -> Result<models::ApprovalRequest, Self::Error>;
4432
4433    /// Create approval request.
4434    fn create_approval_request(
4435        &self,
4436        body: models::ApprovalRequestRequest,
4437    ) -> Result<models::ApprovalRequest, Self::Error>;
4438
4439    /// Delete an approval request.
4440    fn delete_approval_request(&self, request_id: uuid::Uuid) -> Result<(), Self::Error>;
4441
4442    /// Deny a request.
4443    fn deny_approval_request(
4444        &self,
4445        request_id: uuid::Uuid,
4446        body: Option<models::DenyRequest>,
4447    ) -> Result<models::ApprovalRequest, Self::Error>;
4448
4449    /// Get all approval requests
4450    fn get_all_approval_requests(
4451        &self,
4452        requester: Option<uuid::Uuid>,
4453        reviewer: Option<uuid::Uuid>,
4454        subject: Option<uuid::Uuid>,
4455        status: Option<String>,
4456        all_search: Option<String>,
4457        sort_by: Option<String>,
4458        limit: Option<i32>,
4459        offset: Option<i32>,
4460    ) -> Result<models::GetAllApprovalRequests, Self::Error>;
4461
4462    /// Get an approval request.
4463    fn get_approval_request(
4464        &self,
4465        request_id: uuid::Uuid,
4466    ) -> Result<models::ApprovalRequest, Self::Error>;
4467
4468    /// Get the result for an approved or failed request.
4469    fn get_approval_request_result(
4470        &self,
4471        request_id: uuid::Uuid,
4472    ) -> Result<models::ApprovableResult, Self::Error>;
4473}
4474
4475pub trait ApprovalRequestsApiMut {
4476    type Error;
4477
4478    /// Approve a request.
4479    fn approve_approval_request(
4480        &mut self,
4481        request_id: uuid::Uuid,
4482        body: Option<models::ApproveRequest>,
4483    ) -> Result<models::ApprovalRequest, Self::Error>;
4484
4485    /// Create approval request.
4486    fn create_approval_request(
4487        &mut self,
4488        body: models::ApprovalRequestRequest,
4489    ) -> Result<models::ApprovalRequest, Self::Error>;
4490
4491    /// Delete an approval request.
4492    fn delete_approval_request(&mut self, request_id: uuid::Uuid) -> Result<(), Self::Error>;
4493
4494    /// Deny a request.
4495    fn deny_approval_request(
4496        &mut self,
4497        request_id: uuid::Uuid,
4498        body: Option<models::DenyRequest>,
4499    ) -> Result<models::ApprovalRequest, Self::Error>;
4500
4501    /// Get all approval requests
4502    fn get_all_approval_requests(
4503        &mut self,
4504        requester: Option<uuid::Uuid>,
4505        reviewer: Option<uuid::Uuid>,
4506        subject: Option<uuid::Uuid>,
4507        status: Option<String>,
4508        all_search: Option<String>,
4509        sort_by: Option<String>,
4510        limit: Option<i32>,
4511        offset: Option<i32>,
4512    ) -> Result<models::GetAllApprovalRequests, Self::Error>;
4513
4514    /// Get an approval request.
4515    fn get_approval_request(
4516        &mut self,
4517        request_id: uuid::Uuid,
4518    ) -> Result<models::ApprovalRequest, Self::Error>;
4519
4520    /// Get the result for an approved or failed request.
4521    fn get_approval_request_result(
4522        &mut self,
4523        request_id: uuid::Uuid,
4524    ) -> Result<models::ApprovableResult, Self::Error>;
4525}
4526
4527// This is mostly so that we don't have to convert all the malbork APIs to
4528// ApiMut at once.
4529impl<T, E> ApprovalRequestsApiMut for T
4530where
4531    T: ApprovalRequestsApi<Error = E>,
4532{
4533    type Error = E;
4534
4535    fn approve_approval_request(
4536        &mut self,
4537        request_id: uuid::Uuid,
4538        body: Option<models::ApproveRequest>,
4539    ) -> Result<models::ApprovalRequest, Self::Error> {
4540        <T as ApprovalRequestsApi>::approve_approval_request(self, request_id, body)
4541    }
4542
4543    fn create_approval_request(
4544        &mut self,
4545        body: models::ApprovalRequestRequest,
4546    ) -> Result<models::ApprovalRequest, Self::Error> {
4547        <T as ApprovalRequestsApi>::create_approval_request(self, body)
4548    }
4549
4550    fn delete_approval_request(&mut self, request_id: uuid::Uuid) -> Result<(), Self::Error> {
4551        <T as ApprovalRequestsApi>::delete_approval_request(self, request_id)
4552    }
4553
4554    fn deny_approval_request(
4555        &mut self,
4556        request_id: uuid::Uuid,
4557        body: Option<models::DenyRequest>,
4558    ) -> Result<models::ApprovalRequest, Self::Error> {
4559        <T as ApprovalRequestsApi>::deny_approval_request(self, request_id, body)
4560    }
4561
4562    fn get_all_approval_requests(
4563        &mut self,
4564        requester: Option<uuid::Uuid>,
4565        reviewer: Option<uuid::Uuid>,
4566        subject: Option<uuid::Uuid>,
4567        status: Option<String>,
4568        all_search: Option<String>,
4569        sort_by: Option<String>,
4570        limit: Option<i32>,
4571        offset: Option<i32>,
4572    ) -> Result<models::GetAllApprovalRequests, Self::Error> {
4573        <T as ApprovalRequestsApi>::get_all_approval_requests(
4574            self, requester, reviewer, subject, status, all_search, sort_by, limit, offset,
4575        )
4576    }
4577
4578    fn get_approval_request(
4579        &mut self,
4580        request_id: uuid::Uuid,
4581    ) -> Result<models::ApprovalRequest, Self::Error> {
4582        <T as ApprovalRequestsApi>::get_approval_request(self, request_id)
4583    }
4584
4585    fn get_approval_request_result(
4586        &mut self,
4587        request_id: uuid::Uuid,
4588    ) -> Result<models::ApprovableResult, Self::Error> {
4589        <T as ApprovalRequestsApi>::get_approval_request_result(self, request_id)
4590    }
4591}
4592
4593pub trait AuthApi {
4594    type Error;
4595
4596    /// User authentication
4597    fn authenticate_user(
4598        &self,
4599        body: Option<models::AuthRequest>,
4600    ) -> Result<models::AuthResponse, Self::Error>;
4601}
4602
4603pub trait AuthApiMut {
4604    type Error;
4605
4606    /// User authentication
4607    fn authenticate_user(
4608        &mut self,
4609        body: Option<models::AuthRequest>,
4610    ) -> Result<models::AuthResponse, Self::Error>;
4611}
4612
4613// This is mostly so that we don't have to convert all the malbork APIs to
4614// ApiMut at once.
4615impl<T, E> AuthApiMut for T
4616where
4617    T: AuthApi<Error = E>,
4618{
4619    type Error = E;
4620
4621    fn authenticate_user(
4622        &mut self,
4623        body: Option<models::AuthRequest>,
4624    ) -> Result<models::AuthResponse, Self::Error> {
4625        <T as AuthApi>::authenticate_user(self, body)
4626    }
4627}
4628
4629pub trait BuildApi {
4630    type Error;
4631
4632    /// Convert a docker image and create a new image.
4633    fn convert_app_build(
4634        &self,
4635        body: models::ConvertAppBuildRequest,
4636    ) -> Result<models::Build, Self::Error>;
4637
4638    /// Create a new image.
4639    fn create_build(&self, body: models::CreateBuildRequest) -> Result<models::Build, Self::Error>;
4640
4641    /// Delete a particular image.
4642    fn delete_build(&self, build_id: uuid::Uuid) -> Result<(), Self::Error>;
4643
4644    /// Get all images information.
4645    fn get_all_builds(
4646        &self,
4647        all_search: Option<String>,
4648        docker_image_name: Option<String>,
4649        config_id: Option<String>,
4650        deployed_status: Option<String>,
4651        status: Option<String>,
4652        limit: Option<i32>,
4653        offset: Option<i32>,
4654        sort_by: Option<String>,
4655    ) -> Result<models::GetAllBuildsResponse, Self::Error>;
4656
4657    /// Get details of a particular image.
4658    fn get_build(&self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error>;
4659
4660    /// Get all deployments of an image.
4661    fn get_build_deployments(
4662        &self,
4663        build_id: uuid::Uuid,
4664        status: Option<String>,
4665        all_search: Option<String>,
4666        sort_by: Option<String>,
4667        limit: Option<i32>,
4668        offset: Option<i32>,
4669    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error>;
4670
4671    /// Update details of a particular image.
4672    fn update_build(
4673        &self,
4674        build_id: uuid::Uuid,
4675        body: models::BuildUpdateRequest,
4676    ) -> Result<models::Build, Self::Error>;
4677}
4678
4679pub trait BuildApiMut {
4680    type Error;
4681
4682    /// Convert a docker image and create a new image.
4683    fn convert_app_build(
4684        &mut self,
4685        body: models::ConvertAppBuildRequest,
4686    ) -> Result<models::Build, Self::Error>;
4687
4688    /// Create a new image.
4689    fn create_build(
4690        &mut self,
4691        body: models::CreateBuildRequest,
4692    ) -> Result<models::Build, Self::Error>;
4693
4694    /// Delete a particular image.
4695    fn delete_build(&mut self, build_id: uuid::Uuid) -> Result<(), Self::Error>;
4696
4697    /// Get all images information.
4698    fn get_all_builds(
4699        &mut self,
4700        all_search: Option<String>,
4701        docker_image_name: Option<String>,
4702        config_id: Option<String>,
4703        deployed_status: Option<String>,
4704        status: Option<String>,
4705        limit: Option<i32>,
4706        offset: Option<i32>,
4707        sort_by: Option<String>,
4708    ) -> Result<models::GetAllBuildsResponse, Self::Error>;
4709
4710    /// Get details of a particular image.
4711    fn get_build(&mut self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error>;
4712
4713    /// Get all deployments of an image.
4714    fn get_build_deployments(
4715        &mut self,
4716        build_id: uuid::Uuid,
4717        status: Option<String>,
4718        all_search: Option<String>,
4719        sort_by: Option<String>,
4720        limit: Option<i32>,
4721        offset: Option<i32>,
4722    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error>;
4723
4724    /// Update details of a particular image.
4725    fn update_build(
4726        &mut self,
4727        build_id: uuid::Uuid,
4728        body: models::BuildUpdateRequest,
4729    ) -> Result<models::Build, Self::Error>;
4730}
4731
4732// This is mostly so that we don't have to convert all the malbork APIs to
4733// ApiMut at once.
4734impl<T, E> BuildApiMut for T
4735where
4736    T: BuildApi<Error = E>,
4737{
4738    type Error = E;
4739
4740    fn convert_app_build(
4741        &mut self,
4742        body: models::ConvertAppBuildRequest,
4743    ) -> Result<models::Build, Self::Error> {
4744        <T as BuildApi>::convert_app_build(self, body)
4745    }
4746
4747    fn create_build(
4748        &mut self,
4749        body: models::CreateBuildRequest,
4750    ) -> Result<models::Build, Self::Error> {
4751        <T as BuildApi>::create_build(self, body)
4752    }
4753
4754    fn delete_build(&mut self, build_id: uuid::Uuid) -> Result<(), Self::Error> {
4755        <T as BuildApi>::delete_build(self, build_id)
4756    }
4757
4758    fn get_all_builds(
4759        &mut self,
4760        all_search: Option<String>,
4761        docker_image_name: Option<String>,
4762        config_id: Option<String>,
4763        deployed_status: Option<String>,
4764        status: Option<String>,
4765        limit: Option<i32>,
4766        offset: Option<i32>,
4767        sort_by: Option<String>,
4768    ) -> Result<models::GetAllBuildsResponse, Self::Error> {
4769        <T as BuildApi>::get_all_builds(
4770            self,
4771            all_search,
4772            docker_image_name,
4773            config_id,
4774            deployed_status,
4775            status,
4776            limit,
4777            offset,
4778            sort_by,
4779        )
4780    }
4781
4782    fn get_build(&mut self, build_id: uuid::Uuid) -> Result<models::Build, Self::Error> {
4783        <T as BuildApi>::get_build(self, build_id)
4784    }
4785
4786    fn get_build_deployments(
4787        &mut self,
4788        build_id: uuid::Uuid,
4789        status: Option<String>,
4790        all_search: Option<String>,
4791        sort_by: Option<String>,
4792        limit: Option<i32>,
4793        offset: Option<i32>,
4794    ) -> Result<models::GetAllBuildDeploymentsResponse, Self::Error> {
4795        <T as BuildApi>::get_build_deployments(
4796            self, build_id, status, all_search, sort_by, limit, offset,
4797        )
4798    }
4799
4800    fn update_build(
4801        &mut self,
4802        build_id: uuid::Uuid,
4803        body: models::BuildUpdateRequest,
4804    ) -> Result<models::Build, Self::Error> {
4805        <T as BuildApi>::update_build(self, build_id, body)
4806    }
4807}
4808
4809pub trait CertificateApi {
4810    type Error;
4811
4812    /// Retrieve a certificate.
4813    fn get_certificate(&self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error>;
4814
4815    /// Request a new certificate for an Enclave application
4816    fn new_certificate(
4817        &self,
4818        body: models::NewCertificateRequest,
4819    ) -> Result<models::TaskResult, Self::Error>;
4820}
4821
4822pub trait CertificateApiMut {
4823    type Error;
4824
4825    /// Retrieve a certificate.
4826    fn get_certificate(&mut self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error>;
4827
4828    /// Request a new certificate for an Enclave application
4829    fn new_certificate(
4830        &mut self,
4831        body: models::NewCertificateRequest,
4832    ) -> Result<models::TaskResult, Self::Error>;
4833}
4834
4835// This is mostly so that we don't have to convert all the malbork APIs to
4836// ApiMut at once.
4837impl<T, E> CertificateApiMut for T
4838where
4839    T: CertificateApi<Error = E>,
4840{
4841    type Error = E;
4842
4843    fn get_certificate(&mut self, cert_id: uuid::Uuid) -> Result<models::Certificate, Self::Error> {
4844        <T as CertificateApi>::get_certificate(self, cert_id)
4845    }
4846
4847    fn new_certificate(
4848        &mut self,
4849        body: models::NewCertificateRequest,
4850    ) -> Result<models::TaskResult, Self::Error> {
4851        <T as CertificateApi>::new_certificate(self, body)
4852    }
4853}
4854
4855pub trait DatasetApi {
4856    type Error;
4857
4858    fn create_dataset(
4859        &self,
4860        body: models::CreateDatasetRequest,
4861    ) -> Result<models::Dataset, Self::Error>;
4862
4863    fn delete_dataset(&self, dataset_id: uuid::Uuid) -> Result<(), Self::Error>;
4864
4865    /// Get all datasets
4866    fn get_all_datasets(
4867        &self,
4868        name: Option<String>,
4869        description: Option<String>,
4870        limit: Option<i32>,
4871        offset: Option<i32>,
4872    ) -> Result<models::GetAllDatasetsResponse, Self::Error>;
4873
4874    fn get_dataset(&self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error>;
4875
4876    fn update_dataset(
4877        &self,
4878        dataset_id: uuid::Uuid,
4879        body: models::DatasetUpdateRequest,
4880    ) -> Result<models::Dataset, Self::Error>;
4881}
4882
4883pub trait DatasetApiMut {
4884    type Error;
4885
4886    fn create_dataset(
4887        &mut self,
4888        body: models::CreateDatasetRequest,
4889    ) -> Result<models::Dataset, Self::Error>;
4890
4891    fn delete_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<(), Self::Error>;
4892
4893    /// Get all datasets
4894    fn get_all_datasets(
4895        &mut self,
4896        name: Option<String>,
4897        description: Option<String>,
4898        limit: Option<i32>,
4899        offset: Option<i32>,
4900    ) -> Result<models::GetAllDatasetsResponse, Self::Error>;
4901
4902    fn get_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error>;
4903
4904    fn update_dataset(
4905        &mut self,
4906        dataset_id: uuid::Uuid,
4907        body: models::DatasetUpdateRequest,
4908    ) -> Result<models::Dataset, Self::Error>;
4909}
4910
4911// This is mostly so that we don't have to convert all the malbork APIs to
4912// ApiMut at once.
4913impl<T, E> DatasetApiMut for T
4914where
4915    T: DatasetApi<Error = E>,
4916{
4917    type Error = E;
4918
4919    fn create_dataset(
4920        &mut self,
4921        body: models::CreateDatasetRequest,
4922    ) -> Result<models::Dataset, Self::Error> {
4923        <T as DatasetApi>::create_dataset(self, body)
4924    }
4925
4926    fn delete_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<(), Self::Error> {
4927        <T as DatasetApi>::delete_dataset(self, dataset_id)
4928    }
4929
4930    fn get_all_datasets(
4931        &mut self,
4932        name: Option<String>,
4933        description: Option<String>,
4934        limit: Option<i32>,
4935        offset: Option<i32>,
4936    ) -> Result<models::GetAllDatasetsResponse, Self::Error> {
4937        <T as DatasetApi>::get_all_datasets(self, name, description, limit, offset)
4938    }
4939
4940    fn get_dataset(&mut self, dataset_id: uuid::Uuid) -> Result<models::Dataset, Self::Error> {
4941        <T as DatasetApi>::get_dataset(self, dataset_id)
4942    }
4943
4944    fn update_dataset(
4945        &mut self,
4946        dataset_id: uuid::Uuid,
4947        body: models::DatasetUpdateRequest,
4948    ) -> Result<models::Dataset, Self::Error> {
4949        <T as DatasetApi>::update_dataset(self, dataset_id, body)
4950    }
4951}
4952
4953pub trait NodeApi {
4954    type Error;
4955
4956    /// Deactivate a particular compute node.
4957    fn deactivate_node(&self, node_id: uuid::Uuid) -> Result<(), Self::Error>;
4958
4959    /// Get all compute nodes information.
4960    fn get_all_nodes(
4961        &self,
4962        name: Option<String>,
4963        description: Option<String>,
4964        sgx_version: Option<String>,
4965        all_search: Option<String>,
4966        status: Option<String>,
4967        limit: Option<i32>,
4968        offset: Option<i32>,
4969        sort_by: Option<String>,
4970    ) -> Result<models::GetAllNodesResponse, Self::Error>;
4971
4972    /// Get details of a particular compute node.
4973    fn get_node(&self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error>;
4974
4975    /// Get an attested compute node's certificate.
4976    fn get_node_certificate(&self, node_id: uuid::Uuid)
4977        -> Result<models::Certificate, Self::Error>;
4978
4979    /// Get a compute node's certificate.
4980    fn get_node_certificate_details(
4981        &self,
4982        node_id: uuid::Uuid,
4983    ) -> Result<models::CertificateDetails, Self::Error>;
4984
4985    /// Get all the unique labels across all the nodes within selected account
4986    fn get_nodes_unique_labels(&self) -> Result<models::LabelsCount, Self::Error>;
4987
4988    /// Provision a new compute node.
4989    fn provision_node(
4990        &self,
4991        body: models::NodeProvisionRequest,
4992    ) -> Result<models::TaskResult, Self::Error>;
4993
4994    /// Update details of a particular compute node.
4995    fn update_node(
4996        &self,
4997        node_id: uuid::Uuid,
4998        body: models::NodeUpdateRequest,
4999    ) -> Result<models::Node, Self::Error>;
5000
5001    /// Called periodically by a compute node.
5002    fn update_node_status(
5003        &self,
5004        body: models::NodeStatusRequest,
5005    ) -> Result<models::NodeStatusResponse, Self::Error>;
5006}
5007
5008pub trait NodeApiMut {
5009    type Error;
5010
5011    /// Deactivate a particular compute node.
5012    fn deactivate_node(&mut self, node_id: uuid::Uuid) -> Result<(), Self::Error>;
5013
5014    /// Get all compute nodes information.
5015    fn get_all_nodes(
5016        &mut self,
5017        name: Option<String>,
5018        description: Option<String>,
5019        sgx_version: Option<String>,
5020        all_search: Option<String>,
5021        status: Option<String>,
5022        limit: Option<i32>,
5023        offset: Option<i32>,
5024        sort_by: Option<String>,
5025    ) -> Result<models::GetAllNodesResponse, Self::Error>;
5026
5027    /// Get details of a particular compute node.
5028    fn get_node(&mut self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error>;
5029
5030    /// Get an attested compute node's certificate.
5031    fn get_node_certificate(
5032        &mut self,
5033        node_id: uuid::Uuid,
5034    ) -> Result<models::Certificate, Self::Error>;
5035
5036    /// Get a compute node's certificate.
5037    fn get_node_certificate_details(
5038        &mut self,
5039        node_id: uuid::Uuid,
5040    ) -> Result<models::CertificateDetails, Self::Error>;
5041
5042    /// Get all the unique labels across all the nodes within selected account
5043    fn get_nodes_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error>;
5044
5045    /// Provision a new compute node.
5046    fn provision_node(
5047        &mut self,
5048        body: models::NodeProvisionRequest,
5049    ) -> Result<models::TaskResult, Self::Error>;
5050
5051    /// Update details of a particular compute node.
5052    fn update_node(
5053        &mut self,
5054        node_id: uuid::Uuid,
5055        body: models::NodeUpdateRequest,
5056    ) -> Result<models::Node, Self::Error>;
5057
5058    /// Called periodically by a compute node.
5059    fn update_node_status(
5060        &mut self,
5061        body: models::NodeStatusRequest,
5062    ) -> Result<models::NodeStatusResponse, Self::Error>;
5063}
5064
5065// This is mostly so that we don't have to convert all the malbork APIs to
5066// ApiMut at once.
5067impl<T, E> NodeApiMut for T
5068where
5069    T: NodeApi<Error = E>,
5070{
5071    type Error = E;
5072
5073    fn deactivate_node(&mut self, node_id: uuid::Uuid) -> Result<(), Self::Error> {
5074        <T as NodeApi>::deactivate_node(self, node_id)
5075    }
5076
5077    fn get_all_nodes(
5078        &mut self,
5079        name: Option<String>,
5080        description: Option<String>,
5081        sgx_version: Option<String>,
5082        all_search: Option<String>,
5083        status: Option<String>,
5084        limit: Option<i32>,
5085        offset: Option<i32>,
5086        sort_by: Option<String>,
5087    ) -> Result<models::GetAllNodesResponse, Self::Error> {
5088        <T as NodeApi>::get_all_nodes(
5089            self,
5090            name,
5091            description,
5092            sgx_version,
5093            all_search,
5094            status,
5095            limit,
5096            offset,
5097            sort_by,
5098        )
5099    }
5100
5101    fn get_node(&mut self, node_id: uuid::Uuid) -> Result<models::Node, Self::Error> {
5102        <T as NodeApi>::get_node(self, node_id)
5103    }
5104
5105    fn get_node_certificate(
5106        &mut self,
5107        node_id: uuid::Uuid,
5108    ) -> Result<models::Certificate, Self::Error> {
5109        <T as NodeApi>::get_node_certificate(self, node_id)
5110    }
5111
5112    fn get_node_certificate_details(
5113        &mut self,
5114        node_id: uuid::Uuid,
5115    ) -> Result<models::CertificateDetails, Self::Error> {
5116        <T as NodeApi>::get_node_certificate_details(self, node_id)
5117    }
5118
5119    fn get_nodes_unique_labels(&mut self) -> Result<models::LabelsCount, Self::Error> {
5120        <T as NodeApi>::get_nodes_unique_labels(self)
5121    }
5122
5123    fn provision_node(
5124        &mut self,
5125        body: models::NodeProvisionRequest,
5126    ) -> Result<models::TaskResult, Self::Error> {
5127        <T as NodeApi>::provision_node(self, body)
5128    }
5129
5130    fn update_node(
5131        &mut self,
5132        node_id: uuid::Uuid,
5133        body: models::NodeUpdateRequest,
5134    ) -> Result<models::Node, Self::Error> {
5135        <T as NodeApi>::update_node(self, node_id, body)
5136    }
5137
5138    fn update_node_status(
5139        &mut self,
5140        body: models::NodeStatusRequest,
5141    ) -> Result<models::NodeStatusResponse, Self::Error> {
5142        <T as NodeApi>::update_node_status(self, body)
5143    }
5144}
5145
5146pub trait RegistryApi {
5147    type Error;
5148
5149    /// Add a new registry to an account
5150    fn create_registry(
5151        &self,
5152        registry_request: models::RegistryRequest,
5153    ) -> Result<models::Registry, Self::Error>;
5154
5155    /// Delete registry
5156    fn delete_registry(&self, registry_id: uuid::Uuid) -> Result<(), Self::Error>;
5157
5158    /// Get details of all registry in the account
5159    fn get_all_registries(&self) -> Result<Vec<models::Registry>, Self::Error>;
5160
5161    /// Get details of a particular registry
5162    fn get_registry(&self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error>;
5163
5164    /// Get details of the registry that will be used for the particular app images
5165    fn get_registry_for_app(
5166        &self,
5167        app_id: uuid::Uuid,
5168    ) -> Result<models::AppRegistryResponse, Self::Error>;
5169
5170    /// Get details of the registry that will be used for the particular image
5171    fn get_registry_for_image(
5172        &self,
5173        image_name: String,
5174    ) -> Result<models::ImageRegistryResponse, Self::Error>;
5175
5176    /// Update a particular registry details
5177    fn update_registry(
5178        &self,
5179        registry_id: uuid::Uuid,
5180        body: models::UpdateRegistryRequest,
5181    ) -> Result<models::Registry, Self::Error>;
5182}
5183
5184pub trait RegistryApiMut {
5185    type Error;
5186
5187    /// Add a new registry to an account
5188    fn create_registry(
5189        &mut self,
5190        registry_request: models::RegistryRequest,
5191    ) -> Result<models::Registry, Self::Error>;
5192
5193    /// Delete registry
5194    fn delete_registry(&mut self, registry_id: uuid::Uuid) -> Result<(), Self::Error>;
5195
5196    /// Get details of all registry in the account
5197    fn get_all_registries(&mut self) -> Result<Vec<models::Registry>, Self::Error>;
5198
5199    /// Get details of a particular registry
5200    fn get_registry(&mut self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error>;
5201
5202    /// Get details of the registry that will be used for the particular app images
5203    fn get_registry_for_app(
5204        &mut self,
5205        app_id: uuid::Uuid,
5206    ) -> Result<models::AppRegistryResponse, Self::Error>;
5207
5208    /// Get details of the registry that will be used for the particular image
5209    fn get_registry_for_image(
5210        &mut self,
5211        image_name: String,
5212    ) -> Result<models::ImageRegistryResponse, Self::Error>;
5213
5214    /// Update a particular registry details
5215    fn update_registry(
5216        &mut self,
5217        registry_id: uuid::Uuid,
5218        body: models::UpdateRegistryRequest,
5219    ) -> Result<models::Registry, Self::Error>;
5220}
5221
5222// This is mostly so that we don't have to convert all the malbork APIs to
5223// ApiMut at once.
5224impl<T, E> RegistryApiMut for T
5225where
5226    T: RegistryApi<Error = E>,
5227{
5228    type Error = E;
5229
5230    fn create_registry(
5231        &mut self,
5232        registry_request: models::RegistryRequest,
5233    ) -> Result<models::Registry, Self::Error> {
5234        <T as RegistryApi>::create_registry(self, registry_request)
5235    }
5236
5237    fn delete_registry(&mut self, registry_id: uuid::Uuid) -> Result<(), Self::Error> {
5238        <T as RegistryApi>::delete_registry(self, registry_id)
5239    }
5240
5241    fn get_all_registries(&mut self) -> Result<Vec<models::Registry>, Self::Error> {
5242        <T as RegistryApi>::get_all_registries(self)
5243    }
5244
5245    fn get_registry(&mut self, registry_id: uuid::Uuid) -> Result<models::Registry, Self::Error> {
5246        <T as RegistryApi>::get_registry(self, registry_id)
5247    }
5248
5249    fn get_registry_for_app(
5250        &mut self,
5251        app_id: uuid::Uuid,
5252    ) -> Result<models::AppRegistryResponse, Self::Error> {
5253        <T as RegistryApi>::get_registry_for_app(self, app_id)
5254    }
5255
5256    fn get_registry_for_image(
5257        &mut self,
5258        image_name: String,
5259    ) -> Result<models::ImageRegistryResponse, Self::Error> {
5260        <T as RegistryApi>::get_registry_for_image(self, image_name)
5261    }
5262
5263    fn update_registry(
5264        &mut self,
5265        registry_id: uuid::Uuid,
5266        body: models::UpdateRegistryRequest,
5267    ) -> Result<models::Registry, Self::Error> {
5268        <T as RegistryApi>::update_registry(self, registry_id, body)
5269    }
5270}
5271
5272pub trait SystemApi {
5273    type Error;
5274
5275    /// Get Manager Version.
5276    fn get_manager_version(&self) -> Result<models::VersionResponse, Self::Error>;
5277}
5278
5279pub trait SystemApiMut {
5280    type Error;
5281
5282    /// Get Manager Version.
5283    fn get_manager_version(&mut self) -> Result<models::VersionResponse, Self::Error>;
5284}
5285
5286// This is mostly so that we don't have to convert all the malbork APIs to
5287// ApiMut at once.
5288impl<T, E> SystemApiMut for T
5289where
5290    T: SystemApi<Error = E>,
5291{
5292    type Error = E;
5293
5294    fn get_manager_version(&mut self) -> Result<models::VersionResponse, Self::Error> {
5295        <T as SystemApi>::get_manager_version(self)
5296    }
5297}
5298
5299pub trait TaskApi {
5300    type Error;
5301
5302    /// Get all the tasks.
5303    fn get_all_tasks(
5304        &self,
5305        task_type: Option<String>,
5306        status: Option<String>,
5307        requester: Option<String>,
5308        approver: Option<String>,
5309        all_search: Option<String>,
5310        limit: Option<i32>,
5311        offset: Option<i32>,
5312        sort_by: Option<String>,
5313        base_filters: Option<String>,
5314    ) -> Result<models::GetAllTasksResponse, Self::Error>;
5315
5316    /// Get details of a particular task.
5317    fn get_task(&self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error>;
5318
5319    /// Get status and result of a particular task.
5320    fn get_task_status(&self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error>;
5321
5322    /// Update status of approver and task.
5323    fn update_task(
5324        &self,
5325        task_id: uuid::Uuid,
5326        body: models::TaskUpdateRequest,
5327    ) -> Result<models::TaskResult, Self::Error>;
5328}
5329
5330pub trait TaskApiMut {
5331    type Error;
5332
5333    /// Get all the tasks.
5334    fn get_all_tasks(
5335        &mut self,
5336        task_type: Option<String>,
5337        status: Option<String>,
5338        requester: Option<String>,
5339        approver: Option<String>,
5340        all_search: Option<String>,
5341        limit: Option<i32>,
5342        offset: Option<i32>,
5343        sort_by: Option<String>,
5344        base_filters: Option<String>,
5345    ) -> Result<models::GetAllTasksResponse, Self::Error>;
5346
5347    /// Get details of a particular task.
5348    fn get_task(&mut self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error>;
5349
5350    /// Get status and result of a particular task.
5351    fn get_task_status(&mut self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error>;
5352
5353    /// Update status of approver and task.
5354    fn update_task(
5355        &mut self,
5356        task_id: uuid::Uuid,
5357        body: models::TaskUpdateRequest,
5358    ) -> Result<models::TaskResult, Self::Error>;
5359}
5360
5361// This is mostly so that we don't have to convert all the malbork APIs to
5362// ApiMut at once.
5363impl<T, E> TaskApiMut for T
5364where
5365    T: TaskApi<Error = E>,
5366{
5367    type Error = E;
5368
5369    fn get_all_tasks(
5370        &mut self,
5371        task_type: Option<String>,
5372        status: Option<String>,
5373        requester: Option<String>,
5374        approver: Option<String>,
5375        all_search: Option<String>,
5376        limit: Option<i32>,
5377        offset: Option<i32>,
5378        sort_by: Option<String>,
5379        base_filters: Option<String>,
5380    ) -> Result<models::GetAllTasksResponse, Self::Error> {
5381        <T as TaskApi>::get_all_tasks(
5382            self,
5383            task_type,
5384            status,
5385            requester,
5386            approver,
5387            all_search,
5388            limit,
5389            offset,
5390            sort_by,
5391            base_filters,
5392        )
5393    }
5394
5395    fn get_task(&mut self, task_id: uuid::Uuid) -> Result<models::Task, Self::Error> {
5396        <T as TaskApi>::get_task(self, task_id)
5397    }
5398
5399    fn get_task_status(&mut self, task_id: uuid::Uuid) -> Result<models::TaskResult, Self::Error> {
5400        <T as TaskApi>::get_task_status(self, task_id)
5401    }
5402
5403    fn update_task(
5404        &mut self,
5405        task_id: uuid::Uuid,
5406        body: models::TaskUpdateRequest,
5407    ) -> Result<models::TaskResult, Self::Error> {
5408        <T as TaskApi>::update_task(self, task_id, body)
5409    }
5410}
5411
5412pub trait ToolsApi {
5413    type Error;
5414
5415    /// Convert an application to run in EnclaveOS.
5416    fn convert_app(
5417        &self,
5418        body: models::ConversionRequest,
5419    ) -> Result<models::ConversionResponse, Self::Error>;
5420}
5421
5422pub trait ToolsApiMut {
5423    type Error;
5424
5425    /// Convert an application to run in EnclaveOS.
5426    fn convert_app(
5427        &mut self,
5428        body: models::ConversionRequest,
5429    ) -> Result<models::ConversionResponse, Self::Error>;
5430}
5431
5432// This is mostly so that we don't have to convert all the malbork APIs to
5433// ApiMut at once.
5434impl<T, E> ToolsApiMut for T
5435where
5436    T: ToolsApi<Error = E>,
5437{
5438    type Error = E;
5439
5440    fn convert_app(
5441        &mut self,
5442        body: models::ConversionRequest,
5443    ) -> Result<models::ConversionResponse, Self::Error> {
5444        <T as ToolsApi>::convert_app(self, body)
5445    }
5446}
5447
5448pub trait UsersApi {
5449    type Error;
5450
5451    /// Current user accepts latest terms and conditions.
5452    fn accept_terms_and_conditions(&self) -> Result<(), Self::Error>;
5453
5454    /// Change user password.
5455    fn change_password(&self, body: models::PasswordChangeRequest) -> Result<(), Self::Error>;
5456
5457    /// Confirms user's email address.
5458    fn confirm_email(
5459        &self,
5460        body: models::ConfirmEmailRequest,
5461    ) -> Result<models::ConfirmEmailResponse, Self::Error>;
5462
5463    /// Create a new user.
5464    fn create_user(&self, body: models::SignupRequest) -> Result<models::User, Self::Error>;
5465
5466    /// Completely delete a user profile from system
5467    fn delete_user_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5468
5469    /// Removed user's association with an account.
5470    fn delete_user_from_account(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5471
5472    /// Initiate password reset sequence for a user.
5473    fn forgot_password(&self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error>;
5474
5475    /// Get all user's information.
5476    fn get_all_users(
5477        &self,
5478        all_search: Option<String>,
5479        limit: Option<i32>,
5480        offset: Option<i32>,
5481        sort_by: Option<String>,
5482    ) -> Result<models::GetAllUsersResponse, Self::Error>;
5483
5484    /// Get details of the current logged in user.
5485    fn get_logged_in_user(&self) -> Result<models::User, Self::Error>;
5486
5487    /// Get details of a particular user.
5488    fn get_user(&self, user_id: uuid::Uuid) -> Result<models::User, Self::Error>;
5489
5490    /// Invite a user.
5491    fn invite_user(&self, body: models::InviteUserRequest) -> Result<models::User, Self::Error>;
5492
5493    /// Process a user's pending account invitations.
5494    fn process_invitations(&self, body: models::ProcessInviteRequest) -> Result<(), Self::Error>;
5495
5496    /// Resend email with link to confirm user's email address.
5497    fn resend_confirm_email(&self) -> Result<(), Self::Error>;
5498
5499    /// Resend invite to the user to join a specific account.
5500    fn resend_invitation(&self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5501
5502    /// Reset a user's password.
5503    fn reset_password(
5504        &self,
5505        user_id: uuid::Uuid,
5506        body: models::PasswordResetRequest,
5507    ) -> Result<(), Self::Error>;
5508
5509    /// Update status, name, and the role of a user. User with MANAGER access role can only update another user.
5510    fn update_user(
5511        &self,
5512        user_id: uuid::Uuid,
5513        body: models::UpdateUserRequest,
5514    ) -> Result<models::User, Self::Error>;
5515
5516    /// Validates password reset token for the user.
5517    fn validate_password_reset_token(
5518        &self,
5519        user_id: uuid::Uuid,
5520        body: models::ValidateTokenRequest,
5521    ) -> Result<models::ValidateTokenResponse, Self::Error>;
5522}
5523
5524pub trait UsersApiMut {
5525    type Error;
5526
5527    /// Current user accepts latest terms and conditions.
5528    fn accept_terms_and_conditions(&mut self) -> Result<(), Self::Error>;
5529
5530    /// Change user password.
5531    fn change_password(&mut self, body: models::PasswordChangeRequest) -> Result<(), Self::Error>;
5532
5533    /// Confirms user's email address.
5534    fn confirm_email(
5535        &mut self,
5536        body: models::ConfirmEmailRequest,
5537    ) -> Result<models::ConfirmEmailResponse, Self::Error>;
5538
5539    /// Create a new user.
5540    fn create_user(&mut self, body: models::SignupRequest) -> Result<models::User, Self::Error>;
5541
5542    /// Completely delete a user profile from system
5543    fn delete_user_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5544
5545    /// Removed user's association with an account.
5546    fn delete_user_from_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5547
5548    /// Initiate password reset sequence for a user.
5549    fn forgot_password(&mut self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error>;
5550
5551    /// Get all user's information.
5552    fn get_all_users(
5553        &mut self,
5554        all_search: Option<String>,
5555        limit: Option<i32>,
5556        offset: Option<i32>,
5557        sort_by: Option<String>,
5558    ) -> Result<models::GetAllUsersResponse, Self::Error>;
5559
5560    /// Get details of the current logged in user.
5561    fn get_logged_in_user(&mut self) -> Result<models::User, Self::Error>;
5562
5563    /// Get details of a particular user.
5564    fn get_user(&mut self, user_id: uuid::Uuid) -> Result<models::User, Self::Error>;
5565
5566    /// Invite a user.
5567    fn invite_user(&mut self, body: models::InviteUserRequest)
5568        -> Result<models::User, Self::Error>;
5569
5570    /// Process a user's pending account invitations.
5571    fn process_invitations(
5572        &mut self,
5573        body: models::ProcessInviteRequest,
5574    ) -> Result<(), Self::Error>;
5575
5576    /// Resend email with link to confirm user's email address.
5577    fn resend_confirm_email(&mut self) -> Result<(), Self::Error>;
5578
5579    /// Resend invite to the user to join a specific account.
5580    fn resend_invitation(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error>;
5581
5582    /// Reset a user's password.
5583    fn reset_password(
5584        &mut self,
5585        user_id: uuid::Uuid,
5586        body: models::PasswordResetRequest,
5587    ) -> Result<(), Self::Error>;
5588
5589    /// Update status, name, and the role of a user. User with MANAGER access role can only update another user.
5590    fn update_user(
5591        &mut self,
5592        user_id: uuid::Uuid,
5593        body: models::UpdateUserRequest,
5594    ) -> Result<models::User, Self::Error>;
5595
5596    /// Validates password reset token for the user.
5597    fn validate_password_reset_token(
5598        &mut self,
5599        user_id: uuid::Uuid,
5600        body: models::ValidateTokenRequest,
5601    ) -> Result<models::ValidateTokenResponse, Self::Error>;
5602}
5603
5604// This is mostly so that we don't have to convert all the malbork APIs to
5605// ApiMut at once.
5606impl<T, E> UsersApiMut for T
5607where
5608    T: UsersApi<Error = E>,
5609{
5610    type Error = E;
5611
5612    fn accept_terms_and_conditions(&mut self) -> Result<(), Self::Error> {
5613        <T as UsersApi>::accept_terms_and_conditions(self)
5614    }
5615
5616    fn change_password(&mut self, body: models::PasswordChangeRequest) -> Result<(), Self::Error> {
5617        <T as UsersApi>::change_password(self, body)
5618    }
5619
5620    fn confirm_email(
5621        &mut self,
5622        body: models::ConfirmEmailRequest,
5623    ) -> Result<models::ConfirmEmailResponse, Self::Error> {
5624        <T as UsersApi>::confirm_email(self, body)
5625    }
5626
5627    fn create_user(&mut self, body: models::SignupRequest) -> Result<models::User, Self::Error> {
5628        <T as UsersApi>::create_user(self, body)
5629    }
5630
5631    fn delete_user_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
5632        <T as UsersApi>::delete_user_account(self, user_id)
5633    }
5634
5635    fn delete_user_from_account(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
5636        <T as UsersApi>::delete_user_from_account(self, user_id)
5637    }
5638
5639    fn forgot_password(&mut self, body: models::ForgotPasswordRequest) -> Result<(), Self::Error> {
5640        <T as UsersApi>::forgot_password(self, body)
5641    }
5642
5643    fn get_all_users(
5644        &mut self,
5645        all_search: Option<String>,
5646        limit: Option<i32>,
5647        offset: Option<i32>,
5648        sort_by: Option<String>,
5649    ) -> Result<models::GetAllUsersResponse, Self::Error> {
5650        <T as UsersApi>::get_all_users(self, all_search, limit, offset, sort_by)
5651    }
5652
5653    fn get_logged_in_user(&mut self) -> Result<models::User, Self::Error> {
5654        <T as UsersApi>::get_logged_in_user(self)
5655    }
5656
5657    fn get_user(&mut self, user_id: uuid::Uuid) -> Result<models::User, Self::Error> {
5658        <T as UsersApi>::get_user(self, user_id)
5659    }
5660
5661    fn invite_user(
5662        &mut self,
5663        body: models::InviteUserRequest,
5664    ) -> Result<models::User, Self::Error> {
5665        <T as UsersApi>::invite_user(self, body)
5666    }
5667
5668    fn process_invitations(
5669        &mut self,
5670        body: models::ProcessInviteRequest,
5671    ) -> Result<(), Self::Error> {
5672        <T as UsersApi>::process_invitations(self, body)
5673    }
5674
5675    fn resend_confirm_email(&mut self) -> Result<(), Self::Error> {
5676        <T as UsersApi>::resend_confirm_email(self)
5677    }
5678
5679    fn resend_invitation(&mut self, user_id: uuid::Uuid) -> Result<(), Self::Error> {
5680        <T as UsersApi>::resend_invitation(self, user_id)
5681    }
5682
5683    fn reset_password(
5684        &mut self,
5685        user_id: uuid::Uuid,
5686        body: models::PasswordResetRequest,
5687    ) -> Result<(), Self::Error> {
5688        <T as UsersApi>::reset_password(self, user_id, body)
5689    }
5690
5691    fn update_user(
5692        &mut self,
5693        user_id: uuid::Uuid,
5694        body: models::UpdateUserRequest,
5695    ) -> Result<models::User, Self::Error> {
5696        <T as UsersApi>::update_user(self, user_id, body)
5697    }
5698
5699    fn validate_password_reset_token(
5700        &mut self,
5701        user_id: uuid::Uuid,
5702        body: models::ValidateTokenRequest,
5703    ) -> Result<models::ValidateTokenResponse, Self::Error> {
5704        <T as UsersApi>::validate_password_reset_token(self, user_id, body)
5705    }
5706}
5707
5708pub trait WorkflowApi {
5709    type Error;
5710
5711    fn create_workflow_graph(
5712        &self,
5713        body: models::CreateWorkflowGraph,
5714    ) -> Result<models::WorkflowGraph, Self::Error>;
5715
5716    /// Delete a particular draft workflow
5717    fn delete_workflow_graph(&self, graph_id: uuid::Uuid) -> Result<(), Self::Error>;
5718
5719    fn get_all_workflow_graphs(
5720        &self,
5721        name: Option<String>,
5722        description: Option<String>,
5723        all_search: Option<String>,
5724        parent_graph_id: Option<String>,
5725        sort_by: Option<String>,
5726        limit: Option<i32>,
5727        offset: Option<i32>,
5728    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error>;
5729
5730    /// Get details of a particular draft workflow
5731    fn get_workflow_graph(
5732        &self,
5733        graph_id: uuid::Uuid,
5734    ) -> Result<models::WorkflowGraph, Self::Error>;
5735
5736    fn update_workflow_graph(
5737        &self,
5738        graph_id: uuid::Uuid,
5739        body: models::UpdateWorkflowGraph,
5740    ) -> Result<models::WorkflowGraph, Self::Error>;
5741}
5742
5743pub trait WorkflowApiMut {
5744    type Error;
5745
5746    fn create_workflow_graph(
5747        &mut self,
5748        body: models::CreateWorkflowGraph,
5749    ) -> Result<models::WorkflowGraph, Self::Error>;
5750
5751    /// Delete a particular draft workflow
5752    fn delete_workflow_graph(&mut self, graph_id: uuid::Uuid) -> Result<(), Self::Error>;
5753
5754    fn get_all_workflow_graphs(
5755        &mut self,
5756        name: Option<String>,
5757        description: Option<String>,
5758        all_search: Option<String>,
5759        parent_graph_id: Option<String>,
5760        sort_by: Option<String>,
5761        limit: Option<i32>,
5762        offset: Option<i32>,
5763    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error>;
5764
5765    /// Get details of a particular draft workflow
5766    fn get_workflow_graph(
5767        &mut self,
5768        graph_id: uuid::Uuid,
5769    ) -> Result<models::WorkflowGraph, Self::Error>;
5770
5771    fn update_workflow_graph(
5772        &mut self,
5773        graph_id: uuid::Uuid,
5774        body: models::UpdateWorkflowGraph,
5775    ) -> Result<models::WorkflowGraph, Self::Error>;
5776}
5777
5778// This is mostly so that we don't have to convert all the malbork APIs to
5779// ApiMut at once.
5780impl<T, E> WorkflowApiMut for T
5781where
5782    T: WorkflowApi<Error = E>,
5783{
5784    type Error = E;
5785
5786    fn create_workflow_graph(
5787        &mut self,
5788        body: models::CreateWorkflowGraph,
5789    ) -> Result<models::WorkflowGraph, Self::Error> {
5790        <T as WorkflowApi>::create_workflow_graph(self, body)
5791    }
5792
5793    fn delete_workflow_graph(&mut self, graph_id: uuid::Uuid) -> Result<(), Self::Error> {
5794        <T as WorkflowApi>::delete_workflow_graph(self, graph_id)
5795    }
5796
5797    fn get_all_workflow_graphs(
5798        &mut self,
5799        name: Option<String>,
5800        description: Option<String>,
5801        all_search: Option<String>,
5802        parent_graph_id: Option<String>,
5803        sort_by: Option<String>,
5804        limit: Option<i32>,
5805        offset: Option<i32>,
5806    ) -> Result<models::GetAllWorkflowGraphsResponse, Self::Error> {
5807        <T as WorkflowApi>::get_all_workflow_graphs(
5808            self,
5809            name,
5810            description,
5811            all_search,
5812            parent_graph_id,
5813            sort_by,
5814            limit,
5815            offset,
5816        )
5817    }
5818
5819    fn get_workflow_graph(
5820        &mut self,
5821        graph_id: uuid::Uuid,
5822    ) -> Result<models::WorkflowGraph, Self::Error> {
5823        <T as WorkflowApi>::get_workflow_graph(self, graph_id)
5824    }
5825
5826    fn update_workflow_graph(
5827        &mut self,
5828        graph_id: uuid::Uuid,
5829        body: models::UpdateWorkflowGraph,
5830    ) -> Result<models::WorkflowGraph, Self::Error> {
5831        <T as WorkflowApi>::update_workflow_graph(self, graph_id, body)
5832    }
5833}
5834
5835pub trait WorkflowFinalApi {
5836    type Error;
5837
5838    fn create_final_workflow_graph(
5839        &self,
5840        body: models::CreateFinalWorkflowGraph,
5841    ) -> Result<models::FinalWorkflow, Self::Error>;
5842
5843    /// Delete a particular final workflow
5844    fn delete_final_workflow_graph(
5845        &self,
5846        graph_id: uuid::Uuid,
5847        version: String,
5848    ) -> Result<(), Self::Error>;
5849
5850    fn get_all_final_workflow_graphs(
5851        &self,
5852        name: Option<String>,
5853        description: Option<String>,
5854        all_search: Option<String>,
5855        sort_by: Option<String>,
5856        limit: Option<i32>,
5857        offset: Option<i32>,
5858    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error>;
5859
5860    /// Get details of a particular final workflow version
5861    fn get_final_workflow_graph(
5862        &self,
5863        graph_id: uuid::Uuid,
5864        version: String,
5865    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
5866
5867    /// Get details of a particular final workflow
5868    fn get_full_final_workflow_graph(
5869        &self,
5870        graph_id: uuid::Uuid,
5871    ) -> Result<models::FinalWorkflow, Self::Error>;
5872
5873    /// Create a new version for a particular final workflow
5874    fn update_final_workflow_graph(
5875        &self,
5876        graph_id: uuid::Uuid,
5877        body: models::CreateWorkflowVersionRequest,
5878    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
5879}
5880
5881pub trait WorkflowFinalApiMut {
5882    type Error;
5883
5884    fn create_final_workflow_graph(
5885        &mut self,
5886        body: models::CreateFinalWorkflowGraph,
5887    ) -> Result<models::FinalWorkflow, Self::Error>;
5888
5889    /// Delete a particular final workflow
5890    fn delete_final_workflow_graph(
5891        &mut self,
5892        graph_id: uuid::Uuid,
5893        version: String,
5894    ) -> Result<(), Self::Error>;
5895
5896    fn get_all_final_workflow_graphs(
5897        &mut self,
5898        name: Option<String>,
5899        description: Option<String>,
5900        all_search: Option<String>,
5901        sort_by: Option<String>,
5902        limit: Option<i32>,
5903        offset: Option<i32>,
5904    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error>;
5905
5906    /// Get details of a particular final workflow version
5907    fn get_final_workflow_graph(
5908        &mut self,
5909        graph_id: uuid::Uuid,
5910        version: String,
5911    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
5912
5913    /// Get details of a particular final workflow
5914    fn get_full_final_workflow_graph(
5915        &mut self,
5916        graph_id: uuid::Uuid,
5917    ) -> Result<models::FinalWorkflow, Self::Error>;
5918
5919    /// Create a new version for a particular final workflow
5920    fn update_final_workflow_graph(
5921        &mut self,
5922        graph_id: uuid::Uuid,
5923        body: models::CreateWorkflowVersionRequest,
5924    ) -> Result<models::VersionInFinalWorkflow, Self::Error>;
5925}
5926
5927// This is mostly so that we don't have to convert all the malbork APIs to
5928// ApiMut at once.
5929impl<T, E> WorkflowFinalApiMut for T
5930where
5931    T: WorkflowFinalApi<Error = E>,
5932{
5933    type Error = E;
5934
5935    fn create_final_workflow_graph(
5936        &mut self,
5937        body: models::CreateFinalWorkflowGraph,
5938    ) -> Result<models::FinalWorkflow, Self::Error> {
5939        <T as WorkflowFinalApi>::create_final_workflow_graph(self, body)
5940    }
5941
5942    fn delete_final_workflow_graph(
5943        &mut self,
5944        graph_id: uuid::Uuid,
5945        version: String,
5946    ) -> Result<(), Self::Error> {
5947        <T as WorkflowFinalApi>::delete_final_workflow_graph(self, graph_id, version)
5948    }
5949
5950    fn get_all_final_workflow_graphs(
5951        &mut self,
5952        name: Option<String>,
5953        description: Option<String>,
5954        all_search: Option<String>,
5955        sort_by: Option<String>,
5956        limit: Option<i32>,
5957        offset: Option<i32>,
5958    ) -> Result<models::GetAllFinalWorkflowGraphsResponse, Self::Error> {
5959        <T as WorkflowFinalApi>::get_all_final_workflow_graphs(
5960            self,
5961            name,
5962            description,
5963            all_search,
5964            sort_by,
5965            limit,
5966            offset,
5967        )
5968    }
5969
5970    fn get_final_workflow_graph(
5971        &mut self,
5972        graph_id: uuid::Uuid,
5973        version: String,
5974    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
5975        <T as WorkflowFinalApi>::get_final_workflow_graph(self, graph_id, version)
5976    }
5977
5978    fn get_full_final_workflow_graph(
5979        &mut self,
5980        graph_id: uuid::Uuid,
5981    ) -> Result<models::FinalWorkflow, Self::Error> {
5982        <T as WorkflowFinalApi>::get_full_final_workflow_graph(self, graph_id)
5983    }
5984
5985    fn update_final_workflow_graph(
5986        &mut self,
5987        graph_id: uuid::Uuid,
5988        body: models::CreateWorkflowVersionRequest,
5989    ) -> Result<models::VersionInFinalWorkflow, Self::Error> {
5990        <T as WorkflowFinalApi>::update_final_workflow_graph(self, graph_id, body)
5991    }
5992}
5993
5994pub trait ZoneApi {
5995    type Error;
5996
5997    /// Get zone details.
5998    fn get_zone(&self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error>;
5999
6000    /// Get the authentication token.
6001    fn get_zone_join_token(
6002        &self,
6003        zone_id: uuid::Uuid,
6004    ) -> Result<models::ZoneJoinToken, Self::Error>;
6005
6006    /// Get all zones.
6007    fn get_zones(&self) -> Result<Vec<models::Zone>, Self::Error>;
6008}
6009
6010pub trait ZoneApiMut {
6011    type Error;
6012
6013    /// Get zone details.
6014    fn get_zone(&mut self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error>;
6015
6016    /// Get the authentication token.
6017    fn get_zone_join_token(
6018        &mut self,
6019        zone_id: uuid::Uuid,
6020    ) -> Result<models::ZoneJoinToken, Self::Error>;
6021
6022    /// Get all zones.
6023    fn get_zones(&mut self) -> Result<Vec<models::Zone>, Self::Error>;
6024}
6025
6026// This is mostly so that we don't have to convert all the malbork APIs to
6027// ApiMut at once.
6028impl<T, E> ZoneApiMut for T
6029where
6030    T: ZoneApi<Error = E>,
6031{
6032    type Error = E;
6033
6034    fn get_zone(&mut self, zone_id: uuid::Uuid) -> Result<models::Zone, Self::Error> {
6035        <T as ZoneApi>::get_zone(self, zone_id)
6036    }
6037
6038    fn get_zone_join_token(
6039        &mut self,
6040        zone_id: uuid::Uuid,
6041    ) -> Result<models::ZoneJoinToken, Self::Error> {
6042        <T as ZoneApi>::get_zone_join_token(self, zone_id)
6043    }
6044
6045    fn get_zones(&mut self) -> Result<Vec<models::Zone>, Self::Error> {
6046        <T as ZoneApi>::get_zones(self)
6047    }
6048}
6049
6050#[cfg(feature = "client")]
6051pub mod client;
6052
6053// Re-export Client as a top-level name
6054#[cfg(feature = "client")]
6055pub use self::client::Client;
6056
6057pub mod models;
6058
6059pub mod base64_format {
6060    // This module from swagger-rs
6061
6062    use base64::{decode, encode};
6063    use serde::de::{Deserialize, Deserializer, Error};
6064    use serde::ser::{Serialize, Serializer};
6065    use std::ops::{Deref, DerefMut};
6066
6067    #[derive(Debug, Clone, PartialEq, PartialOrd)]
6068    /// Base64-encoded byte array
6069    pub struct ByteArray(pub Vec<u8>);
6070
6071    impl Serialize for ByteArray {
6072        fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6073        where
6074            S: Serializer,
6075        {
6076            serializer.serialize_str(&encode(&self.0))
6077        }
6078    }
6079
6080    impl<'de> Deserialize<'de> for ByteArray {
6081        fn deserialize<D>(deserializer: D) -> Result<ByteArray, D::Error>
6082        where
6083            D: Deserializer<'de>,
6084        {
6085            let s = String::deserialize(deserializer)?;
6086            match decode(&s) {
6087                Ok(bin) => Ok(ByteArray(bin)),
6088                _ => Err(D::Error::custom("invalid base64")),
6089            }
6090        }
6091    }
6092
6093    impl Deref for ByteArray {
6094        type Target = Vec<u8>;
6095        fn deref(&self) -> &Vec<u8> {
6096            &self.0
6097        }
6098    }
6099
6100    impl DerefMut for ByteArray {
6101        fn deref_mut(&mut self) -> &mut Vec<u8> {
6102            &mut self.0
6103        }
6104    }
6105
6106    impl AsRef<[u8]> for ByteArray {
6107        fn as_ref(&self) -> &[u8] {
6108            &self.0
6109        }
6110    }
6111}
6112pub use base64_format::ByteArray;
6113
6114/// Very simple error type - just holds a description of the error. This is useful for human
6115/// diagnosis and troubleshooting, but not for applications to parse. The justification for this
6116/// is to deny applications visibility into the communication layer, forcing the application code
6117/// to act solely on the logical responses that the API provides, promoting abstraction in the
6118/// application code.
6119
6120#[derive(Debug)]
6121pub struct ApiError {
6122    message: String,
6123    error_type: SimpleErrorType,
6124}
6125
6126impl ApiError {
6127    pub fn message(&self) -> &str {
6128        &self.message
6129    }
6130
6131    pub fn error_type(&self) -> SimpleErrorType {
6132        self.error_type
6133    }
6134}
6135
6136#[derive(Debug, Clone, Copy, PartialEq)]
6137pub enum SimpleErrorType {
6138    Temporary,
6139    Permanent,
6140}
6141
6142impl ApiError {
6143    pub fn new(message: String, error_type: SimpleErrorType) -> ApiError {
6144        ApiError {
6145            message,
6146            error_type,
6147        }
6148    }
6149}
6150
6151impl fmt::Display for ApiError {
6152    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6153        let debug: &dyn fmt::Debug = self;
6154        debug.fmt(f)
6155    }
6156}
6157
6158impl error::Error for ApiError {
6159    fn description(&self) -> &str {
6160        "Failed to produce a valid response."
6161    }
6162}
6163
6164impl<'a> From<&'a str> for ApiError {
6165    fn from(e: &str) -> Self {
6166        ApiError::new(e.to_string(), SimpleErrorType::Temporary)
6167    }
6168}
6169
6170impl From<String> for ApiError {
6171    fn from(e: String) -> Self {
6172        ApiError::new(e, SimpleErrorType::Temporary)
6173    }
6174}
6175
6176impl From<serde_json::Error> for ApiError {
6177    fn from(e: serde_json::Error) -> Self {
6178        ApiError::new(
6179            format!("Response body did not match the schema: {}", e),
6180            SimpleErrorType::Temporary,
6181        )
6182    }
6183}
6184
6185#[derive(Debug)]
6186pub struct ServerError {
6187    pub message: String,
6188    pub error_type: ErrorType,
6189}
6190
6191#[derive(Debug)]
6192pub enum ErrorType {
6193    BadRequest,
6194    Forbidden,
6195    InvalidPathParameter,
6196    InvalidBodyParameter,
6197    InvalidQueryParameter,
6198    MissingParameter,
6199    NotFound,
6200    MethodNotAllowed,
6201    InvalidHeader,
6202}
6203
6204impl ServerError {
6205    pub fn new(message: &str, error_type: ErrorType) -> ServerError {
6206        ServerError {
6207            message: message.to_owned(),
6208            error_type,
6209        }
6210    }
6211}
6212
6213impl ::std::fmt::Display for ErrorType {
6214    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
6215        match *self {
6216            ErrorType::BadRequest => write!(f, "{}", "BadRequest"),
6217            ErrorType::Forbidden => write!(f, "{}", "Forbidden"),
6218            ErrorType::InvalidPathParameter => write!(f, "{}", "InvalidPathParameter"),
6219            ErrorType::InvalidBodyParameter => write!(f, "{}", "InvalidBodyParameter"),
6220            ErrorType::InvalidQueryParameter => write!(f, "{}", "InvalidQueryParameter"),
6221            ErrorType::MissingParameter => write!(f, "{}", "MissingParameter"),
6222            ErrorType::NotFound => write!(f, "{}", "NotFound"),
6223            ErrorType::MethodNotAllowed => write!(f, "{}", "MethodNotAllowed"),
6224            ErrorType::InvalidHeader => write!(f, "{}", "InvalidHeader"),
6225        }
6226    }
6227}
6228
6229/// Describes SHA256 hash sum in byte format
6230#[derive(Debug, PartialEq)]
6231pub struct Sha256Hash([u8; SHA256_BYTE_LENGTH]);
6232
6233impl TryFrom<&str> for Sha256Hash {
6234    type Error = String;
6235
6236    fn try_from(value: &str) -> Result<Self, Self::Error> {
6237        if value.len() != SHA256_CHAR_LENGTH {
6238            return Err(format!("SHA-256 string should be exactly {} characters long, instead got a string of len {}", SHA256_CHAR_LENGTH, value.len()));
6239        } else if !(value.chars().all(|c| c.is_ascii_hexdigit())) {
6240            return Err(format!("SHA-256 string should contain only hexadecimal characters in the format [0-9a-fA-F], but got {}", value));
6241        } else {
6242            let mut result = [0u8; SHA256_BYTE_LENGTH];
6243
6244            for i in 0..SHA256_BYTE_LENGTH {
6245                // We iterate input string by chunks of 2 because 1 hex char is half a byte.
6246                let chunk = &value[2 * i..2 * i + 2];
6247                result[i] = u8::from_str_radix(chunk, 16).map_err(|err| {
6248                    format!(
6249                        "Invalid hex format for chunk '{}' at position {}. Error {:?}",
6250                        chunk, i, err
6251                    )
6252                })?;
6253            }
6254
6255            Ok(Sha256Hash(result))
6256        }
6257    }
6258}
6259
6260impl Deref for Sha256Hash {
6261    type Target = [u8; SHA256_BYTE_LENGTH];
6262
6263    fn deref(&self) -> &Self::Target {
6264        &self.0
6265    }
6266}
6267
6268#[cfg(test)]
6269mod tests {
6270    use std::convert::TryFrom;
6271    use Sha256Hash;
6272    use SHA256_BYTE_LENGTH;
6273
6274    #[test]
6275    fn test_valid_sha256_hash() {
6276        let valid_sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
6277        let hash = Sha256Hash::try_from(valid_sha256);
6278
6279        assert!(hash.is_ok());
6280        let hash = hash.unwrap();
6281        assert_eq!(hash.0.len(), SHA256_BYTE_LENGTH);
6282        assert_eq!(
6283            hash.0,
6284            [
6285                0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f,
6286                0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b,
6287                0x78, 0x52, 0xb8, 0x55
6288            ]
6289        );
6290    }
6291
6292    #[test]
6293    fn test_invalid_length_sha256_hash() {
6294        let invalid_sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852"; // 62 characters
6295        let hash = Sha256Hash::try_from(invalid_sha256);
6296
6297        assert!(hash.is_err());
6298    }
6299
6300    #[test]
6301    fn test_invalid_hex_sha256_hash() {
6302        let invalid_sha256 = "X3b0c44298Lc1c149afbf4c8996fb92427XX41e4649b934WW495991b7852Y855";
6303        let hash = Sha256Hash::try_from(invalid_sha256);
6304
6305        assert!(hash.is_err());
6306    }
6307
6308    #[test]
6309    fn test_empty_sha256_hash() {
6310        let empty_sha256 = "";
6311        let hash = Sha256Hash::try_from(empty_sha256);
6312
6313        assert!(hash.is_err());
6314    }
6315}