nethsm_sdk_rs/apis/
default_api.rs

1/*
2 * NetHSM
3 *
4 * All endpoints expect exactly the specified JSON. Additional properties will cause a Bad Request Error (400). All HTTP errors contain a JSON structure with an explanation of type string. All [base64](https://tools.ietf.org/html/rfc4648#section-4) encoded values are Big Endian.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: Nitrokey <info@nitrokey.com>
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, Error};
12use crate::apis::ResponseContent;
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
15#[serde(untagged)]
16pub enum KeysKeyIdPutBody {
17    ApplicationJson(crate::models::PrivateKey),
18    MultipartFormData(String),
19}
20
21impl KeysKeyIdPutBody {
22    pub fn content_type(&self) -> &'static str {
23        match self {
24            Self::ApplicationJson(_) => "application/json",
25            Self::MultipartFormData(_) => "multipart/form-data",
26        }
27    }
28    pub fn is_json(&self) -> bool {
29        match self {
30            Self::ApplicationJson(_) => true,
31            Self::MultipartFormData(_) => false,
32        }
33    }
34    pub fn get_string(&self) -> String {
35        match self {
36            Self::ApplicationJson(_) => "".to_string(),
37            Self::MultipartFormData(s) => s.clone(),
38        }
39    }
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
43#[serde(untagged)]
44pub enum KeysPostBody {
45    ApplicationJson(crate::models::PrivateKey),
46    MultipartFormData(String),
47}
48
49impl KeysPostBody {
50    pub fn content_type(&self) -> &'static str {
51        match self {
52            Self::ApplicationJson(_) => "application/json",
53            Self::MultipartFormData(_) => "multipart/form-data",
54        }
55    }
56    pub fn is_json(&self) -> bool {
57        match self {
58            Self::ApplicationJson(_) => true,
59            Self::MultipartFormData(_) => false,
60        }
61    }
62    pub fn get_string(&self) -> String {
63        match self {
64            Self::ApplicationJson(_) => "".to_string(),
65            Self::MultipartFormData(s) => s.clone(),
66        }
67    }
68}
69
70/// struct for typed errors of method [`config_backup_passphrase_put`]
71#[derive(Debug, Clone, Serialize, Deserialize)]
72#[serde(untagged)]
73pub enum ConfigBackupPassphrasePutError {
74    Status400(),
75    Status401(),
76    Status403(),
77    Status406(),
78    Status412(),
79    UnknownValue(serde_json::Value),
80}
81
82impl ConfigBackupPassphrasePutError {
83    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
84        // to do: support payloads once added to API spec
85        match status {
86            400 => Ok(Self::Status400()),
87            401 => Ok(Self::Status401()),
88            403 => Ok(Self::Status403()),
89            406 => Ok(Self::Status406()),
90            412 => Ok(Self::Status412()),
91            _ => {
92                if data.is_empty() {
93                    Ok(Self::UnknownValue(serde_json::Value::Null))
94                } else {
95                    serde_json::from_slice(data).map(Self::UnknownValue)
96                }
97            }
98        }
99    }
100}
101
102/// struct for typed errors of method [`config_logging_get`]
103#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum ConfigLoggingGetError {
106    Status401(),
107    Status403(),
108    Status406(),
109    Status412(),
110    UnknownValue(serde_json::Value),
111}
112
113impl ConfigLoggingGetError {
114    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
115        // to do: support payloads once added to API spec
116        match status {
117            401 => Ok(Self::Status401()),
118            403 => Ok(Self::Status403()),
119            406 => Ok(Self::Status406()),
120            412 => Ok(Self::Status412()),
121            _ => {
122                if data.is_empty() {
123                    Ok(Self::UnknownValue(serde_json::Value::Null))
124                } else {
125                    serde_json::from_slice(data).map(Self::UnknownValue)
126                }
127            }
128        }
129    }
130}
131
132/// struct for typed errors of method [`config_logging_put`]
133#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum ConfigLoggingPutError {
136    Status400(),
137    Status401(),
138    Status403(),
139    Status406(),
140    Status412(),
141    UnknownValue(serde_json::Value),
142}
143
144impl ConfigLoggingPutError {
145    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
146        // to do: support payloads once added to API spec
147        match status {
148            400 => Ok(Self::Status400()),
149            401 => Ok(Self::Status401()),
150            403 => Ok(Self::Status403()),
151            406 => Ok(Self::Status406()),
152            412 => Ok(Self::Status412()),
153            _ => {
154                if data.is_empty() {
155                    Ok(Self::UnknownValue(serde_json::Value::Null))
156                } else {
157                    serde_json::from_slice(data).map(Self::UnknownValue)
158                }
159            }
160        }
161    }
162}
163
164/// struct for typed errors of method [`config_network_get`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum ConfigNetworkGetError {
168    Status401(),
169    Status403(),
170    Status406(),
171    Status412(),
172    UnknownValue(serde_json::Value),
173}
174
175impl ConfigNetworkGetError {
176    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
177        // to do: support payloads once added to API spec
178        match status {
179            401 => Ok(Self::Status401()),
180            403 => Ok(Self::Status403()),
181            406 => Ok(Self::Status406()),
182            412 => Ok(Self::Status412()),
183            _ => {
184                if data.is_empty() {
185                    Ok(Self::UnknownValue(serde_json::Value::Null))
186                } else {
187                    serde_json::from_slice(data).map(Self::UnknownValue)
188                }
189            }
190        }
191    }
192}
193
194/// struct for typed errors of method [`config_network_put`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum ConfigNetworkPutError {
198    Status400(),
199    Status401(),
200    Status403(),
201    Status406(),
202    Status412(),
203    UnknownValue(serde_json::Value),
204}
205
206impl ConfigNetworkPutError {
207    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
208        // to do: support payloads once added to API spec
209        match status {
210            400 => Ok(Self::Status400()),
211            401 => Ok(Self::Status401()),
212            403 => Ok(Self::Status403()),
213            406 => Ok(Self::Status406()),
214            412 => Ok(Self::Status412()),
215            _ => {
216                if data.is_empty() {
217                    Ok(Self::UnknownValue(serde_json::Value::Null))
218                } else {
219                    serde_json::from_slice(data).map(Self::UnknownValue)
220                }
221            }
222        }
223    }
224}
225
226/// struct for typed errors of method [`config_time_get`]
227#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum ConfigTimeGetError {
230    Status401(),
231    Status403(),
232    Status406(),
233    Status412(),
234    UnknownValue(serde_json::Value),
235}
236
237impl ConfigTimeGetError {
238    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
239        // to do: support payloads once added to API spec
240        match status {
241            401 => Ok(Self::Status401()),
242            403 => Ok(Self::Status403()),
243            406 => Ok(Self::Status406()),
244            412 => Ok(Self::Status412()),
245            _ => {
246                if data.is_empty() {
247                    Ok(Self::UnknownValue(serde_json::Value::Null))
248                } else {
249                    serde_json::from_slice(data).map(Self::UnknownValue)
250                }
251            }
252        }
253    }
254}
255
256/// struct for typed errors of method [`config_time_put`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum ConfigTimePutError {
260    Status400(),
261    Status401(),
262    Status403(),
263    Status406(),
264    Status412(),
265    UnknownValue(serde_json::Value),
266}
267
268impl ConfigTimePutError {
269    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
270        // to do: support payloads once added to API spec
271        match status {
272            400 => Ok(Self::Status400()),
273            401 => Ok(Self::Status401()),
274            403 => Ok(Self::Status403()),
275            406 => Ok(Self::Status406()),
276            412 => Ok(Self::Status412()),
277            _ => {
278                if data.is_empty() {
279                    Ok(Self::UnknownValue(serde_json::Value::Null))
280                } else {
281                    serde_json::from_slice(data).map(Self::UnknownValue)
282                }
283            }
284        }
285    }
286}
287
288/// struct for typed errors of method [`config_tls_cert_pem_get`]
289#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum ConfigTlsCertPemGetError {
292    Status401(),
293    Status403(),
294    Status406(),
295    Status412(),
296    Status415(),
297    UnknownValue(serde_json::Value),
298}
299
300impl ConfigTlsCertPemGetError {
301    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
302        // to do: support payloads once added to API spec
303        match status {
304            401 => Ok(Self::Status401()),
305            403 => Ok(Self::Status403()),
306            406 => Ok(Self::Status406()),
307            412 => Ok(Self::Status412()),
308            415 => Ok(Self::Status415()),
309            _ => {
310                if data.is_empty() {
311                    Ok(Self::UnknownValue(serde_json::Value::Null))
312                } else {
313                    serde_json::from_slice(data).map(Self::UnknownValue)
314                }
315            }
316        }
317    }
318}
319
320/// struct for typed errors of method [`config_tls_cert_pem_put`]
321#[derive(Debug, Clone, Serialize, Deserialize)]
322#[serde(untagged)]
323pub enum ConfigTlsCertPemPutError {
324    Status400(),
325    Status401(),
326    Status403(),
327    Status406(),
328    Status412(),
329    UnknownValue(serde_json::Value),
330}
331
332impl ConfigTlsCertPemPutError {
333    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
334        // to do: support payloads once added to API spec
335        match status {
336            400 => Ok(Self::Status400()),
337            401 => Ok(Self::Status401()),
338            403 => Ok(Self::Status403()),
339            406 => Ok(Self::Status406()),
340            412 => Ok(Self::Status412()),
341            _ => {
342                if data.is_empty() {
343                    Ok(Self::UnknownValue(serde_json::Value::Null))
344                } else {
345                    serde_json::from_slice(data).map(Self::UnknownValue)
346                }
347            }
348        }
349    }
350}
351
352/// struct for typed errors of method [`config_tls_csr_pem_post`]
353#[derive(Debug, Clone, Serialize, Deserialize)]
354#[serde(untagged)]
355pub enum ConfigTlsCsrPemPostError {
356    Status401(),
357    Status403(),
358    Status406(),
359    Status412(),
360    UnknownValue(serde_json::Value),
361}
362
363impl ConfigTlsCsrPemPostError {
364    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
365        // to do: support payloads once added to API spec
366        match status {
367            401 => Ok(Self::Status401()),
368            403 => Ok(Self::Status403()),
369            406 => Ok(Self::Status406()),
370            412 => Ok(Self::Status412()),
371            _ => {
372                if data.is_empty() {
373                    Ok(Self::UnknownValue(serde_json::Value::Null))
374                } else {
375                    serde_json::from_slice(data).map(Self::UnknownValue)
376                }
377            }
378        }
379    }
380}
381
382/// struct for typed errors of method [`config_tls_generate_post`]
383#[derive(Debug, Clone, Serialize, Deserialize)]
384#[serde(untagged)]
385pub enum ConfigTlsGeneratePostError {
386    Status400(),
387    Status401(),
388    Status403(),
389    Status406(),
390    Status412(),
391    UnknownValue(serde_json::Value),
392}
393
394impl ConfigTlsGeneratePostError {
395    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
396        // to do: support payloads once added to API spec
397        match status {
398            400 => Ok(Self::Status400()),
399            401 => Ok(Self::Status401()),
400            403 => Ok(Self::Status403()),
401            406 => Ok(Self::Status406()),
402            412 => Ok(Self::Status412()),
403            _ => {
404                if data.is_empty() {
405                    Ok(Self::UnknownValue(serde_json::Value::Null))
406                } else {
407                    serde_json::from_slice(data).map(Self::UnknownValue)
408                }
409            }
410        }
411    }
412}
413
414/// struct for typed errors of method [`config_tls_public_pem_get`]
415#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum ConfigTlsPublicPemGetError {
418    Status401(),
419    Status403(),
420    Status406(),
421    Status412(),
422    UnknownValue(serde_json::Value),
423}
424
425impl ConfigTlsPublicPemGetError {
426    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
427        // to do: support payloads once added to API spec
428        match status {
429            401 => Ok(Self::Status401()),
430            403 => Ok(Self::Status403()),
431            406 => Ok(Self::Status406()),
432            412 => Ok(Self::Status412()),
433            _ => {
434                if data.is_empty() {
435                    Ok(Self::UnknownValue(serde_json::Value::Null))
436                } else {
437                    serde_json::from_slice(data).map(Self::UnknownValue)
438                }
439            }
440        }
441    }
442}
443
444/// struct for typed errors of method [`config_unattended_boot_get`]
445#[derive(Debug, Clone, Serialize, Deserialize)]
446#[serde(untagged)]
447pub enum ConfigUnattendedBootGetError {
448    Status401(),
449    Status403(),
450    Status406(),
451    Status412(),
452    UnknownValue(serde_json::Value),
453}
454
455impl ConfigUnattendedBootGetError {
456    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
457        // to do: support payloads once added to API spec
458        match status {
459            401 => Ok(Self::Status401()),
460            403 => Ok(Self::Status403()),
461            406 => Ok(Self::Status406()),
462            412 => Ok(Self::Status412()),
463            _ => {
464                if data.is_empty() {
465                    Ok(Self::UnknownValue(serde_json::Value::Null))
466                } else {
467                    serde_json::from_slice(data).map(Self::UnknownValue)
468                }
469            }
470        }
471    }
472}
473
474/// struct for typed errors of method [`config_unattended_boot_put`]
475#[derive(Debug, Clone, Serialize, Deserialize)]
476#[serde(untagged)]
477pub enum ConfigUnattendedBootPutError {
478    Status400(),
479    Status401(),
480    Status403(),
481    Status406(),
482    Status412(),
483    UnknownValue(serde_json::Value),
484}
485
486impl ConfigUnattendedBootPutError {
487    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
488        // to do: support payloads once added to API spec
489        match status {
490            400 => Ok(Self::Status400()),
491            401 => Ok(Self::Status401()),
492            403 => Ok(Self::Status403()),
493            406 => Ok(Self::Status406()),
494            412 => Ok(Self::Status412()),
495            _ => {
496                if data.is_empty() {
497                    Ok(Self::UnknownValue(serde_json::Value::Null))
498                } else {
499                    serde_json::from_slice(data).map(Self::UnknownValue)
500                }
501            }
502        }
503    }
504}
505
506/// struct for typed errors of method [`config_unlock_passphrase_put`]
507#[derive(Debug, Clone, Serialize, Deserialize)]
508#[serde(untagged)]
509pub enum ConfigUnlockPassphrasePutError {
510    Status400(),
511    Status401(),
512    Status403(),
513    Status406(),
514    Status412(),
515    UnknownValue(serde_json::Value),
516}
517
518impl ConfigUnlockPassphrasePutError {
519    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
520        // to do: support payloads once added to API spec
521        match status {
522            400 => Ok(Self::Status400()),
523            401 => Ok(Self::Status401()),
524            403 => Ok(Self::Status403()),
525            406 => Ok(Self::Status406()),
526            412 => Ok(Self::Status412()),
527            _ => {
528                if data.is_empty() {
529                    Ok(Self::UnknownValue(serde_json::Value::Null))
530                } else {
531                    serde_json::from_slice(data).map(Self::UnknownValue)
532                }
533            }
534        }
535    }
536}
537
538/// struct for typed errors of method [`health_alive_get`]
539#[derive(Debug, Clone, Serialize, Deserialize)]
540#[serde(untagged)]
541pub enum HealthAliveGetError {
542    Status406(),
543    Status412(),
544    UnknownValue(serde_json::Value),
545}
546
547impl HealthAliveGetError {
548    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
549        // to do: support payloads once added to API spec
550        match status {
551            406 => Ok(Self::Status406()),
552            412 => Ok(Self::Status412()),
553            _ => {
554                if data.is_empty() {
555                    Ok(Self::UnknownValue(serde_json::Value::Null))
556                } else {
557                    serde_json::from_slice(data).map(Self::UnknownValue)
558                }
559            }
560        }
561    }
562}
563
564/// struct for typed errors of method [`health_ready_get`]
565#[derive(Debug, Clone, Serialize, Deserialize)]
566#[serde(untagged)]
567pub enum HealthReadyGetError {
568    Status406(),
569    Status412(),
570    UnknownValue(serde_json::Value),
571}
572
573impl HealthReadyGetError {
574    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
575        // to do: support payloads once added to API spec
576        match status {
577            406 => Ok(Self::Status406()),
578            412 => Ok(Self::Status412()),
579            _ => {
580                if data.is_empty() {
581                    Ok(Self::UnknownValue(serde_json::Value::Null))
582                } else {
583                    serde_json::from_slice(data).map(Self::UnknownValue)
584                }
585            }
586        }
587    }
588}
589
590/// struct for typed errors of method [`health_state_get`]
591#[derive(Debug, Clone, Serialize, Deserialize)]
592#[serde(untagged)]
593pub enum HealthStateGetError {
594    Status406(),
595    UnknownValue(serde_json::Value),
596}
597
598impl HealthStateGetError {
599    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
600        // to do: support payloads once added to API spec
601        match status {
602            406 => Ok(Self::Status406()),
603            _ => {
604                if data.is_empty() {
605                    Ok(Self::UnknownValue(serde_json::Value::Null))
606                } else {
607                    serde_json::from_slice(data).map(Self::UnknownValue)
608                }
609            }
610        }
611    }
612}
613
614/// struct for typed errors of method [`info_get`]
615#[derive(Debug, Clone, Serialize, Deserialize)]
616#[serde(untagged)]
617pub enum InfoGetError {
618    Status406(),
619    UnknownValue(serde_json::Value),
620}
621
622impl InfoGetError {
623    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
624        // to do: support payloads once added to API spec
625        match status {
626            406 => Ok(Self::Status406()),
627            _ => {
628                if data.is_empty() {
629                    Ok(Self::UnknownValue(serde_json::Value::Null))
630                } else {
631                    serde_json::from_slice(data).map(Self::UnknownValue)
632                }
633            }
634        }
635    }
636}
637
638/// struct for typed errors of method [`keys_generate_post`]
639#[derive(Debug, Clone, Serialize, Deserialize)]
640#[serde(untagged)]
641pub enum KeysGeneratePostError {
642    Status400(),
643    Status401(),
644    Status403(),
645    Status406(),
646    Status412(),
647    UnknownValue(serde_json::Value),
648}
649
650impl KeysGeneratePostError {
651    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
652        // to do: support payloads once added to API spec
653        match status {
654            400 => Ok(Self::Status400()),
655            401 => Ok(Self::Status401()),
656            403 => Ok(Self::Status403()),
657            406 => Ok(Self::Status406()),
658            412 => Ok(Self::Status412()),
659            _ => {
660                if data.is_empty() {
661                    Ok(Self::UnknownValue(serde_json::Value::Null))
662                } else {
663                    serde_json::from_slice(data).map(Self::UnknownValue)
664                }
665            }
666        }
667    }
668}
669
670/// struct for typed errors of method [`keys_get`]
671#[derive(Debug, Clone, Serialize, Deserialize)]
672#[serde(untagged)]
673pub enum KeysGetError {
674    Status401(),
675    Status403(),
676    Status406(),
677    Status412(),
678    UnknownValue(serde_json::Value),
679}
680
681impl KeysGetError {
682    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
683        // to do: support payloads once added to API spec
684        match status {
685            401 => Ok(Self::Status401()),
686            403 => Ok(Self::Status403()),
687            406 => Ok(Self::Status406()),
688            412 => Ok(Self::Status412()),
689            _ => {
690                if data.is_empty() {
691                    Ok(Self::UnknownValue(serde_json::Value::Null))
692                } else {
693                    serde_json::from_slice(data).map(Self::UnknownValue)
694                }
695            }
696        }
697    }
698}
699
700/// struct for typed errors of method [`keys_key_id_cert_delete`]
701#[derive(Debug, Clone, Serialize, Deserialize)]
702#[serde(untagged)]
703pub enum KeysKeyIdCertDeleteError {
704    Status401(),
705    Status403(),
706    Status404(),
707    Status406(),
708    Status412(),
709    UnknownValue(serde_json::Value),
710}
711
712impl KeysKeyIdCertDeleteError {
713    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
714        // to do: support payloads once added to API spec
715        match status {
716            401 => Ok(Self::Status401()),
717            403 => Ok(Self::Status403()),
718            404 => Ok(Self::Status404()),
719            406 => Ok(Self::Status406()),
720            412 => Ok(Self::Status412()),
721            _ => {
722                if data.is_empty() {
723                    Ok(Self::UnknownValue(serde_json::Value::Null))
724                } else {
725                    serde_json::from_slice(data).map(Self::UnknownValue)
726                }
727            }
728        }
729    }
730}
731
732/// struct for typed errors of method [`keys_key_id_cert_get`]
733#[derive(Debug, Clone, Serialize, Deserialize)]
734#[serde(untagged)]
735pub enum KeysKeyIdCertGetError {
736    Status400(),
737    Status401(),
738    Status403(),
739    Status404(),
740    Status406(),
741    Status412(),
742    UnknownValue(serde_json::Value),
743}
744
745impl KeysKeyIdCertGetError {
746    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
747        // to do: support payloads once added to API spec
748        match status {
749            400 => Ok(Self::Status400()),
750            401 => Ok(Self::Status401()),
751            403 => Ok(Self::Status403()),
752            404 => Ok(Self::Status404()),
753            406 => Ok(Self::Status406()),
754            412 => Ok(Self::Status412()),
755            _ => {
756                if data.is_empty() {
757                    Ok(Self::UnknownValue(serde_json::Value::Null))
758                } else {
759                    serde_json::from_slice(data).map(Self::UnknownValue)
760                }
761            }
762        }
763    }
764}
765
766/// struct for typed errors of method [`keys_key_id_cert_put`]
767#[derive(Debug, Clone, Serialize, Deserialize)]
768#[serde(untagged)]
769pub enum KeysKeyIdCertPutError {
770    Status401(),
771    Status403(),
772    Status406(),
773    Status409(),
774    Status412(),
775    UnknownValue(serde_json::Value),
776}
777
778impl KeysKeyIdCertPutError {
779    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
780        // to do: support payloads once added to API spec
781        match status {
782            401 => Ok(Self::Status401()),
783            403 => Ok(Self::Status403()),
784            406 => Ok(Self::Status406()),
785            409 => Ok(Self::Status409()),
786            412 => Ok(Self::Status412()),
787            _ => {
788                if data.is_empty() {
789                    Ok(Self::UnknownValue(serde_json::Value::Null))
790                } else {
791                    serde_json::from_slice(data).map(Self::UnknownValue)
792                }
793            }
794        }
795    }
796}
797
798/// struct for typed errors of method [`keys_key_id_csr_pem_post`]
799#[derive(Debug, Clone, Serialize, Deserialize)]
800#[serde(untagged)]
801pub enum KeysKeyIdCsrPemPostError {
802    Status400(),
803    Status401(),
804    Status403(),
805    Status404(),
806    Status406(),
807    Status412(),
808    UnknownValue(serde_json::Value),
809}
810
811impl KeysKeyIdCsrPemPostError {
812    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
813        // to do: support payloads once added to API spec
814        match status {
815            400 => Ok(Self::Status400()),
816            401 => Ok(Self::Status401()),
817            403 => Ok(Self::Status403()),
818            404 => Ok(Self::Status404()),
819            406 => Ok(Self::Status406()),
820            412 => Ok(Self::Status412()),
821            _ => {
822                if data.is_empty() {
823                    Ok(Self::UnknownValue(serde_json::Value::Null))
824                } else {
825                    serde_json::from_slice(data).map(Self::UnknownValue)
826                }
827            }
828        }
829    }
830}
831
832/// struct for typed errors of method [`keys_key_id_decrypt_post`]
833#[derive(Debug, Clone, Serialize, Deserialize)]
834#[serde(untagged)]
835pub enum KeysKeyIdDecryptPostError {
836    Status400(),
837    Status401(),
838    Status403(),
839    Status404(),
840    Status406(),
841    Status412(),
842    UnknownValue(serde_json::Value),
843}
844
845impl KeysKeyIdDecryptPostError {
846    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
847        // to do: support payloads once added to API spec
848        match status {
849            400 => Ok(Self::Status400()),
850            401 => Ok(Self::Status401()),
851            403 => Ok(Self::Status403()),
852            404 => Ok(Self::Status404()),
853            406 => Ok(Self::Status406()),
854            412 => Ok(Self::Status412()),
855            _ => {
856                if data.is_empty() {
857                    Ok(Self::UnknownValue(serde_json::Value::Null))
858                } else {
859                    serde_json::from_slice(data).map(Self::UnknownValue)
860                }
861            }
862        }
863    }
864}
865
866/// struct for typed errors of method [`keys_key_id_delete`]
867#[derive(Debug, Clone, Serialize, Deserialize)]
868#[serde(untagged)]
869pub enum KeysKeyIdDeleteError {
870    Status401(),
871    Status403(),
872    Status404(),
873    Status406(),
874    Status412(),
875    UnknownValue(serde_json::Value),
876}
877
878impl KeysKeyIdDeleteError {
879    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
880        // to do: support payloads once added to API spec
881        match status {
882            401 => Ok(Self::Status401()),
883            403 => Ok(Self::Status403()),
884            404 => Ok(Self::Status404()),
885            406 => Ok(Self::Status406()),
886            412 => Ok(Self::Status412()),
887            _ => {
888                if data.is_empty() {
889                    Ok(Self::UnknownValue(serde_json::Value::Null))
890                } else {
891                    serde_json::from_slice(data).map(Self::UnknownValue)
892                }
893            }
894        }
895    }
896}
897
898/// struct for typed errors of method [`keys_key_id_encrypt_post`]
899#[derive(Debug, Clone, Serialize, Deserialize)]
900#[serde(untagged)]
901pub enum KeysKeyIdEncryptPostError {
902    Status400(),
903    Status401(),
904    Status403(),
905    Status404(),
906    Status406(),
907    Status412(),
908    UnknownValue(serde_json::Value),
909}
910
911impl KeysKeyIdEncryptPostError {
912    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
913        // to do: support payloads once added to API spec
914        match status {
915            400 => Ok(Self::Status400()),
916            401 => Ok(Self::Status401()),
917            403 => Ok(Self::Status403()),
918            404 => Ok(Self::Status404()),
919            406 => Ok(Self::Status406()),
920            412 => Ok(Self::Status412()),
921            _ => {
922                if data.is_empty() {
923                    Ok(Self::UnknownValue(serde_json::Value::Null))
924                } else {
925                    serde_json::from_slice(data).map(Self::UnknownValue)
926                }
927            }
928        }
929    }
930}
931
932/// struct for typed errors of method [`keys_key_id_get`]
933#[derive(Debug, Clone, Serialize, Deserialize)]
934#[serde(untagged)]
935pub enum KeysKeyIdGetError {
936    Status400(),
937    Status401(),
938    Status403(),
939    Status404(),
940    Status406(),
941    Status412(),
942    UnknownValue(serde_json::Value),
943}
944
945impl KeysKeyIdGetError {
946    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
947        // to do: support payloads once added to API spec
948        match status {
949            400 => Ok(Self::Status400()),
950            401 => Ok(Self::Status401()),
951            403 => Ok(Self::Status403()),
952            404 => Ok(Self::Status404()),
953            406 => Ok(Self::Status406()),
954            412 => Ok(Self::Status412()),
955            _ => {
956                if data.is_empty() {
957                    Ok(Self::UnknownValue(serde_json::Value::Null))
958                } else {
959                    serde_json::from_slice(data).map(Self::UnknownValue)
960                }
961            }
962        }
963    }
964}
965
966/// struct for typed errors of method [`keys_key_id_move_post`]
967#[derive(Debug, Clone, Serialize, Deserialize)]
968#[serde(untagged)]
969pub enum KeysKeyIdMovePostError {
970    Status400(),
971    Status401(),
972    Status403(),
973    Status404(),
974    Status409(),
975    Status412(),
976    UnknownValue(serde_json::Value),
977}
978
979impl KeysKeyIdMovePostError {
980    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
981        // to do: support payloads once added to API spec
982        match status {
983            400 => Ok(Self::Status400()),
984            401 => Ok(Self::Status401()),
985            403 => Ok(Self::Status403()),
986            404 => Ok(Self::Status404()),
987            409 => Ok(Self::Status409()),
988            412 => Ok(Self::Status412()),
989            _ => {
990                if data.is_empty() {
991                    Ok(Self::UnknownValue(serde_json::Value::Null))
992                } else {
993                    serde_json::from_slice(data).map(Self::UnknownValue)
994                }
995            }
996        }
997    }
998}
999
1000/// struct for typed errors of method [`keys_key_id_public_pem_get`]
1001#[derive(Debug, Clone, Serialize, Deserialize)]
1002#[serde(untagged)]
1003pub enum KeysKeyIdPublicPemGetError {
1004    Status400(),
1005    Status401(),
1006    Status403(),
1007    Status404(),
1008    Status406(),
1009    Status412(),
1010    UnknownValue(serde_json::Value),
1011}
1012
1013impl KeysKeyIdPublicPemGetError {
1014    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1015        // to do: support payloads once added to API spec
1016        match status {
1017            400 => Ok(Self::Status400()),
1018            401 => Ok(Self::Status401()),
1019            403 => Ok(Self::Status403()),
1020            404 => Ok(Self::Status404()),
1021            406 => Ok(Self::Status406()),
1022            412 => Ok(Self::Status412()),
1023            _ => {
1024                if data.is_empty() {
1025                    Ok(Self::UnknownValue(serde_json::Value::Null))
1026                } else {
1027                    serde_json::from_slice(data).map(Self::UnknownValue)
1028                }
1029            }
1030        }
1031    }
1032}
1033
1034/// struct for typed errors of method [`keys_key_id_put`]
1035#[derive(Debug, Clone, Serialize, Deserialize)]
1036#[serde(untagged)]
1037pub enum KeysKeyIdPutError {
1038    Status400(),
1039    Status401(),
1040    Status403(),
1041    Status406(),
1042    Status409(),
1043    Status412(),
1044    UnknownValue(serde_json::Value),
1045}
1046
1047impl KeysKeyIdPutError {
1048    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1049        // to do: support payloads once added to API spec
1050        match status {
1051            400 => Ok(Self::Status400()),
1052            401 => Ok(Self::Status401()),
1053            403 => Ok(Self::Status403()),
1054            406 => Ok(Self::Status406()),
1055            409 => Ok(Self::Status409()),
1056            412 => Ok(Self::Status412()),
1057            _ => {
1058                if data.is_empty() {
1059                    Ok(Self::UnknownValue(serde_json::Value::Null))
1060                } else {
1061                    serde_json::from_slice(data).map(Self::UnknownValue)
1062                }
1063            }
1064        }
1065    }
1066}
1067
1068/// struct for typed errors of method [`keys_key_id_restrictions_tags_tag_delete`]
1069#[derive(Debug, Clone, Serialize, Deserialize)]
1070#[serde(untagged)]
1071pub enum KeysKeyIdRestrictionsTagsTagDeleteError {
1072    Status401(),
1073    Status403(),
1074    Status404(),
1075    Status406(),
1076    Status412(),
1077    UnknownValue(serde_json::Value),
1078}
1079
1080impl KeysKeyIdRestrictionsTagsTagDeleteError {
1081    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1082        // to do: support payloads once added to API spec
1083        match status {
1084            401 => Ok(Self::Status401()),
1085            403 => Ok(Self::Status403()),
1086            404 => Ok(Self::Status404()),
1087            406 => Ok(Self::Status406()),
1088            412 => Ok(Self::Status412()),
1089            _ => {
1090                if data.is_empty() {
1091                    Ok(Self::UnknownValue(serde_json::Value::Null))
1092                } else {
1093                    serde_json::from_slice(data).map(Self::UnknownValue)
1094                }
1095            }
1096        }
1097    }
1098}
1099
1100/// struct for typed errors of method [`keys_key_id_restrictions_tags_tag_put`]
1101#[derive(Debug, Clone, Serialize, Deserialize)]
1102#[serde(untagged)]
1103pub enum KeysKeyIdRestrictionsTagsTagPutError {
1104    Status400(),
1105    Status401(),
1106    Status403(),
1107    Status404(),
1108    Status406(),
1109    Status412(),
1110    UnknownValue(serde_json::Value),
1111}
1112
1113impl KeysKeyIdRestrictionsTagsTagPutError {
1114    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1115        // to do: support payloads once added to API spec
1116        match status {
1117            400 => Ok(Self::Status400()),
1118            401 => Ok(Self::Status401()),
1119            403 => Ok(Self::Status403()),
1120            404 => Ok(Self::Status404()),
1121            406 => Ok(Self::Status406()),
1122            412 => Ok(Self::Status412()),
1123            _ => {
1124                if data.is_empty() {
1125                    Ok(Self::UnknownValue(serde_json::Value::Null))
1126                } else {
1127                    serde_json::from_slice(data).map(Self::UnknownValue)
1128                }
1129            }
1130        }
1131    }
1132}
1133
1134/// struct for typed errors of method [`keys_key_id_sign_post`]
1135#[derive(Debug, Clone, Serialize, Deserialize)]
1136#[serde(untagged)]
1137pub enum KeysKeyIdSignPostError {
1138    Status400(),
1139    Status401(),
1140    Status403(),
1141    Status404(),
1142    Status406(),
1143    Status412(),
1144    UnknownValue(serde_json::Value),
1145}
1146
1147impl KeysKeyIdSignPostError {
1148    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1149        // to do: support payloads once added to API spec
1150        match status {
1151            400 => Ok(Self::Status400()),
1152            401 => Ok(Self::Status401()),
1153            403 => Ok(Self::Status403()),
1154            404 => Ok(Self::Status404()),
1155            406 => Ok(Self::Status406()),
1156            412 => Ok(Self::Status412()),
1157            _ => {
1158                if data.is_empty() {
1159                    Ok(Self::UnknownValue(serde_json::Value::Null))
1160                } else {
1161                    serde_json::from_slice(data).map(Self::UnknownValue)
1162                }
1163            }
1164        }
1165    }
1166}
1167
1168/// struct for typed errors of method [`keys_key_prefix_get`]
1169#[derive(Debug, Clone, Serialize, Deserialize)]
1170#[serde(untagged)]
1171pub enum KeysKeyPrefixGetError {
1172    Status401(),
1173    Status403(),
1174    Status406(),
1175    Status412(),
1176    UnknownValue(serde_json::Value),
1177}
1178
1179impl KeysKeyPrefixGetError {
1180    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1181        // to do: support payloads once added to API spec
1182        match status {
1183            401 => Ok(Self::Status401()),
1184            403 => Ok(Self::Status403()),
1185            406 => Ok(Self::Status406()),
1186            412 => Ok(Self::Status412()),
1187            _ => {
1188                if data.is_empty() {
1189                    Ok(Self::UnknownValue(serde_json::Value::Null))
1190                } else {
1191                    serde_json::from_slice(data).map(Self::UnknownValue)
1192                }
1193            }
1194        }
1195    }
1196}
1197
1198/// struct for typed errors of method [`keys_post`]
1199#[derive(Debug, Clone, Serialize, Deserialize)]
1200#[serde(untagged)]
1201pub enum KeysPostError {
1202    Status400(),
1203    Status401(),
1204    Status403(),
1205    Status406(),
1206    Status412(),
1207    UnknownValue(serde_json::Value),
1208}
1209
1210impl KeysPostError {
1211    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1212        // to do: support payloads once added to API spec
1213        match status {
1214            400 => Ok(Self::Status400()),
1215            401 => Ok(Self::Status401()),
1216            403 => Ok(Self::Status403()),
1217            406 => Ok(Self::Status406()),
1218            412 => Ok(Self::Status412()),
1219            _ => {
1220                if data.is_empty() {
1221                    Ok(Self::UnknownValue(serde_json::Value::Null))
1222                } else {
1223                    serde_json::from_slice(data).map(Self::UnknownValue)
1224                }
1225            }
1226        }
1227    }
1228}
1229
1230/// struct for typed errors of method [`lock_post`]
1231#[derive(Debug, Clone, Serialize, Deserialize)]
1232#[serde(untagged)]
1233pub enum LockPostError {
1234    Status401(),
1235    Status403(),
1236    Status406(),
1237    Status412(),
1238    UnknownValue(serde_json::Value),
1239}
1240
1241impl LockPostError {
1242    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1243        // to do: support payloads once added to API spec
1244        match status {
1245            401 => Ok(Self::Status401()),
1246            403 => Ok(Self::Status403()),
1247            406 => Ok(Self::Status406()),
1248            412 => Ok(Self::Status412()),
1249            _ => {
1250                if data.is_empty() {
1251                    Ok(Self::UnknownValue(serde_json::Value::Null))
1252                } else {
1253                    serde_json::from_slice(data).map(Self::UnknownValue)
1254                }
1255            }
1256        }
1257    }
1258}
1259
1260/// struct for typed errors of method [`metrics_get`]
1261#[derive(Debug, Clone, Serialize, Deserialize)]
1262#[serde(untagged)]
1263pub enum MetricsGetError {
1264    Status401(),
1265    Status403(),
1266    Status406(),
1267    Status412(),
1268    UnknownValue(serde_json::Value),
1269}
1270
1271impl MetricsGetError {
1272    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1273        // to do: support payloads once added to API spec
1274        match status {
1275            401 => Ok(Self::Status401()),
1276            403 => Ok(Self::Status403()),
1277            406 => Ok(Self::Status406()),
1278            412 => Ok(Self::Status412()),
1279            _ => {
1280                if data.is_empty() {
1281                    Ok(Self::UnknownValue(serde_json::Value::Null))
1282                } else {
1283                    serde_json::from_slice(data).map(Self::UnknownValue)
1284                }
1285            }
1286        }
1287    }
1288}
1289
1290/// struct for typed errors of method [`namespaces_get`]
1291#[derive(Debug, Clone, Serialize, Deserialize)]
1292#[serde(untagged)]
1293pub enum NamespacesGetError {
1294    Status401(),
1295    Status403(),
1296    Status406(),
1297    Status412(),
1298    UnknownValue(serde_json::Value),
1299}
1300
1301impl NamespacesGetError {
1302    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1303        // to do: support payloads once added to API spec
1304        match status {
1305            401 => Ok(Self::Status401()),
1306            403 => Ok(Self::Status403()),
1307            406 => Ok(Self::Status406()),
1308            412 => Ok(Self::Status412()),
1309            _ => {
1310                if data.is_empty() {
1311                    Ok(Self::UnknownValue(serde_json::Value::Null))
1312                } else {
1313                    serde_json::from_slice(data).map(Self::UnknownValue)
1314                }
1315            }
1316        }
1317    }
1318}
1319
1320/// struct for typed errors of method [`namespaces_namespace_id_delete`]
1321#[derive(Debug, Clone, Serialize, Deserialize)]
1322#[serde(untagged)]
1323pub enum NamespacesNamespaceIdDeleteError {
1324    Status400(),
1325    Status401(),
1326    Status403(),
1327    Status404(),
1328    Status412(),
1329    UnknownValue(serde_json::Value),
1330}
1331
1332impl NamespacesNamespaceIdDeleteError {
1333    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1334        // to do: support payloads once added to API spec
1335        match status {
1336            400 => Ok(Self::Status400()),
1337            401 => Ok(Self::Status401()),
1338            403 => Ok(Self::Status403()),
1339            404 => Ok(Self::Status404()),
1340            412 => Ok(Self::Status412()),
1341            _ => {
1342                if data.is_empty() {
1343                    Ok(Self::UnknownValue(serde_json::Value::Null))
1344                } else {
1345                    serde_json::from_slice(data).map(Self::UnknownValue)
1346                }
1347            }
1348        }
1349    }
1350}
1351
1352/// struct for typed errors of method [`namespaces_namespace_id_put`]
1353#[derive(Debug, Clone, Serialize, Deserialize)]
1354#[serde(untagged)]
1355pub enum NamespacesNamespaceIdPutError {
1356    Status400(),
1357    Status401(),
1358    Status403(),
1359    Status406(),
1360    Status409(),
1361    Status412(),
1362    UnknownValue(serde_json::Value),
1363}
1364
1365impl NamespacesNamespaceIdPutError {
1366    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1367        // to do: support payloads once added to API spec
1368        match status {
1369            400 => Ok(Self::Status400()),
1370            401 => Ok(Self::Status401()),
1371            403 => Ok(Self::Status403()),
1372            406 => Ok(Self::Status406()),
1373            409 => Ok(Self::Status409()),
1374            412 => Ok(Self::Status412()),
1375            _ => {
1376                if data.is_empty() {
1377                    Ok(Self::UnknownValue(serde_json::Value::Null))
1378                } else {
1379                    serde_json::from_slice(data).map(Self::UnknownValue)
1380                }
1381            }
1382        }
1383    }
1384}
1385
1386/// struct for typed errors of method [`provision_post`]
1387#[derive(Debug, Clone, Serialize, Deserialize)]
1388#[serde(untagged)]
1389pub enum ProvisionPostError {
1390    Status400(),
1391    Status406(),
1392    Status412(),
1393    UnknownValue(serde_json::Value),
1394}
1395
1396impl ProvisionPostError {
1397    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1398        // to do: support payloads once added to API spec
1399        match status {
1400            400 => Ok(Self::Status400()),
1401            406 => Ok(Self::Status406()),
1402            412 => Ok(Self::Status412()),
1403            _ => {
1404                if data.is_empty() {
1405                    Ok(Self::UnknownValue(serde_json::Value::Null))
1406                } else {
1407                    serde_json::from_slice(data).map(Self::UnknownValue)
1408                }
1409            }
1410        }
1411    }
1412}
1413
1414/// struct for typed errors of method [`random_post`]
1415#[derive(Debug, Clone, Serialize, Deserialize)]
1416#[serde(untagged)]
1417pub enum RandomPostError {
1418    Status400(),
1419    Status401(),
1420    Status403(),
1421    Status406(),
1422    Status412(),
1423    UnknownValue(serde_json::Value),
1424}
1425
1426impl RandomPostError {
1427    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1428        // to do: support payloads once added to API spec
1429        match status {
1430            400 => Ok(Self::Status400()),
1431            401 => Ok(Self::Status401()),
1432            403 => Ok(Self::Status403()),
1433            406 => Ok(Self::Status406()),
1434            412 => Ok(Self::Status412()),
1435            _ => {
1436                if data.is_empty() {
1437                    Ok(Self::UnknownValue(serde_json::Value::Null))
1438                } else {
1439                    serde_json::from_slice(data).map(Self::UnknownValue)
1440                }
1441            }
1442        }
1443    }
1444}
1445
1446/// struct for typed errors of method [`system_backup_post`]
1447#[derive(Debug, Clone, Serialize, Deserialize)]
1448#[serde(untagged)]
1449pub enum SystemBackupPostError {
1450    Status401(),
1451    Status403(),
1452    Status406(),
1453    Status412(),
1454    UnknownValue(serde_json::Value),
1455}
1456
1457impl SystemBackupPostError {
1458    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1459        // to do: support payloads once added to API spec
1460        match status {
1461            401 => Ok(Self::Status401()),
1462            403 => Ok(Self::Status403()),
1463            406 => Ok(Self::Status406()),
1464            412 => Ok(Self::Status412()),
1465            _ => {
1466                if data.is_empty() {
1467                    Ok(Self::UnknownValue(serde_json::Value::Null))
1468                } else {
1469                    serde_json::from_slice(data).map(Self::UnknownValue)
1470                }
1471            }
1472        }
1473    }
1474}
1475
1476/// struct for typed errors of method [`system_cancel_update_post`]
1477#[derive(Debug, Clone, Serialize, Deserialize)]
1478#[serde(untagged)]
1479pub enum SystemCancelUpdatePostError {
1480    Status401(),
1481    Status403(),
1482    Status406(),
1483    Status412(),
1484    UnknownValue(serde_json::Value),
1485}
1486
1487impl SystemCancelUpdatePostError {
1488    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1489        // to do: support payloads once added to API spec
1490        match status {
1491            401 => Ok(Self::Status401()),
1492            403 => Ok(Self::Status403()),
1493            406 => Ok(Self::Status406()),
1494            412 => Ok(Self::Status412()),
1495            _ => {
1496                if data.is_empty() {
1497                    Ok(Self::UnknownValue(serde_json::Value::Null))
1498                } else {
1499                    serde_json::from_slice(data).map(Self::UnknownValue)
1500                }
1501            }
1502        }
1503    }
1504}
1505
1506/// struct for typed errors of method [`system_commit_update_post`]
1507#[derive(Debug, Clone, Serialize, Deserialize)]
1508#[serde(untagged)]
1509pub enum SystemCommitUpdatePostError {
1510    Status401(),
1511    Status403(),
1512    Status406(),
1513    Status412(),
1514    UnknownValue(serde_json::Value),
1515}
1516
1517impl SystemCommitUpdatePostError {
1518    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1519        // to do: support payloads once added to API spec
1520        match status {
1521            401 => Ok(Self::Status401()),
1522            403 => Ok(Self::Status403()),
1523            406 => Ok(Self::Status406()),
1524            412 => Ok(Self::Status412()),
1525            _ => {
1526                if data.is_empty() {
1527                    Ok(Self::UnknownValue(serde_json::Value::Null))
1528                } else {
1529                    serde_json::from_slice(data).map(Self::UnknownValue)
1530                }
1531            }
1532        }
1533    }
1534}
1535
1536/// struct for typed errors of method [`system_factory_reset_post`]
1537#[derive(Debug, Clone, Serialize, Deserialize)]
1538#[serde(untagged)]
1539pub enum SystemFactoryResetPostError {
1540    Status401(),
1541    Status403(),
1542    Status406(),
1543    Status412(),
1544    UnknownValue(serde_json::Value),
1545}
1546
1547impl SystemFactoryResetPostError {
1548    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1549        // to do: support payloads once added to API spec
1550        match status {
1551            401 => Ok(Self::Status401()),
1552            403 => Ok(Self::Status403()),
1553            406 => Ok(Self::Status406()),
1554            412 => Ok(Self::Status412()),
1555            _ => {
1556                if data.is_empty() {
1557                    Ok(Self::UnknownValue(serde_json::Value::Null))
1558                } else {
1559                    serde_json::from_slice(data).map(Self::UnknownValue)
1560                }
1561            }
1562        }
1563    }
1564}
1565
1566/// struct for typed errors of method [`system_info_get`]
1567#[derive(Debug, Clone, Serialize, Deserialize)]
1568#[serde(untagged)]
1569pub enum SystemInfoGetError {
1570    Status401(),
1571    Status403(),
1572    Status406(),
1573    Status412(),
1574    UnknownValue(serde_json::Value),
1575}
1576
1577impl SystemInfoGetError {
1578    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1579        // to do: support payloads once added to API spec
1580        match status {
1581            401 => Ok(Self::Status401()),
1582            403 => Ok(Self::Status403()),
1583            406 => Ok(Self::Status406()),
1584            412 => Ok(Self::Status412()),
1585            _ => {
1586                if data.is_empty() {
1587                    Ok(Self::UnknownValue(serde_json::Value::Null))
1588                } else {
1589                    serde_json::from_slice(data).map(Self::UnknownValue)
1590                }
1591            }
1592        }
1593    }
1594}
1595
1596/// struct for typed errors of method [`system_reboot_post`]
1597#[derive(Debug, Clone, Serialize, Deserialize)]
1598#[serde(untagged)]
1599pub enum SystemRebootPostError {
1600    Status401(),
1601    Status403(),
1602    Status406(),
1603    Status412(),
1604    UnknownValue(serde_json::Value),
1605}
1606
1607impl SystemRebootPostError {
1608    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1609        // to do: support payloads once added to API spec
1610        match status {
1611            401 => Ok(Self::Status401()),
1612            403 => Ok(Self::Status403()),
1613            406 => Ok(Self::Status406()),
1614            412 => Ok(Self::Status412()),
1615            _ => {
1616                if data.is_empty() {
1617                    Ok(Self::UnknownValue(serde_json::Value::Null))
1618                } else {
1619                    serde_json::from_slice(data).map(Self::UnknownValue)
1620                }
1621            }
1622        }
1623    }
1624}
1625
1626/// struct for typed errors of method [`system_restore_post`]
1627#[derive(Debug, Clone, Serialize, Deserialize)]
1628#[serde(untagged)]
1629pub enum SystemRestorePostError {
1630    Status400(),
1631    Status406(),
1632    Status412(),
1633    UnknownValue(serde_json::Value),
1634}
1635
1636impl SystemRestorePostError {
1637    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1638        // to do: support payloads once added to API spec
1639        match status {
1640            400 => Ok(Self::Status400()),
1641            406 => Ok(Self::Status406()),
1642            412 => Ok(Self::Status412()),
1643            _ => {
1644                if data.is_empty() {
1645                    Ok(Self::UnknownValue(serde_json::Value::Null))
1646                } else {
1647                    serde_json::from_slice(data).map(Self::UnknownValue)
1648                }
1649            }
1650        }
1651    }
1652}
1653
1654/// struct for typed errors of method [`system_shutdown_post`]
1655#[derive(Debug, Clone, Serialize, Deserialize)]
1656#[serde(untagged)]
1657pub enum SystemShutdownPostError {
1658    Status401(),
1659    Status403(),
1660    Status406(),
1661    UnknownValue(serde_json::Value),
1662}
1663
1664impl SystemShutdownPostError {
1665    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1666        // to do: support payloads once added to API spec
1667        match status {
1668            401 => Ok(Self::Status401()),
1669            403 => Ok(Self::Status403()),
1670            406 => Ok(Self::Status406()),
1671            _ => {
1672                if data.is_empty() {
1673                    Ok(Self::UnknownValue(serde_json::Value::Null))
1674                } else {
1675                    serde_json::from_slice(data).map(Self::UnknownValue)
1676                }
1677            }
1678        }
1679    }
1680}
1681
1682/// struct for typed errors of method [`system_update_post`]
1683#[derive(Debug, Clone, Serialize, Deserialize)]
1684#[serde(untagged)]
1685pub enum SystemUpdatePostError {
1686    Status400(),
1687    Status401(),
1688    Status403(),
1689    Status406(),
1690    Status409(),
1691    Status412(),
1692    UnknownValue(serde_json::Value),
1693}
1694
1695impl SystemUpdatePostError {
1696    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1697        // to do: support payloads once added to API spec
1698        match status {
1699            400 => Ok(Self::Status400()),
1700            401 => Ok(Self::Status401()),
1701            403 => Ok(Self::Status403()),
1702            406 => Ok(Self::Status406()),
1703            409 => Ok(Self::Status409()),
1704            412 => Ok(Self::Status412()),
1705            _ => {
1706                if data.is_empty() {
1707                    Ok(Self::UnknownValue(serde_json::Value::Null))
1708                } else {
1709                    serde_json::from_slice(data).map(Self::UnknownValue)
1710                }
1711            }
1712        }
1713    }
1714}
1715
1716/// struct for typed errors of method [`unlock_post`]
1717#[derive(Debug, Clone, Serialize, Deserialize)]
1718#[serde(untagged)]
1719pub enum UnlockPostError {
1720    Status400(),
1721    Status403(),
1722    Status406(),
1723    Status412(),
1724    UnknownValue(serde_json::Value),
1725}
1726
1727impl UnlockPostError {
1728    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1729        // to do: support payloads once added to API spec
1730        match status {
1731            400 => Ok(Self::Status400()),
1732            403 => Ok(Self::Status403()),
1733            406 => Ok(Self::Status406()),
1734            412 => Ok(Self::Status412()),
1735            _ => {
1736                if data.is_empty() {
1737                    Ok(Self::UnknownValue(serde_json::Value::Null))
1738                } else {
1739                    serde_json::from_slice(data).map(Self::UnknownValue)
1740                }
1741            }
1742        }
1743    }
1744}
1745
1746/// struct for typed errors of method [`users_get`]
1747#[derive(Debug, Clone, Serialize, Deserialize)]
1748#[serde(untagged)]
1749pub enum UsersGetError {
1750    Status401(),
1751    Status403(),
1752    Status406(),
1753    Status412(),
1754    UnknownValue(serde_json::Value),
1755}
1756
1757impl UsersGetError {
1758    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1759        // to do: support payloads once added to API spec
1760        match status {
1761            401 => Ok(Self::Status401()),
1762            403 => Ok(Self::Status403()),
1763            406 => Ok(Self::Status406()),
1764            412 => Ok(Self::Status412()),
1765            _ => {
1766                if data.is_empty() {
1767                    Ok(Self::UnknownValue(serde_json::Value::Null))
1768                } else {
1769                    serde_json::from_slice(data).map(Self::UnknownValue)
1770                }
1771            }
1772        }
1773    }
1774}
1775
1776/// struct for typed errors of method [`users_post`]
1777#[derive(Debug, Clone, Serialize, Deserialize)]
1778#[serde(untagged)]
1779pub enum UsersPostError {
1780    Status400(),
1781    Status401(),
1782    Status403(),
1783    Status406(),
1784    Status412(),
1785    UnknownValue(serde_json::Value),
1786}
1787
1788impl UsersPostError {
1789    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1790        // to do: support payloads once added to API spec
1791        match status {
1792            400 => Ok(Self::Status400()),
1793            401 => Ok(Self::Status401()),
1794            403 => Ok(Self::Status403()),
1795            406 => Ok(Self::Status406()),
1796            412 => Ok(Self::Status412()),
1797            _ => {
1798                if data.is_empty() {
1799                    Ok(Self::UnknownValue(serde_json::Value::Null))
1800                } else {
1801                    serde_json::from_slice(data).map(Self::UnknownValue)
1802                }
1803            }
1804        }
1805    }
1806}
1807
1808/// struct for typed errors of method [`users_user_id_delete`]
1809#[derive(Debug, Clone, Serialize, Deserialize)]
1810#[serde(untagged)]
1811pub enum UsersUserIdDeleteError {
1812    Status400(),
1813    Status401(),
1814    Status403(),
1815    Status404(),
1816    Status406(),
1817    Status412(),
1818    UnknownValue(serde_json::Value),
1819}
1820
1821impl UsersUserIdDeleteError {
1822    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1823        // to do: support payloads once added to API spec
1824        match status {
1825            400 => Ok(Self::Status400()),
1826            401 => Ok(Self::Status401()),
1827            403 => Ok(Self::Status403()),
1828            404 => Ok(Self::Status404()),
1829            406 => Ok(Self::Status406()),
1830            412 => Ok(Self::Status412()),
1831            _ => {
1832                if data.is_empty() {
1833                    Ok(Self::UnknownValue(serde_json::Value::Null))
1834                } else {
1835                    serde_json::from_slice(data).map(Self::UnknownValue)
1836                }
1837            }
1838        }
1839    }
1840}
1841
1842/// struct for typed errors of method [`users_user_id_get`]
1843#[derive(Debug, Clone, Serialize, Deserialize)]
1844#[serde(untagged)]
1845pub enum UsersUserIdGetError {
1846    Status400(),
1847    Status401(),
1848    Status403(),
1849    Status404(),
1850    Status406(),
1851    Status412(),
1852    UnknownValue(serde_json::Value),
1853}
1854
1855impl UsersUserIdGetError {
1856    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1857        // to do: support payloads once added to API spec
1858        match status {
1859            400 => Ok(Self::Status400()),
1860            401 => Ok(Self::Status401()),
1861            403 => Ok(Self::Status403()),
1862            404 => Ok(Self::Status404()),
1863            406 => Ok(Self::Status406()),
1864            412 => Ok(Self::Status412()),
1865            _ => {
1866                if data.is_empty() {
1867                    Ok(Self::UnknownValue(serde_json::Value::Null))
1868                } else {
1869                    serde_json::from_slice(data).map(Self::UnknownValue)
1870                }
1871            }
1872        }
1873    }
1874}
1875
1876/// struct for typed errors of method [`users_user_id_passphrase_post`]
1877#[derive(Debug, Clone, Serialize, Deserialize)]
1878#[serde(untagged)]
1879pub enum UsersUserIdPassphrasePostError {
1880    Status400(),
1881    Status401(),
1882    Status403(),
1883    Status404(),
1884    Status406(),
1885    Status412(),
1886    UnknownValue(serde_json::Value),
1887}
1888
1889impl UsersUserIdPassphrasePostError {
1890    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1891        // to do: support payloads once added to API spec
1892        match status {
1893            400 => Ok(Self::Status400()),
1894            401 => Ok(Self::Status401()),
1895            403 => Ok(Self::Status403()),
1896            404 => Ok(Self::Status404()),
1897            406 => Ok(Self::Status406()),
1898            412 => Ok(Self::Status412()),
1899            _ => {
1900                if data.is_empty() {
1901                    Ok(Self::UnknownValue(serde_json::Value::Null))
1902                } else {
1903                    serde_json::from_slice(data).map(Self::UnknownValue)
1904                }
1905            }
1906        }
1907    }
1908}
1909
1910/// struct for typed errors of method [`users_user_id_post`]
1911#[derive(Debug, Clone, Serialize, Deserialize)]
1912#[serde(untagged)]
1913pub enum UsersUserIdPostError {
1914    Status400(),
1915    Status401(),
1916    Status403(),
1917    Status406(),
1918    Status412(),
1919    UnknownValue(serde_json::Value),
1920}
1921
1922impl UsersUserIdPostError {
1923    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1924        // to do: support payloads once added to API spec
1925        match status {
1926            400 => Ok(Self::Status400()),
1927            401 => Ok(Self::Status401()),
1928            403 => Ok(Self::Status403()),
1929            406 => Ok(Self::Status406()),
1930            412 => Ok(Self::Status412()),
1931            _ => {
1932                if data.is_empty() {
1933                    Ok(Self::UnknownValue(serde_json::Value::Null))
1934                } else {
1935                    serde_json::from_slice(data).map(Self::UnknownValue)
1936                }
1937            }
1938        }
1939    }
1940}
1941
1942/// struct for typed errors of method [`users_user_id_put`]
1943#[derive(Debug, Clone, Serialize, Deserialize)]
1944#[serde(untagged)]
1945pub enum UsersUserIdPutError {
1946    Status400(),
1947    Status401(),
1948    Status403(),
1949    Status406(),
1950    Status409(),
1951    Status412(),
1952    UnknownValue(serde_json::Value),
1953}
1954
1955impl UsersUserIdPutError {
1956    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1957        // to do: support payloads once added to API spec
1958        match status {
1959            400 => Ok(Self::Status400()),
1960            401 => Ok(Self::Status401()),
1961            403 => Ok(Self::Status403()),
1962            406 => Ok(Self::Status406()),
1963            409 => Ok(Self::Status409()),
1964            412 => Ok(Self::Status412()),
1965            _ => {
1966                if data.is_empty() {
1967                    Ok(Self::UnknownValue(serde_json::Value::Null))
1968                } else {
1969                    serde_json::from_slice(data).map(Self::UnknownValue)
1970                }
1971            }
1972        }
1973    }
1974}
1975
1976/// struct for typed errors of method [`users_user_id_tags_get`]
1977#[derive(Debug, Clone, Serialize, Deserialize)]
1978#[serde(untagged)]
1979pub enum UsersUserIdTagsGetError {
1980    Status400(),
1981    Status401(),
1982    Status403(),
1983    Status404(),
1984    Status406(),
1985    Status412(),
1986    UnknownValue(serde_json::Value),
1987}
1988
1989impl UsersUserIdTagsGetError {
1990    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1991        // to do: support payloads once added to API spec
1992        match status {
1993            400 => Ok(Self::Status400()),
1994            401 => Ok(Self::Status401()),
1995            403 => Ok(Self::Status403()),
1996            404 => Ok(Self::Status404()),
1997            406 => Ok(Self::Status406()),
1998            412 => Ok(Self::Status412()),
1999            _ => {
2000                if data.is_empty() {
2001                    Ok(Self::UnknownValue(serde_json::Value::Null))
2002                } else {
2003                    serde_json::from_slice(data).map(Self::UnknownValue)
2004                }
2005            }
2006        }
2007    }
2008}
2009
2010/// struct for typed errors of method [`users_user_id_tags_tag_delete`]
2011#[derive(Debug, Clone, Serialize, Deserialize)]
2012#[serde(untagged)]
2013pub enum UsersUserIdTagsTagDeleteError {
2014    Status401(),
2015    Status403(),
2016    Status404(),
2017    Status406(),
2018    Status412(),
2019    UnknownValue(serde_json::Value),
2020}
2021
2022impl UsersUserIdTagsTagDeleteError {
2023    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
2024        // to do: support payloads once added to API spec
2025        match status {
2026            401 => Ok(Self::Status401()),
2027            403 => Ok(Self::Status403()),
2028            404 => Ok(Self::Status404()),
2029            406 => Ok(Self::Status406()),
2030            412 => Ok(Self::Status412()),
2031            _ => {
2032                if data.is_empty() {
2033                    Ok(Self::UnknownValue(serde_json::Value::Null))
2034                } else {
2035                    serde_json::from_slice(data).map(Self::UnknownValue)
2036                }
2037            }
2038        }
2039    }
2040}
2041
2042/// struct for typed errors of method [`users_user_id_tags_tag_put`]
2043#[derive(Debug, Clone, Serialize, Deserialize)]
2044#[serde(untagged)]
2045pub enum UsersUserIdTagsTagPutError {
2046    Status400(),
2047    Status401(),
2048    Status403(),
2049    Status404(),
2050    Status406(),
2051    Status412(),
2052    UnknownValue(serde_json::Value),
2053}
2054
2055impl UsersUserIdTagsTagPutError {
2056    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
2057        // to do: support payloads once added to API spec
2058        match status {
2059            400 => Ok(Self::Status400()),
2060            401 => Ok(Self::Status401()),
2061            403 => Ok(Self::Status403()),
2062            404 => Ok(Self::Status404()),
2063            406 => Ok(Self::Status406()),
2064            412 => Ok(Self::Status412()),
2065            _ => {
2066                if data.is_empty() {
2067                    Ok(Self::UnknownValue(serde_json::Value::Null))
2068                } else {
2069                    serde_json::from_slice(data).map(Self::UnknownValue)
2070                }
2071            }
2072        }
2073    }
2074}
2075
2076/// Update the backup passphrase. If the backup passphrase is not set yet, use \"\" as currentPassphrase.  *WARNING:* Like the unlock passphrase, this configuration can't be reset by an admin user without knowing the current value, so if the backup passphrase is lost, neither can it be reset to a new value nor can the created backups be restored.
2077pub fn config_backup_passphrase_put(
2078    configuration: &configuration::Configuration,
2079    backup_passphrase_config: crate::models::BackupPassphraseConfig,
2080) -> Result<ResponseContent<()>, Error<ConfigBackupPassphrasePutError>> {
2081    let local_var_configuration = configuration;
2082
2083    let local_var_client = &local_var_configuration.client;
2084
2085    let local_var_uri_str = format!(
2086        "{}/config/backup-passphrase",
2087        local_var_configuration.base_path
2088    );
2089    let mut local_var_req_builder =
2090        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2091    local_var_req_builder = local_var_req_builder
2092        .config()
2093        .http_status_as_error(false)
2094        .build();
2095
2096    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2097        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2098    }
2099    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2100        let value = super::basic_auth(local_var_auth_conf);
2101
2102        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2103    };
2104
2105    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2106    let local_var_result = local_var_req_builder.send_json(backup_passphrase_config);
2107
2108    let local_var_resp = local_var_result?;
2109
2110    let local_var_status = local_var_resp.status().as_u16();
2111    if local_var_status < 400 {
2112        ResponseContent::unit(local_var_resp)
2113    } else {
2114        ResponseContent::new(local_var_resp, |data| {
2115            ConfigBackupPassphrasePutError::new(local_var_status, data).map_err(From::from)
2116        })
2117        .and_then(|content| Err(Error::ResponseError(content)))
2118    }
2119}
2120
2121/// Get logging configuration. Protocol is always syslog over UDP. Configurable are IP adress and port, log level.
2122pub fn config_logging_get(
2123    configuration: &configuration::Configuration,
2124) -> Result<ResponseContent<crate::models::LoggingConfig>, Error<ConfigLoggingGetError>> {
2125    let local_var_configuration = configuration;
2126
2127    let local_var_client = &local_var_configuration.client;
2128
2129    let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path);
2130    let mut local_var_req_builder =
2131        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2132    local_var_req_builder = local_var_req_builder
2133        .config()
2134        .http_status_as_error(false)
2135        .build();
2136
2137    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2138        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2139    }
2140    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2141        let value = super::basic_auth(local_var_auth_conf);
2142
2143        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2144    };
2145    let accept_str = "application/json";
2146    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2147
2148    let local_var_result = local_var_req_builder.send_empty();
2149
2150    let local_var_resp = local_var_result?;
2151
2152    let local_var_status = local_var_resp.status().as_u16();
2153    if local_var_status < 400 {
2154        ResponseContent::deserialized(local_var_resp)
2155    } else {
2156        ResponseContent::new(local_var_resp, |data| {
2157            ConfigLoggingGetError::new(local_var_status, data).map_err(From::from)
2158        })
2159        .and_then(|content| Err(Error::ResponseError(content)))
2160    }
2161}
2162
2163/// Configure log level and destination.
2164pub fn config_logging_put(
2165    configuration: &configuration::Configuration,
2166    logging_config: crate::models::LoggingConfig,
2167) -> Result<ResponseContent<()>, Error<ConfigLoggingPutError>> {
2168    let local_var_configuration = configuration;
2169
2170    let local_var_client = &local_var_configuration.client;
2171
2172    let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path);
2173    let mut local_var_req_builder =
2174        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2175    local_var_req_builder = local_var_req_builder
2176        .config()
2177        .http_status_as_error(false)
2178        .build();
2179
2180    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2181        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2182    }
2183    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2184        let value = super::basic_auth(local_var_auth_conf);
2185
2186        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2187    };
2188
2189    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2190    let local_var_result = local_var_req_builder.send_json(logging_config);
2191
2192    let local_var_resp = local_var_result?;
2193
2194    let local_var_status = local_var_resp.status().as_u16();
2195    if local_var_status < 400 {
2196        ResponseContent::unit(local_var_resp)
2197    } else {
2198        ResponseContent::new(local_var_resp, |data| {
2199            ConfigLoggingPutError::new(local_var_status, data).map_err(From::from)
2200        })
2201        .and_then(|content| Err(Error::ResponseError(content)))
2202    }
2203}
2204
2205/// Get network configuration. IP address, netmask, router.
2206pub fn config_network_get(
2207    configuration: &configuration::Configuration,
2208) -> Result<ResponseContent<crate::models::NetworkConfig>, Error<ConfigNetworkGetError>> {
2209    let local_var_configuration = configuration;
2210
2211    let local_var_client = &local_var_configuration.client;
2212
2213    let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path);
2214    let mut local_var_req_builder =
2215        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2216    local_var_req_builder = local_var_req_builder
2217        .config()
2218        .http_status_as_error(false)
2219        .build();
2220
2221    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2222        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2223    }
2224    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2225        let value = super::basic_auth(local_var_auth_conf);
2226
2227        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2228    };
2229    let accept_str = "application/json";
2230    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2231
2232    let local_var_result = local_var_req_builder.send_empty();
2233
2234    let local_var_resp = local_var_result?;
2235
2236    let local_var_status = local_var_resp.status().as_u16();
2237    if local_var_status < 400 {
2238        ResponseContent::deserialized(local_var_resp)
2239    } else {
2240        ResponseContent::new(local_var_resp, |data| {
2241            ConfigNetworkGetError::new(local_var_status, data).map_err(From::from)
2242        })
2243        .and_then(|content| Err(Error::ResponseError(content)))
2244    }
2245}
2246
2247/// Configure network.
2248pub fn config_network_put(
2249    configuration: &configuration::Configuration,
2250    network_config: crate::models::NetworkConfig,
2251) -> Result<ResponseContent<()>, Error<ConfigNetworkPutError>> {
2252    let local_var_configuration = configuration;
2253
2254    let local_var_client = &local_var_configuration.client;
2255
2256    let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path);
2257    let mut local_var_req_builder =
2258        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2259    local_var_req_builder = local_var_req_builder
2260        .config()
2261        .http_status_as_error(false)
2262        .build();
2263
2264    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2265        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2266    }
2267    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2268        let value = super::basic_auth(local_var_auth_conf);
2269
2270        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2271    };
2272
2273    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2274    let local_var_result = local_var_req_builder.send_json(network_config);
2275
2276    let local_var_resp = local_var_result?;
2277
2278    let local_var_status = local_var_resp.status().as_u16();
2279    if local_var_status < 400 {
2280        ResponseContent::unit(local_var_resp)
2281    } else {
2282        ResponseContent::new(local_var_resp, |data| {
2283            ConfigNetworkPutError::new(local_var_status, data).map_err(From::from)
2284        })
2285        .and_then(|content| Err(Error::ResponseError(content)))
2286    }
2287}
2288
2289/// Get system time.
2290pub fn config_time_get(
2291    configuration: &configuration::Configuration,
2292) -> Result<ResponseContent<crate::models::TimeConfig>, Error<ConfigTimeGetError>> {
2293    let local_var_configuration = configuration;
2294
2295    let local_var_client = &local_var_configuration.client;
2296
2297    let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path);
2298    let mut local_var_req_builder =
2299        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2300    local_var_req_builder = local_var_req_builder
2301        .config()
2302        .http_status_as_error(false)
2303        .build();
2304
2305    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2306        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2307    }
2308    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2309        let value = super::basic_auth(local_var_auth_conf);
2310
2311        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2312    };
2313    let accept_str = "application/json";
2314    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2315
2316    let local_var_result = local_var_req_builder.send_empty();
2317
2318    let local_var_resp = local_var_result?;
2319
2320    let local_var_status = local_var_resp.status().as_u16();
2321    if local_var_status < 400 {
2322        ResponseContent::deserialized(local_var_resp)
2323    } else {
2324        ResponseContent::new(local_var_resp, |data| {
2325            ConfigTimeGetError::new(local_var_status, data).map_err(From::from)
2326        })
2327        .and_then(|content| Err(Error::ResponseError(content)))
2328    }
2329}
2330
2331/// Configure system time.
2332pub fn config_time_put(
2333    configuration: &configuration::Configuration,
2334    time_config: crate::models::TimeConfig,
2335) -> Result<ResponseContent<()>, Error<ConfigTimePutError>> {
2336    let local_var_configuration = configuration;
2337
2338    let local_var_client = &local_var_configuration.client;
2339
2340    let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path);
2341    let mut local_var_req_builder =
2342        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2343    local_var_req_builder = local_var_req_builder
2344        .config()
2345        .http_status_as_error(false)
2346        .build();
2347
2348    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2349        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2350    }
2351    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2352        let value = super::basic_auth(local_var_auth_conf);
2353
2354        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2355    };
2356
2357    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2358    let local_var_result = local_var_req_builder.send_json(time_config);
2359
2360    let local_var_resp = local_var_result?;
2361
2362    let local_var_status = local_var_resp.status().as_u16();
2363    if local_var_status < 400 {
2364        ResponseContent::unit(local_var_resp)
2365    } else {
2366        ResponseContent::new(local_var_resp, |data| {
2367            ConfigTimePutError::new(local_var_status, data).map_err(From::from)
2368        })
2369        .and_then(|content| Err(Error::ResponseError(content)))
2370    }
2371}
2372
2373/// Get certificate for NetHSMs https API.
2374pub fn config_tls_cert_pem_get(
2375    configuration: &configuration::Configuration,
2376) -> Result<ResponseContent<String>, Error<ConfigTlsCertPemGetError>> {
2377    let local_var_configuration = configuration;
2378
2379    let local_var_client = &local_var_configuration.client;
2380
2381    let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path);
2382    let mut local_var_req_builder =
2383        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2384    local_var_req_builder = local_var_req_builder
2385        .config()
2386        .http_status_as_error(false)
2387        .build();
2388
2389    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2390        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2391    }
2392    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2393        let value = super::basic_auth(local_var_auth_conf);
2394
2395        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2396    };
2397    let accept_str = "application/x-pem-file";
2398    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2399
2400    let local_var_result = local_var_req_builder.send_empty();
2401
2402    let local_var_resp = local_var_result?;
2403
2404    let local_var_status = local_var_resp.status().as_u16();
2405    if local_var_status < 400 {
2406        ResponseContent::string(local_var_resp)
2407    } else {
2408        ResponseContent::new(local_var_resp, |data| {
2409            ConfigTlsCertPemGetError::new(local_var_status, data).map_err(From::from)
2410        })
2411        .and_then(|content| Err(Error::ResponseError(content)))
2412    }
2413}
2414
2415/// Set certificate for NetHSMs https API e.g. to replace self-signed intital certificate.
2416pub fn config_tls_cert_pem_put(
2417    configuration: &configuration::Configuration,
2418    body: &str,
2419) -> Result<ResponseContent<()>, Error<ConfigTlsCertPemPutError>> {
2420    let local_var_configuration = configuration;
2421
2422    let local_var_client = &local_var_configuration.client;
2423
2424    let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path);
2425    let mut local_var_req_builder =
2426        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2427    local_var_req_builder = local_var_req_builder
2428        .config()
2429        .http_status_as_error(false)
2430        .build();
2431
2432    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2433        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2434    }
2435    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2436        let value = super::basic_auth(local_var_auth_conf);
2437
2438        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2439    };
2440
2441    local_var_req_builder = local_var_req_builder.header("content-type", "application/x-pem-file");
2442    let local_var_result = local_var_req_builder.send(body);
2443
2444    let local_var_resp = local_var_result?;
2445
2446    let local_var_status = local_var_resp.status().as_u16();
2447    if local_var_status < 400 {
2448        ResponseContent::unit(local_var_resp)
2449    } else {
2450        ResponseContent::new(local_var_resp, |data| {
2451            ConfigTlsCertPemPutError::new(local_var_status, data).map_err(From::from)
2452        })
2453        .and_then(|content| Err(Error::ResponseError(content)))
2454    }
2455}
2456
2457/// Get NetHSM certificate signing request e.g. to replace self-signed intital certificate.
2458pub fn config_tls_csr_pem_post(
2459    configuration: &configuration::Configuration,
2460    distinguished_name: crate::models::DistinguishedName,
2461) -> Result<ResponseContent<String>, Error<ConfigTlsCsrPemPostError>> {
2462    let local_var_configuration = configuration;
2463
2464    let local_var_client = &local_var_configuration.client;
2465
2466    let local_var_uri_str = format!("{}/config/tls/csr.pem", local_var_configuration.base_path);
2467    let mut local_var_req_builder =
2468        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2469    local_var_req_builder = local_var_req_builder
2470        .config()
2471        .http_status_as_error(false)
2472        .build();
2473
2474    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2475        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2476    }
2477    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2478        let value = super::basic_auth(local_var_auth_conf);
2479
2480        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2481    };
2482    let accept_str = "application/x-pem-file";
2483    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2484
2485    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2486    let local_var_result = local_var_req_builder.send_json(distinguished_name);
2487
2488    let local_var_resp = local_var_result?;
2489
2490    let local_var_status = local_var_resp.status().as_u16();
2491    if local_var_status < 400 {
2492        ResponseContent::string(local_var_resp)
2493    } else {
2494        ResponseContent::new(local_var_resp, |data| {
2495            ConfigTlsCsrPemPostError::new(local_var_status, data).map_err(From::from)
2496        })
2497        .and_then(|content| Err(Error::ResponseError(content)))
2498    }
2499}
2500
2501/// Generate a new pair of public and private key for NetHSM's https API.
2502pub fn config_tls_generate_post(
2503    configuration: &configuration::Configuration,
2504    tls_key_generate_request_data: crate::models::TlsKeyGenerateRequestData,
2505) -> Result<ResponseContent<()>, Error<ConfigTlsGeneratePostError>> {
2506    let local_var_configuration = configuration;
2507
2508    let local_var_client = &local_var_configuration.client;
2509
2510    let local_var_uri_str = format!("{}/config/tls/generate", local_var_configuration.base_path);
2511    let mut local_var_req_builder =
2512        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2513    local_var_req_builder = local_var_req_builder
2514        .config()
2515        .http_status_as_error(false)
2516        .build();
2517
2518    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2519        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2520    }
2521    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2522        let value = super::basic_auth(local_var_auth_conf);
2523
2524        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2525    };
2526
2527    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2528    let local_var_result = local_var_req_builder.send_json(tls_key_generate_request_data);
2529
2530    let local_var_resp = local_var_result?;
2531
2532    let local_var_status = local_var_resp.status().as_u16();
2533    if local_var_status < 400 {
2534        ResponseContent::unit(local_var_resp)
2535    } else {
2536        ResponseContent::new(local_var_resp, |data| {
2537            ConfigTlsGeneratePostError::new(local_var_status, data).map_err(From::from)
2538        })
2539        .and_then(|content| Err(Error::ResponseError(content)))
2540    }
2541}
2542
2543/// Get public key for NetHSMs https API.
2544pub fn config_tls_public_pem_get(
2545    configuration: &configuration::Configuration,
2546) -> Result<ResponseContent<String>, Error<ConfigTlsPublicPemGetError>> {
2547    let local_var_configuration = configuration;
2548
2549    let local_var_client = &local_var_configuration.client;
2550
2551    let local_var_uri_str = format!(
2552        "{}/config/tls/public.pem",
2553        local_var_configuration.base_path
2554    );
2555    let mut local_var_req_builder =
2556        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2557    local_var_req_builder = local_var_req_builder
2558        .config()
2559        .http_status_as_error(false)
2560        .build();
2561
2562    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2563        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2564    }
2565    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2566        let value = super::basic_auth(local_var_auth_conf);
2567
2568        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2569    };
2570    let accept_str = "application/x-pem-file";
2571    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2572
2573    let local_var_result = local_var_req_builder.send_empty();
2574
2575    let local_var_resp = local_var_result?;
2576
2577    let local_var_status = local_var_resp.status().as_u16();
2578    if local_var_status < 400 {
2579        ResponseContent::string(local_var_resp)
2580    } else {
2581        ResponseContent::new(local_var_resp, |data| {
2582            ConfigTlsPublicPemGetError::new(local_var_status, data).map_err(From::from)
2583        })
2584        .and_then(|content| Err(Error::ResponseError(content)))
2585    }
2586}
2587
2588/// Read unattended boot configuration: is it on or off?
2589pub fn config_unattended_boot_get(
2590    configuration: &configuration::Configuration,
2591) -> Result<ResponseContent<crate::models::UnattendedBootConfig>, Error<ConfigUnattendedBootGetError>>
2592{
2593    let local_var_configuration = configuration;
2594
2595    let local_var_client = &local_var_configuration.client;
2596
2597    let local_var_uri_str = format!(
2598        "{}/config/unattended-boot",
2599        local_var_configuration.base_path
2600    );
2601    let mut local_var_req_builder =
2602        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2603    local_var_req_builder = local_var_req_builder
2604        .config()
2605        .http_status_as_error(false)
2606        .build();
2607
2608    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2609        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2610    }
2611    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2612        let value = super::basic_auth(local_var_auth_conf);
2613
2614        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2615    };
2616    let accept_str = "application/json";
2617    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2618
2619    let local_var_result = local_var_req_builder.send_empty();
2620
2621    let local_var_resp = local_var_result?;
2622
2623    let local_var_status = local_var_resp.status().as_u16();
2624    if local_var_status < 400 {
2625        ResponseContent::deserialized(local_var_resp)
2626    } else {
2627        ResponseContent::new(local_var_resp, |data| {
2628            ConfigUnattendedBootGetError::new(local_var_status, data).map_err(From::from)
2629        })
2630        .and_then(|content| Err(Error::ResponseError(content)))
2631    }
2632}
2633
2634/// Configure unattended boot: switch it on or off (flip the switch).
2635pub fn config_unattended_boot_put(
2636    configuration: &configuration::Configuration,
2637    unattended_boot_config: crate::models::UnattendedBootConfig,
2638) -> Result<ResponseContent<()>, Error<ConfigUnattendedBootPutError>> {
2639    let local_var_configuration = configuration;
2640
2641    let local_var_client = &local_var_configuration.client;
2642
2643    let local_var_uri_str = format!(
2644        "{}/config/unattended-boot",
2645        local_var_configuration.base_path
2646    );
2647    let mut local_var_req_builder =
2648        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2649    local_var_req_builder = local_var_req_builder
2650        .config()
2651        .http_status_as_error(false)
2652        .build();
2653
2654    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2655        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2656    }
2657    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2658        let value = super::basic_auth(local_var_auth_conf);
2659
2660        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2661    };
2662
2663    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2664    let local_var_result = local_var_req_builder.send_json(unattended_boot_config);
2665
2666    let local_var_resp = local_var_result?;
2667
2668    let local_var_status = local_var_resp.status().as_u16();
2669    if local_var_status < 400 {
2670        ResponseContent::unit(local_var_resp)
2671    } else {
2672        ResponseContent::new(local_var_resp, |data| {
2673            ConfigUnattendedBootPutError::new(local_var_status, data).map_err(From::from)
2674        })
2675        .and_then(|content| Err(Error::ResponseError(content)))
2676    }
2677}
2678
2679/// Update the unlock passphrase.  *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked.
2680pub fn config_unlock_passphrase_put(
2681    configuration: &configuration::Configuration,
2682    unlock_passphrase_config: crate::models::UnlockPassphraseConfig,
2683) -> Result<ResponseContent<()>, Error<ConfigUnlockPassphrasePutError>> {
2684    let local_var_configuration = configuration;
2685
2686    let local_var_client = &local_var_configuration.client;
2687
2688    let local_var_uri_str = format!(
2689        "{}/config/unlock-passphrase",
2690        local_var_configuration.base_path
2691    );
2692    let mut local_var_req_builder =
2693        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2694    local_var_req_builder = local_var_req_builder
2695        .config()
2696        .http_status_as_error(false)
2697        .build();
2698
2699    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2700        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2701    }
2702    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2703        let value = super::basic_auth(local_var_auth_conf);
2704
2705        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2706    };
2707
2708    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2709    let local_var_result = local_var_req_builder.send_json(unlock_passphrase_config);
2710
2711    let local_var_resp = local_var_result?;
2712
2713    let local_var_status = local_var_resp.status().as_u16();
2714    if local_var_status < 400 {
2715        ResponseContent::unit(local_var_resp)
2716    } else {
2717        ResponseContent::new(local_var_resp, |data| {
2718            ConfigUnlockPassphrasePutError::new(local_var_status, data).map_err(From::from)
2719        })
2720        .and_then(|content| Err(Error::ResponseError(content)))
2721    }
2722}
2723
2724/// Retrieve whether NetHSM is fully started but not ready to take traffic. This corresponds to the state *Locked* or *Unprovisioned*.
2725pub fn health_alive_get(
2726    configuration: &configuration::Configuration,
2727) -> Result<ResponseContent<()>, Error<HealthAliveGetError>> {
2728    let local_var_configuration = configuration;
2729
2730    let local_var_client = &local_var_configuration.client;
2731
2732    let local_var_uri_str = format!("{}/health/alive", local_var_configuration.base_path);
2733    let mut local_var_req_builder =
2734        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2735    local_var_req_builder = local_var_req_builder
2736        .config()
2737        .http_status_as_error(false)
2738        .build();
2739
2740    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2741        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2742    }
2743
2744    let local_var_result = local_var_req_builder.send_empty();
2745
2746    let local_var_resp = local_var_result?;
2747
2748    let local_var_status = local_var_resp.status().as_u16();
2749    if local_var_status < 400 {
2750        ResponseContent::unit(local_var_resp)
2751    } else {
2752        ResponseContent::new(local_var_resp, |data| {
2753            HealthAliveGetError::new(local_var_status, data).map_err(From::from)
2754        })
2755        .and_then(|content| Err(Error::ResponseError(content)))
2756    }
2757}
2758
2759/// Retrieve whether NetHSM is in state *Operational* and thus ready to take traffic.
2760pub fn health_ready_get(
2761    configuration: &configuration::Configuration,
2762) -> Result<ResponseContent<()>, Error<HealthReadyGetError>> {
2763    let local_var_configuration = configuration;
2764
2765    let local_var_client = &local_var_configuration.client;
2766
2767    let local_var_uri_str = format!("{}/health/ready", local_var_configuration.base_path);
2768    let mut local_var_req_builder =
2769        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2770    local_var_req_builder = local_var_req_builder
2771        .config()
2772        .http_status_as_error(false)
2773        .build();
2774
2775    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2776        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2777    }
2778
2779    let local_var_result = local_var_req_builder.send_empty();
2780
2781    let local_var_resp = local_var_result?;
2782
2783    let local_var_status = local_var_resp.status().as_u16();
2784    if local_var_status < 400 {
2785        ResponseContent::unit(local_var_resp)
2786    } else {
2787        ResponseContent::new(local_var_resp, |data| {
2788            HealthReadyGetError::new(local_var_status, data).map_err(From::from)
2789        })
2790        .and_then(|content| Err(Error::ResponseError(content)))
2791    }
2792}
2793
2794/// Retrieve the state of NetHSM.
2795pub fn health_state_get(
2796    configuration: &configuration::Configuration,
2797) -> Result<ResponseContent<crate::models::HealthStateData>, Error<HealthStateGetError>> {
2798    let local_var_configuration = configuration;
2799
2800    let local_var_client = &local_var_configuration.client;
2801
2802    let local_var_uri_str = format!("{}/health/state", local_var_configuration.base_path);
2803    let mut local_var_req_builder =
2804        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2805    local_var_req_builder = local_var_req_builder
2806        .config()
2807        .http_status_as_error(false)
2808        .build();
2809
2810    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2811        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2812    }
2813    let accept_str = "application/json";
2814    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2815
2816    let local_var_result = local_var_req_builder.send_empty();
2817
2818    let local_var_resp = local_var_result?;
2819
2820    let local_var_status = local_var_resp.status().as_u16();
2821    if local_var_status < 400 {
2822        ResponseContent::deserialized(local_var_resp)
2823    } else {
2824        ResponseContent::new(local_var_resp, |data| {
2825            HealthStateGetError::new(local_var_status, data).map_err(From::from)
2826        })
2827        .and_then(|content| Err(Error::ResponseError(content)))
2828    }
2829}
2830
2831/// Information about the vendor and product.
2832pub fn info_get(
2833    configuration: &configuration::Configuration,
2834) -> Result<ResponseContent<crate::models::InfoData>, Error<InfoGetError>> {
2835    let local_var_configuration = configuration;
2836
2837    let local_var_client = &local_var_configuration.client;
2838
2839    let local_var_uri_str = format!("{}/info", local_var_configuration.base_path);
2840    let mut local_var_req_builder =
2841        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2842    local_var_req_builder = local_var_req_builder
2843        .config()
2844        .http_status_as_error(false)
2845        .build();
2846
2847    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2848        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2849    }
2850    let accept_str = "application/json";
2851    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2852
2853    let local_var_result = local_var_req_builder.send_empty();
2854
2855    let local_var_resp = local_var_result?;
2856
2857    let local_var_status = local_var_resp.status().as_u16();
2858    if local_var_status < 400 {
2859        ResponseContent::deserialized(local_var_resp)
2860    } else {
2861        ResponseContent::new(local_var_resp, |data| {
2862            InfoGetError::new(local_var_status, data).map_err(From::from)
2863        })
2864        .and_then(|content| Err(Error::ResponseError(content)))
2865    }
2866}
2867
2868/// Generate a pair of public and private key and store it in NetHSM. KeyID is optional as a parameter and will be generated by NetHSM if not present. The key is stored in the caller's namespace.
2869pub fn keys_generate_post(
2870    configuration: &configuration::Configuration,
2871    key_generate_request_data: crate::models::KeyGenerateRequestData,
2872) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<KeysGeneratePostError>> {
2873    let local_var_configuration = configuration;
2874
2875    let local_var_client = &local_var_configuration.client;
2876
2877    let local_var_uri_str = format!("{}/keys/generate", local_var_configuration.base_path);
2878    let mut local_var_req_builder =
2879        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2880    local_var_req_builder = local_var_req_builder
2881        .config()
2882        .http_status_as_error(false)
2883        .build();
2884
2885    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2886        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2887    }
2888    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2889        let value = super::basic_auth(local_var_auth_conf);
2890
2891        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2892    };
2893    let accept_str = "application/json";
2894    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2895
2896    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2897    let local_var_result = local_var_req_builder.send_json(key_generate_request_data);
2898
2899    let local_var_resp = local_var_result?;
2900
2901    let local_var_status = local_var_resp.status().as_u16();
2902    if local_var_status < 400 {
2903        ResponseContent::deserialized(local_var_resp)
2904    } else {
2905        ResponseContent::new(local_var_resp, |data| {
2906            KeysGeneratePostError::new(local_var_status, data).map_err(From::from)
2907        })
2908        .and_then(|content| Err(Error::ResponseError(content)))
2909    }
2910}
2911
2912/// Get a list of the identifiers of all keys that are currently stored in NetHSM. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data. To fetch only a subset of keys, consider using `/keys/pfx*`.
2913pub fn keys_get(
2914    configuration: &configuration::Configuration,
2915    filter: Option<&str>,
2916) -> Result<ResponseContent<Vec<crate::models::KeyItem>>, Error<KeysGetError>> {
2917    let local_var_configuration = configuration;
2918
2919    let local_var_client = &local_var_configuration.client;
2920
2921    let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
2922    let mut local_var_req_builder =
2923        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2924    local_var_req_builder = local_var_req_builder
2925        .config()
2926        .http_status_as_error(false)
2927        .build();
2928
2929    if let Some(local_var_str) = filter {
2930        local_var_req_builder =
2931            local_var_req_builder.query_pairs([("filter", local_var_str.to_string().as_str())]);
2932    }
2933    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2934        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2935    }
2936    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2937        let value = super::basic_auth(local_var_auth_conf);
2938
2939        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2940    };
2941    let accept_str = "application/json";
2942    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2943
2944    let local_var_result = local_var_req_builder.send_empty();
2945
2946    let local_var_resp = local_var_result?;
2947
2948    let local_var_status = local_var_resp.status().as_u16();
2949    if local_var_status < 400 {
2950        ResponseContent::deserialized(local_var_resp)
2951    } else {
2952        ResponseContent::new(local_var_resp, |data| {
2953            KeysGetError::new(local_var_status, data).map_err(From::from)
2954        })
2955        .and_then(|content| Err(Error::ResponseError(content)))
2956    }
2957}
2958
2959/// Delete the certificate.
2960pub fn keys_key_id_cert_delete(
2961    configuration: &configuration::Configuration,
2962    key_id: &str,
2963) -> Result<ResponseContent<()>, Error<KeysKeyIdCertDeleteError>> {
2964    let local_var_configuration = configuration;
2965
2966    let local_var_client = &local_var_configuration.client;
2967
2968    let local_var_uri_str = format!(
2969        "{}/keys/{KeyID}/cert",
2970        local_var_configuration.base_path,
2971        KeyID = crate::apis::urlencode(key_id)
2972    );
2973    let mut local_var_req_builder =
2974        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
2975    local_var_req_builder = local_var_req_builder
2976        .config()
2977        .http_status_as_error(false)
2978        .build();
2979
2980    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2981        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2982    }
2983    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2984        let value = super::basic_auth(local_var_auth_conf);
2985
2986        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2987    };
2988
2989    let local_var_result = local_var_req_builder.send_empty();
2990
2991    let local_var_resp = local_var_result?;
2992
2993    let local_var_status = local_var_resp.status().as_u16();
2994    if local_var_status < 400 {
2995        ResponseContent::unit(local_var_resp)
2996    } else {
2997        ResponseContent::new(local_var_resp, |data| {
2998            KeysKeyIdCertDeleteError::new(local_var_status, data).map_err(From::from)
2999        })
3000        .and_then(|content| Err(Error::ResponseError(content)))
3001    }
3002}
3003
3004/// Retrieve a stored certificate in the exact format it was stored.
3005pub fn keys_key_id_cert_get(
3006    configuration: &configuration::Configuration,
3007    key_id: &str,
3008) -> Result<ResponseContent<std::vec::Vec<u8>>, Error<KeysKeyIdCertGetError>> {
3009    let local_var_configuration = configuration;
3010
3011    let local_var_client = &local_var_configuration.client;
3012
3013    let local_var_uri_str = format!(
3014        "{}/keys/{KeyID}/cert",
3015        local_var_configuration.base_path,
3016        KeyID = crate::apis::urlencode(key_id)
3017    );
3018    let mut local_var_req_builder =
3019        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3020    local_var_req_builder = local_var_req_builder
3021        .config()
3022        .http_status_as_error(false)
3023        .build();
3024
3025    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3026        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3027    }
3028    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3029        let value = super::basic_auth(local_var_auth_conf);
3030
3031        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3032    };
3033    let accept_str = "application/octet-stream";
3034    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3035
3036    let local_var_result = local_var_req_builder.send_empty();
3037
3038    let local_var_resp = local_var_result?;
3039
3040    let local_var_status = local_var_resp.status().as_u16();
3041    if local_var_status < 400 {
3042        ResponseContent::bytes(local_var_resp)
3043    } else {
3044        ResponseContent::new(local_var_resp, |data| {
3045            KeysKeyIdCertGetError::new(local_var_status, data).map_err(From::from)
3046        })
3047        .and_then(|content| Err(Error::ResponseError(content)))
3048    }
3049}
3050
3051/// Store a certificate. Maximum size 1MB. The Content-Type must be application/octet-stream.
3052pub fn keys_key_id_cert_put(
3053    configuration: &configuration::Configuration,
3054    key_id: &str,
3055    body: std::vec::Vec<u8>,
3056) -> Result<ResponseContent<()>, Error<KeysKeyIdCertPutError>> {
3057    let local_var_configuration = configuration;
3058
3059    let local_var_client = &local_var_configuration.client;
3060
3061    let local_var_uri_str = format!(
3062        "{}/keys/{KeyID}/cert",
3063        local_var_configuration.base_path,
3064        KeyID = crate::apis::urlencode(key_id)
3065    );
3066    let mut local_var_req_builder =
3067        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3068    local_var_req_builder = local_var_req_builder
3069        .config()
3070        .http_status_as_error(false)
3071        .build();
3072
3073    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3074        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3075    }
3076    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3077        let value = super::basic_auth(local_var_auth_conf);
3078
3079        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3080    };
3081
3082    local_var_req_builder =
3083        local_var_req_builder.header("content-type", "application/octet-stream");
3084    let local_var_result = local_var_req_builder.send(body);
3085
3086    let local_var_resp = local_var_result?;
3087
3088    let local_var_status = local_var_resp.status().as_u16();
3089    if local_var_status < 400 {
3090        ResponseContent::unit(local_var_resp)
3091    } else {
3092        ResponseContent::new(local_var_resp, |data| {
3093            KeysKeyIdCertPutError::new(local_var_status, data).map_err(From::from)
3094        })
3095        .and_then(|content| Err(Error::ResponseError(content)))
3096    }
3097}
3098
3099/// Retrieve a certificate signing request in PEM format.
3100pub fn keys_key_id_csr_pem_post(
3101    configuration: &configuration::Configuration,
3102    key_id: &str,
3103    distinguished_name: crate::models::DistinguishedName,
3104) -> Result<ResponseContent<String>, Error<KeysKeyIdCsrPemPostError>> {
3105    let local_var_configuration = configuration;
3106
3107    let local_var_client = &local_var_configuration.client;
3108
3109    let local_var_uri_str = format!(
3110        "{}/keys/{KeyID}/csr.pem",
3111        local_var_configuration.base_path,
3112        KeyID = crate::apis::urlencode(key_id)
3113    );
3114    let mut local_var_req_builder =
3115        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3116    local_var_req_builder = local_var_req_builder
3117        .config()
3118        .http_status_as_error(false)
3119        .build();
3120
3121    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3122        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3123    }
3124    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3125        let value = super::basic_auth(local_var_auth_conf);
3126
3127        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3128    };
3129    let accept_str = "application/x-pem-file";
3130    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3131
3132    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3133    let local_var_result = local_var_req_builder.send_json(distinguished_name);
3134
3135    let local_var_resp = local_var_result?;
3136
3137    let local_var_status = local_var_resp.status().as_u16();
3138    if local_var_status < 400 {
3139        ResponseContent::string(local_var_resp)
3140    } else {
3141        ResponseContent::new(local_var_resp, |data| {
3142            KeysKeyIdCsrPemPostError::new(local_var_status, data).map_err(From::from)
3143        })
3144        .and_then(|content| Err(Error::ResponseError(content)))
3145    }
3146}
3147
3148/// Decrypt an encrypted message with the secret key.
3149pub fn keys_key_id_decrypt_post(
3150    configuration: &configuration::Configuration,
3151    key_id: &str,
3152    decrypt_request_data: crate::models::DecryptRequestData,
3153) -> Result<ResponseContent<crate::models::DecryptData>, Error<KeysKeyIdDecryptPostError>> {
3154    let local_var_configuration = configuration;
3155
3156    let local_var_client = &local_var_configuration.client;
3157
3158    let local_var_uri_str = format!(
3159        "{}/keys/{KeyID}/decrypt",
3160        local_var_configuration.base_path,
3161        KeyID = crate::apis::urlencode(key_id)
3162    );
3163    let mut local_var_req_builder =
3164        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3165    local_var_req_builder = local_var_req_builder
3166        .config()
3167        .http_status_as_error(false)
3168        .build();
3169
3170    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3171        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3172    }
3173    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3174        let value = super::basic_auth(local_var_auth_conf);
3175
3176        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3177    };
3178    let accept_str = "application/json";
3179    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3180
3181    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3182    let local_var_result = local_var_req_builder.send_json(decrypt_request_data);
3183
3184    let local_var_resp = local_var_result?;
3185
3186    let local_var_status = local_var_resp.status().as_u16();
3187    if local_var_status < 400 {
3188        ResponseContent::deserialized(local_var_resp)
3189    } else {
3190        ResponseContent::new(local_var_resp, |data| {
3191            KeysKeyIdDecryptPostError::new(local_var_status, data).map_err(From::from)
3192        })
3193        .and_then(|content| Err(Error::ResponseError(content)))
3194    }
3195}
3196
3197/// Delete a pair of public and private key.
3198pub fn keys_key_id_delete(
3199    configuration: &configuration::Configuration,
3200    key_id: &str,
3201) -> Result<ResponseContent<()>, Error<KeysKeyIdDeleteError>> {
3202    let local_var_configuration = configuration;
3203
3204    let local_var_client = &local_var_configuration.client;
3205
3206    let local_var_uri_str = format!(
3207        "{}/keys/{KeyID}",
3208        local_var_configuration.base_path,
3209        KeyID = crate::apis::urlencode(key_id)
3210    );
3211    let mut local_var_req_builder =
3212        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3213    local_var_req_builder = local_var_req_builder
3214        .config()
3215        .http_status_as_error(false)
3216        .build();
3217
3218    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3219        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3220    }
3221    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3222        let value = super::basic_auth(local_var_auth_conf);
3223
3224        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3225    };
3226
3227    let local_var_result = local_var_req_builder.send_empty();
3228
3229    let local_var_resp = local_var_result?;
3230
3231    let local_var_status = local_var_resp.status().as_u16();
3232    if local_var_status < 400 {
3233        ResponseContent::unit(local_var_resp)
3234    } else {
3235        ResponseContent::new(local_var_resp, |data| {
3236            KeysKeyIdDeleteError::new(local_var_status, data).map_err(From::from)
3237        })
3238        .and_then(|content| Err(Error::ResponseError(content)))
3239    }
3240}
3241
3242/// Encrypt a message with the secret key.
3243pub fn keys_key_id_encrypt_post(
3244    configuration: &configuration::Configuration,
3245    key_id: &str,
3246    encrypt_request_data: crate::models::EncryptRequestData,
3247) -> Result<ResponseContent<crate::models::EncryptData>, Error<KeysKeyIdEncryptPostError>> {
3248    let local_var_configuration = configuration;
3249
3250    let local_var_client = &local_var_configuration.client;
3251
3252    let local_var_uri_str = format!(
3253        "{}/keys/{KeyID}/encrypt",
3254        local_var_configuration.base_path,
3255        KeyID = crate::apis::urlencode(key_id)
3256    );
3257    let mut local_var_req_builder =
3258        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3259    local_var_req_builder = local_var_req_builder
3260        .config()
3261        .http_status_as_error(false)
3262        .build();
3263
3264    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3265        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3266    }
3267    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3268        let value = super::basic_auth(local_var_auth_conf);
3269
3270        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3271    };
3272    let accept_str = "application/json";
3273    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3274
3275    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3276    let local_var_result = local_var_req_builder.send_json(encrypt_request_data);
3277
3278    let local_var_resp = local_var_result?;
3279
3280    let local_var_status = local_var_resp.status().as_u16();
3281    if local_var_status < 400 {
3282        ResponseContent::deserialized(local_var_resp)
3283    } else {
3284        ResponseContent::new(local_var_resp, |data| {
3285            KeysKeyIdEncryptPostError::new(local_var_status, data).map_err(From::from)
3286        })
3287        .and_then(|content| Err(Error::ResponseError(content)))
3288    }
3289}
3290
3291/// Retrieve a single public key.
3292pub fn keys_key_id_get(
3293    configuration: &configuration::Configuration,
3294    key_id: &str,
3295) -> Result<ResponseContent<crate::models::PublicKey>, Error<KeysKeyIdGetError>> {
3296    let local_var_configuration = configuration;
3297
3298    let local_var_client = &local_var_configuration.client;
3299
3300    let local_var_uri_str = format!(
3301        "{}/keys/{KeyID}",
3302        local_var_configuration.base_path,
3303        KeyID = crate::apis::urlencode(key_id)
3304    );
3305    let mut local_var_req_builder =
3306        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3307    local_var_req_builder = local_var_req_builder
3308        .config()
3309        .http_status_as_error(false)
3310        .build();
3311
3312    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3313        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3314    }
3315    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3316        let value = super::basic_auth(local_var_auth_conf);
3317
3318        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3319    };
3320    let accept_str = "application/json";
3321    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3322
3323    let local_var_result = local_var_req_builder.send_empty();
3324
3325    let local_var_resp = local_var_result?;
3326
3327    let local_var_status = local_var_resp.status().as_u16();
3328    if local_var_status < 400 {
3329        ResponseContent::deserialized(local_var_resp)
3330    } else {
3331        ResponseContent::new(local_var_resp, |data| {
3332            KeysKeyIdGetError::new(local_var_status, data).map_err(From::from)
3333        })
3334        .and_then(|content| Err(Error::ResponseError(content)))
3335    }
3336}
3337
3338/// Move a key by changing its identifier. The key content remains unchanged, but it will be accessible under the new identifier. The old identifier becomes invalid after successful move.
3339pub fn keys_key_id_move_post(
3340    configuration: &configuration::Configuration,
3341    key_id: &str,
3342    move_key_request: crate::models::MoveKeyRequest,
3343) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<KeysKeyIdMovePostError>> {
3344    let local_var_configuration = configuration;
3345
3346    let local_var_client = &local_var_configuration.client;
3347
3348    let local_var_uri_str = format!(
3349        "{}/keys/{KeyID}/move",
3350        local_var_configuration.base_path,
3351        KeyID = crate::apis::urlencode(key_id)
3352    );
3353    let mut local_var_req_builder =
3354        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3355    local_var_req_builder = local_var_req_builder
3356        .config()
3357        .http_status_as_error(false)
3358        .build();
3359
3360    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3361        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3362    }
3363    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3364        let value = super::basic_auth(local_var_auth_conf);
3365
3366        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3367    };
3368    let accept_str = "application/json";
3369    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3370
3371    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3372    let local_var_result = local_var_req_builder.send_json(move_key_request);
3373
3374    let local_var_resp = local_var_result?;
3375
3376    let local_var_status = local_var_resp.status().as_u16();
3377    if local_var_status < 400 {
3378        ResponseContent::deserialized(local_var_resp)
3379    } else {
3380        ResponseContent::new(local_var_resp, |data| {
3381            KeysKeyIdMovePostError::new(local_var_status, data).map_err(From::from)
3382        })
3383        .and_then(|content| Err(Error::ResponseError(content)))
3384    }
3385}
3386
3387/// Retrieve public key in PEM format.
3388pub fn keys_key_id_public_pem_get(
3389    configuration: &configuration::Configuration,
3390    key_id: &str,
3391) -> Result<ResponseContent<String>, Error<KeysKeyIdPublicPemGetError>> {
3392    let local_var_configuration = configuration;
3393
3394    let local_var_client = &local_var_configuration.client;
3395
3396    let local_var_uri_str = format!(
3397        "{}/keys/{KeyID}/public.pem",
3398        local_var_configuration.base_path,
3399        KeyID = crate::apis::urlencode(key_id)
3400    );
3401    let mut local_var_req_builder =
3402        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3403    local_var_req_builder = local_var_req_builder
3404        .config()
3405        .http_status_as_error(false)
3406        .build();
3407
3408    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3409        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3410    }
3411    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3412        let value = super::basic_auth(local_var_auth_conf);
3413
3414        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3415    };
3416    let accept_str = "application/x-pem-file";
3417    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3418
3419    let local_var_result = local_var_req_builder.send_empty();
3420
3421    let local_var_resp = local_var_result?;
3422
3423    let local_var_status = local_var_resp.status().as_u16();
3424    if local_var_status < 400 {
3425        ResponseContent::string(local_var_resp)
3426    } else {
3427        ResponseContent::new(local_var_resp, |data| {
3428            KeysKeyIdPublicPemGetError::new(local_var_status, data).map_err(From::from)
3429        })
3430        .and_then(|content| Err(Error::ResponseError(content)))
3431    }
3432}
3433
3434/// Import a private key into NetHSM and store it under the *KeyID* path. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace.
3435pub fn keys_key_id_put(
3436    configuration: &configuration::Configuration,
3437    key_id: &str,
3438    body: KeysKeyIdPutBody,
3439) -> Result<ResponseContent<()>, Error<KeysKeyIdPutError>> {
3440    let local_var_configuration = configuration;
3441
3442    let local_var_client = &local_var_configuration.client;
3443
3444    let local_var_uri_str = format!(
3445        "{}/keys/{KeyID}",
3446        local_var_configuration.base_path,
3447        KeyID = crate::apis::urlencode(key_id)
3448    );
3449    let mut local_var_req_builder =
3450        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3451    local_var_req_builder = local_var_req_builder
3452        .config()
3453        .http_status_as_error(false)
3454        .build();
3455
3456    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3457        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3458    }
3459    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3460        let value = super::basic_auth(local_var_auth_conf);
3461
3462        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3463    };
3464
3465    let body_json = body.is_json();
3466    local_var_req_builder = local_var_req_builder.header("content-type", body.content_type());
3467
3468    let local_var_result = if body_json {
3469        local_var_req_builder.send_json(body)
3470    } else {
3471        local_var_req_builder.send(body.get_string().as_str())
3472    };
3473
3474    let local_var_resp = local_var_result?;
3475
3476    let local_var_status = local_var_resp.status().as_u16();
3477    if local_var_status < 400 {
3478        ResponseContent::unit(local_var_resp)
3479    } else {
3480        ResponseContent::new(local_var_resp, |data| {
3481            KeysKeyIdPutError::new(local_var_status, data).map_err(From::from)
3482        })
3483        .and_then(|content| Err(Error::ResponseError(content)))
3484    }
3485}
3486
3487/// Delete a tag from the authorized set
3488pub fn keys_key_id_restrictions_tags_tag_delete(
3489    configuration: &configuration::Configuration,
3490    tag: &str,
3491    key_id: &str,
3492) -> Result<ResponseContent<()>, Error<KeysKeyIdRestrictionsTagsTagDeleteError>> {
3493    let local_var_configuration = configuration;
3494
3495    let local_var_client = &local_var_configuration.client;
3496
3497    let local_var_uri_str = format!(
3498        "{}/keys/{KeyID}/restrictions/tags/{Tag}",
3499        local_var_configuration.base_path,
3500        Tag = crate::apis::urlencode(tag),
3501        KeyID = crate::apis::urlencode(key_id)
3502    );
3503    let mut local_var_req_builder =
3504        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3505    local_var_req_builder = local_var_req_builder
3506        .config()
3507        .http_status_as_error(false)
3508        .build();
3509
3510    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3511        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3512    }
3513    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3514        let value = super::basic_auth(local_var_auth_conf);
3515
3516        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3517    };
3518
3519    let local_var_result = local_var_req_builder.send_empty();
3520
3521    let local_var_resp = local_var_result?;
3522
3523    let local_var_status = local_var_resp.status().as_u16();
3524    if local_var_status < 400 {
3525        ResponseContent::unit(local_var_resp)
3526    } else {
3527        ResponseContent::new(local_var_resp, |data| {
3528            KeysKeyIdRestrictionsTagsTagDeleteError::new(local_var_status, data).map_err(From::from)
3529        })
3530        .and_then(|content| Err(Error::ResponseError(content)))
3531    }
3532}
3533
3534/// Add a tag to the authorized set
3535pub fn keys_key_id_restrictions_tags_tag_put(
3536    configuration: &configuration::Configuration,
3537    tag: &str,
3538    key_id: &str,
3539) -> Result<ResponseContent<()>, Error<KeysKeyIdRestrictionsTagsTagPutError>> {
3540    let local_var_configuration = configuration;
3541
3542    let local_var_client = &local_var_configuration.client;
3543
3544    let local_var_uri_str = format!(
3545        "{}/keys/{KeyID}/restrictions/tags/{Tag}",
3546        local_var_configuration.base_path,
3547        Tag = crate::apis::urlencode(tag),
3548        KeyID = crate::apis::urlencode(key_id)
3549    );
3550    let mut local_var_req_builder =
3551        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3552    local_var_req_builder = local_var_req_builder
3553        .config()
3554        .http_status_as_error(false)
3555        .build();
3556
3557    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3558        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3559    }
3560    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3561        let value = super::basic_auth(local_var_auth_conf);
3562
3563        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3564    };
3565
3566    let local_var_result = local_var_req_builder.send_empty();
3567
3568    let local_var_resp = local_var_result?;
3569
3570    let local_var_status = local_var_resp.status().as_u16();
3571    if local_var_status < 400 {
3572        ResponseContent::unit(local_var_resp)
3573    } else {
3574        ResponseContent::new(local_var_resp, |data| {
3575            KeysKeyIdRestrictionsTagsTagPutError::new(local_var_status, data).map_err(From::from)
3576        })
3577        .and_then(|content| Err(Error::ResponseError(content)))
3578    }
3579}
3580
3581/// Sign a message with the secret key.
3582pub fn keys_key_id_sign_post(
3583    configuration: &configuration::Configuration,
3584    key_id: &str,
3585    sign_request_data: crate::models::SignRequestData,
3586) -> Result<ResponseContent<crate::models::SignData>, Error<KeysKeyIdSignPostError>> {
3587    let local_var_configuration = configuration;
3588
3589    let local_var_client = &local_var_configuration.client;
3590
3591    let local_var_uri_str = format!(
3592        "{}/keys/{KeyID}/sign",
3593        local_var_configuration.base_path,
3594        KeyID = crate::apis::urlencode(key_id)
3595    );
3596    let mut local_var_req_builder =
3597        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3598    local_var_req_builder = local_var_req_builder
3599        .config()
3600        .http_status_as_error(false)
3601        .build();
3602
3603    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3604        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3605    }
3606    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3607        let value = super::basic_auth(local_var_auth_conf);
3608
3609        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3610    };
3611    let accept_str = "application/json";
3612    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3613
3614    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3615    let local_var_result = local_var_req_builder.send_json(sign_request_data);
3616
3617    let local_var_resp = local_var_result?;
3618
3619    let local_var_status = local_var_resp.status().as_u16();
3620    if local_var_status < 400 {
3621        ResponseContent::deserialized(local_var_resp)
3622    } else {
3623        ResponseContent::new(local_var_resp, |data| {
3624            KeysKeyIdSignPostError::new(local_var_status, data).map_err(From::from)
3625        })
3626        .and_then(|content| Err(Error::ResponseError(content)))
3627    }
3628}
3629
3630/// Get a list of the identifiers of all keys that have a KeyID that starts with KeyPrefix. If the caller is in a namespace, only keys in that namespace are returned. Separate requests need to be made to request the individual key data.
3631pub fn keys_key_prefix_get(
3632    configuration: &configuration::Configuration,
3633    key_prefix: &str,
3634    filter: Option<&str>,
3635) -> Result<ResponseContent<Vec<crate::models::KeyItem>>, Error<KeysKeyPrefixGetError>> {
3636    let local_var_configuration = configuration;
3637
3638    let local_var_client = &local_var_configuration.client;
3639
3640    let local_var_uri_str = format!(
3641        "{}/keys/{KeyPrefix}*",
3642        local_var_configuration.base_path,
3643        KeyPrefix = crate::apis::urlencode(key_prefix)
3644    );
3645    let mut local_var_req_builder =
3646        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3647    local_var_req_builder = local_var_req_builder
3648        .config()
3649        .http_status_as_error(false)
3650        .build();
3651
3652    if let Some(local_var_str) = filter {
3653        local_var_req_builder =
3654            local_var_req_builder.query_pairs([("filter", local_var_str.to_string().as_str())]);
3655    }
3656    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3657        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3658    }
3659    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3660        let value = super::basic_auth(local_var_auth_conf);
3661
3662        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3663    };
3664    let accept_str = "application/json";
3665    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3666
3667    let local_var_result = local_var_req_builder.send_empty();
3668
3669    let local_var_resp = local_var_result?;
3670
3671    let local_var_status = local_var_resp.status().as_u16();
3672    if local_var_status < 400 {
3673        ResponseContent::deserialized(local_var_resp)
3674    } else {
3675        ResponseContent::new(local_var_resp, |data| {
3676            KeysKeyPrefixGetError::new(local_var_status, data).map_err(From::from)
3677        })
3678        .and_then(|content| Err(Error::ResponseError(content)))
3679    }
3680}
3681
3682/// Import a private key into NetHSM and let NetHSM generate a KeyID. The public key will be automatically derived. The parameters of the key can be passed as a PEM file or a JSON object. The key is stored in the caller's namespace.
3683pub fn keys_post(
3684    configuration: &configuration::Configuration,
3685    body: KeysPostBody,
3686) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<KeysPostError>> {
3687    let local_var_configuration = configuration;
3688
3689    let local_var_client = &local_var_configuration.client;
3690
3691    let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
3692    let mut local_var_req_builder =
3693        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3694    local_var_req_builder = local_var_req_builder
3695        .config()
3696        .http_status_as_error(false)
3697        .build();
3698
3699    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3700        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3701    }
3702    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3703        let value = super::basic_auth(local_var_auth_conf);
3704
3705        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3706    };
3707    let accept_str = "application/json";
3708    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3709
3710    let body_json = body.is_json();
3711    local_var_req_builder = local_var_req_builder.header("content-type", body.content_type());
3712
3713    let local_var_result = if body_json {
3714        local_var_req_builder.send_json(body)
3715    } else {
3716        local_var_req_builder.send(body.get_string().as_str())
3717    };
3718
3719    let local_var_resp = local_var_result?;
3720
3721    let local_var_status = local_var_resp.status().as_u16();
3722    if local_var_status < 400 {
3723        ResponseContent::deserialized(local_var_resp)
3724    } else {
3725        ResponseContent::new(local_var_resp, |data| {
3726            KeysPostError::new(local_var_status, data).map_err(From::from)
3727        })
3728        .and_then(|content| Err(Error::ResponseError(content)))
3729    }
3730}
3731
3732/// Brings an *Operational* NetHSM into *Locked* state.
3733pub fn lock_post(
3734    configuration: &configuration::Configuration,
3735) -> Result<ResponseContent<()>, Error<LockPostError>> {
3736    let local_var_configuration = configuration;
3737
3738    let local_var_client = &local_var_configuration.client;
3739
3740    let local_var_uri_str = format!("{}/lock", local_var_configuration.base_path);
3741    let mut local_var_req_builder =
3742        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3743    local_var_req_builder = local_var_req_builder
3744        .config()
3745        .http_status_as_error(false)
3746        .build();
3747
3748    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3749        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3750    }
3751    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3752        let value = super::basic_auth(local_var_auth_conf);
3753
3754        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3755    };
3756
3757    let local_var_result = local_var_req_builder.send_empty();
3758
3759    let local_var_resp = local_var_result?;
3760
3761    let local_var_status = local_var_resp.status().as_u16();
3762    if local_var_status < 400 {
3763        ResponseContent::unit(local_var_resp)
3764    } else {
3765        ResponseContent::new(local_var_resp, |data| {
3766            LockPostError::new(local_var_status, data).map_err(From::from)
3767        })
3768        .and_then(|content| Err(Error::ResponseError(content)))
3769    }
3770}
3771
3772/// Get metrics. Precondition: NetHSM is *Operational* and a **R-Metrics** can be authenticated.
3773pub fn metrics_get(
3774    configuration: &configuration::Configuration,
3775) -> Result<ResponseContent<serde_json::Value>, Error<MetricsGetError>> {
3776    let local_var_configuration = configuration;
3777
3778    let local_var_client = &local_var_configuration.client;
3779
3780    let local_var_uri_str = format!("{}/metrics", local_var_configuration.base_path);
3781    let mut local_var_req_builder =
3782        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3783    local_var_req_builder = local_var_req_builder
3784        .config()
3785        .http_status_as_error(false)
3786        .build();
3787
3788    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3789        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3790    }
3791    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3792        let value = super::basic_auth(local_var_auth_conf);
3793
3794        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3795    };
3796    let accept_str = "application/json";
3797    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3798
3799    let local_var_result = local_var_req_builder.send_empty();
3800
3801    let local_var_resp = local_var_result?;
3802
3803    let local_var_status = local_var_resp.status().as_u16();
3804    if local_var_status < 400 {
3805        ResponseContent::deserialized(local_var_resp)
3806    } else {
3807        ResponseContent::new(local_var_resp, |data| {
3808            MetricsGetError::new(local_var_status, data).map_err(From::from)
3809        })
3810        .and_then(|content| Err(Error::ResponseError(content)))
3811    }
3812}
3813
3814/// Get a list of all created namespaces. Note that users may be assigned namespaces not present in this list, as long as the namespace has not been created.
3815pub fn namespaces_get(
3816    configuration: &configuration::Configuration,
3817) -> Result<ResponseContent<Vec<crate::models::NamespaceItem>>, Error<NamespacesGetError>> {
3818    let local_var_configuration = configuration;
3819
3820    let local_var_client = &local_var_configuration.client;
3821
3822    let local_var_uri_str = format!("{}/namespaces", local_var_configuration.base_path);
3823    let mut local_var_req_builder =
3824        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3825    local_var_req_builder = local_var_req_builder
3826        .config()
3827        .http_status_as_error(false)
3828        .build();
3829
3830    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3831        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3832    }
3833    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3834        let value = super::basic_auth(local_var_auth_conf);
3835
3836        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3837    };
3838    let accept_str = "application/json";
3839    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3840
3841    let local_var_result = local_var_req_builder.send_empty();
3842
3843    let local_var_resp = local_var_result?;
3844
3845    let local_var_status = local_var_resp.status().as_u16();
3846    if local_var_status < 400 {
3847        ResponseContent::deserialized(local_var_resp)
3848    } else {
3849        ResponseContent::new(local_var_resp, |data| {
3850            NamespacesGetError::new(local_var_status, data).map_err(From::from)
3851        })
3852        .and_then(|content| Err(Error::ResponseError(content)))
3853    }
3854}
3855
3856/// Delete a namespace. **WARNING: all keys from that namespace are deleted.**
3857pub fn namespaces_namespace_id_delete(
3858    configuration: &configuration::Configuration,
3859    namespace_id: &str,
3860) -> Result<ResponseContent<()>, Error<NamespacesNamespaceIdDeleteError>> {
3861    let local_var_configuration = configuration;
3862
3863    let local_var_client = &local_var_configuration.client;
3864
3865    let local_var_uri_str = format!(
3866        "{}/namespaces/{NamespaceID}",
3867        local_var_configuration.base_path,
3868        NamespaceID = crate::apis::urlencode(namespace_id)
3869    );
3870    let mut local_var_req_builder =
3871        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3872    local_var_req_builder = local_var_req_builder
3873        .config()
3874        .http_status_as_error(false)
3875        .build();
3876
3877    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3878        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3879    }
3880    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3881        let value = super::basic_auth(local_var_auth_conf);
3882
3883        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3884    };
3885
3886    let local_var_result = local_var_req_builder.send_empty();
3887
3888    let local_var_resp = local_var_result?;
3889
3890    let local_var_status = local_var_resp.status().as_u16();
3891    if local_var_status < 400 {
3892        ResponseContent::unit(local_var_resp)
3893    } else {
3894        ResponseContent::new(local_var_resp, |data| {
3895            NamespacesNamespaceIdDeleteError::new(local_var_status, data).map_err(From::from)
3896        })
3897        .and_then(|content| Err(Error::ResponseError(content)))
3898    }
3899}
3900
3901/// Create a namespace on keyfender. All users in that namespace can now be used, and all user management power is delegated to admins in that namespace.
3902pub fn namespaces_namespace_id_put(
3903    configuration: &configuration::Configuration,
3904    namespace_id: &str,
3905) -> Result<ResponseContent<()>, Error<NamespacesNamespaceIdPutError>> {
3906    let local_var_configuration = configuration;
3907
3908    let local_var_client = &local_var_configuration.client;
3909
3910    let local_var_uri_str = format!(
3911        "{}/namespaces/{NamespaceID}",
3912        local_var_configuration.base_path,
3913        NamespaceID = crate::apis::urlencode(namespace_id)
3914    );
3915    let mut local_var_req_builder =
3916        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3917    local_var_req_builder = local_var_req_builder
3918        .config()
3919        .http_status_as_error(false)
3920        .build();
3921
3922    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3923        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3924    }
3925    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3926        let value = super::basic_auth(local_var_auth_conf);
3927
3928        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3929    };
3930
3931    let local_var_result = local_var_req_builder.send_empty();
3932
3933    let local_var_resp = local_var_result?;
3934
3935    let local_var_status = local_var_resp.status().as_u16();
3936    if local_var_status < 400 {
3937        ResponseContent::unit(local_var_resp)
3938    } else {
3939        ResponseContent::new(local_var_resp, |data| {
3940            NamespacesNamespaceIdPutError::new(local_var_status, data).map_err(From::from)
3941        })
3942        .and_then(|content| Err(Error::ResponseError(content)))
3943    }
3944}
3945
3946/// Initial provisioning, only available in *Unprovisioned* state.  *WARNING:* The unlock passphrase can't be reset by an admin user without knowing the current value, so if the unlock passphrase is lost, neither can it be reset to a new value nor can the NetHSM be unlocked.
3947pub fn provision_post(
3948    configuration: &configuration::Configuration,
3949    provision_request_data: crate::models::ProvisionRequestData,
3950) -> Result<ResponseContent<()>, Error<ProvisionPostError>> {
3951    let local_var_configuration = configuration;
3952
3953    let local_var_client = &local_var_configuration.client;
3954
3955    let local_var_uri_str = format!("{}/provision", local_var_configuration.base_path);
3956    let mut local_var_req_builder =
3957        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3958    local_var_req_builder = local_var_req_builder
3959        .config()
3960        .http_status_as_error(false)
3961        .build();
3962
3963    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3964        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3965    }
3966
3967    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3968    let local_var_result = local_var_req_builder.send_json(provision_request_data);
3969
3970    let local_var_resp = local_var_result?;
3971
3972    let local_var_status = local_var_resp.status().as_u16();
3973    if local_var_status < 400 {
3974        ResponseContent::unit(local_var_resp)
3975    } else {
3976        ResponseContent::new(local_var_resp, |data| {
3977            ProvisionPostError::new(local_var_status, data).map_err(From::from)
3978        })
3979        .and_then(|content| Err(Error::ResponseError(content)))
3980    }
3981}
3982
3983/// Retrieve cryptographically strong random bytes from NetHSM. Precondition: NetHSM is *Operational* and a **R-Operator** can be authenticated.
3984pub fn random_post(
3985    configuration: &configuration::Configuration,
3986    random_request_data: crate::models::RandomRequestData,
3987) -> Result<ResponseContent<crate::models::RandomData>, Error<RandomPostError>> {
3988    let local_var_configuration = configuration;
3989
3990    let local_var_client = &local_var_configuration.client;
3991
3992    let local_var_uri_str = format!("{}/random", local_var_configuration.base_path);
3993    let mut local_var_req_builder =
3994        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3995    local_var_req_builder = local_var_req_builder
3996        .config()
3997        .http_status_as_error(false)
3998        .build();
3999
4000    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4001        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4002    }
4003    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4004        let value = super::basic_auth(local_var_auth_conf);
4005
4006        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4007    };
4008    let accept_str = "application/json";
4009    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4010
4011    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4012    let local_var_result = local_var_req_builder.send_json(random_request_data);
4013
4014    let local_var_resp = local_var_result?;
4015
4016    let local_var_status = local_var_resp.status().as_u16();
4017    if local_var_status < 400 {
4018        ResponseContent::deserialized(local_var_resp)
4019    } else {
4020        ResponseContent::new(local_var_resp, |data| {
4021            RandomPostError::new(local_var_status, data).map_err(From::from)
4022        })
4023        .and_then(|content| Err(Error::ResponseError(content)))
4024    }
4025}
4026
4027/// Back up the key store to a backup file.
4028pub fn system_backup_post(
4029    configuration: &configuration::Configuration,
4030) -> Result<ResponseContent<std::vec::Vec<u8>>, Error<SystemBackupPostError>> {
4031    let local_var_configuration = configuration;
4032
4033    let local_var_client = &local_var_configuration.client;
4034
4035    let local_var_uri_str = format!("{}/system/backup", local_var_configuration.base_path);
4036    let mut local_var_req_builder =
4037        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4038    local_var_req_builder = local_var_req_builder
4039        .config()
4040        .http_status_as_error(false)
4041        .build();
4042
4043    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4044        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4045    }
4046    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4047        let value = super::basic_auth(local_var_auth_conf);
4048
4049        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4050    };
4051    let accept_str = "application/octet-stream";
4052    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4053
4054    let local_var_result = local_var_req_builder.send_empty();
4055
4056    let local_var_resp = local_var_result?;
4057
4058    let local_var_status = local_var_resp.status().as_u16();
4059    if local_var_status < 400 {
4060        ResponseContent::bytes(local_var_resp)
4061    } else {
4062        ResponseContent::new(local_var_resp, |data| {
4063            SystemBackupPostError::new(local_var_status, data).map_err(From::from)
4064        })
4065        .and_then(|content| Err(Error::ResponseError(content)))
4066    }
4067}
4068
4069/// Cancel update of NetHSM software.
4070pub fn system_cancel_update_post(
4071    configuration: &configuration::Configuration,
4072) -> Result<ResponseContent<()>, Error<SystemCancelUpdatePostError>> {
4073    let local_var_configuration = configuration;
4074
4075    let local_var_client = &local_var_configuration.client;
4076
4077    let local_var_uri_str = format!("{}/system/cancel-update", local_var_configuration.base_path);
4078    let mut local_var_req_builder =
4079        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4080    local_var_req_builder = local_var_req_builder
4081        .config()
4082        .http_status_as_error(false)
4083        .build();
4084
4085    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4086        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4087    }
4088    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4089        let value = super::basic_auth(local_var_auth_conf);
4090
4091        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4092    };
4093
4094    let local_var_result = local_var_req_builder.send_empty();
4095
4096    let local_var_resp = local_var_result?;
4097
4098    let local_var_status = local_var_resp.status().as_u16();
4099    if local_var_status < 400 {
4100        ResponseContent::unit(local_var_resp)
4101    } else {
4102        ResponseContent::new(local_var_resp, |data| {
4103            SystemCancelUpdatePostError::new(local_var_status, data).map_err(From::from)
4104        })
4105        .and_then(|content| Err(Error::ResponseError(content)))
4106    }
4107}
4108
4109/// Commit update of NetHSM software.
4110pub fn system_commit_update_post(
4111    configuration: &configuration::Configuration,
4112) -> Result<ResponseContent<()>, Error<SystemCommitUpdatePostError>> {
4113    let local_var_configuration = configuration;
4114
4115    let local_var_client = &local_var_configuration.client;
4116
4117    let local_var_uri_str = format!("{}/system/commit-update", local_var_configuration.base_path);
4118    let mut local_var_req_builder =
4119        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4120    local_var_req_builder = local_var_req_builder
4121        .config()
4122        .http_status_as_error(false)
4123        .build();
4124
4125    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4126        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4127    }
4128    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4129        let value = super::basic_auth(local_var_auth_conf);
4130
4131        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4132    };
4133
4134    let local_var_result = local_var_req_builder.send_empty();
4135
4136    let local_var_resp = local_var_result?;
4137
4138    let local_var_status = local_var_resp.status().as_u16();
4139    if local_var_status < 400 {
4140        ResponseContent::unit(local_var_resp)
4141    } else {
4142        ResponseContent::new(local_var_resp, |data| {
4143            SystemCommitUpdatePostError::new(local_var_status, data).map_err(From::from)
4144        })
4145        .and_then(|content| Err(Error::ResponseError(content)))
4146    }
4147}
4148
4149/// Reset NetHSM to factory settings.
4150pub fn system_factory_reset_post(
4151    configuration: &configuration::Configuration,
4152) -> Result<ResponseContent<()>, Error<SystemFactoryResetPostError>> {
4153    let local_var_configuration = configuration;
4154
4155    let local_var_client = &local_var_configuration.client;
4156
4157    let local_var_uri_str = format!("{}/system/factory-reset", local_var_configuration.base_path);
4158    let mut local_var_req_builder =
4159        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4160    local_var_req_builder = local_var_req_builder
4161        .config()
4162        .http_status_as_error(false)
4163        .build();
4164
4165    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4166        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4167    }
4168    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4169        let value = super::basic_auth(local_var_auth_conf);
4170
4171        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4172    };
4173
4174    let local_var_result = local_var_req_builder.send_empty();
4175
4176    let local_var_resp = local_var_result?;
4177
4178    let local_var_status = local_var_resp.status().as_u16();
4179    if local_var_status < 400 {
4180        ResponseContent::unit(local_var_resp)
4181    } else {
4182        ResponseContent::new(local_var_resp, |data| {
4183            SystemFactoryResetPostError::new(local_var_status, data).map_err(From::from)
4184        })
4185        .and_then(|content| Err(Error::ResponseError(content)))
4186    }
4187}
4188
4189/// Get detailed system information, including firmware, system, and hardware version.
4190pub fn system_info_get(
4191    configuration: &configuration::Configuration,
4192) -> Result<ResponseContent<crate::models::SystemInfo>, Error<SystemInfoGetError>> {
4193    let local_var_configuration = configuration;
4194
4195    let local_var_client = &local_var_configuration.client;
4196
4197    let local_var_uri_str = format!("{}/system/info", local_var_configuration.base_path);
4198    let mut local_var_req_builder =
4199        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4200    local_var_req_builder = local_var_req_builder
4201        .config()
4202        .http_status_as_error(false)
4203        .build();
4204
4205    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4206        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4207    }
4208    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4209        let value = super::basic_auth(local_var_auth_conf);
4210
4211        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4212    };
4213    let accept_str = "application/json";
4214    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4215
4216    let local_var_result = local_var_req_builder.send_empty();
4217
4218    let local_var_resp = local_var_result?;
4219
4220    let local_var_status = local_var_resp.status().as_u16();
4221    if local_var_status < 400 {
4222        ResponseContent::deserialized(local_var_resp)
4223    } else {
4224        ResponseContent::new(local_var_resp, |data| {
4225            SystemInfoGetError::new(local_var_status, data).map_err(From::from)
4226        })
4227        .and_then(|content| Err(Error::ResponseError(content)))
4228    }
4229}
4230
4231/// Reboot NetHSM.
4232pub fn system_reboot_post(
4233    configuration: &configuration::Configuration,
4234) -> Result<ResponseContent<()>, Error<SystemRebootPostError>> {
4235    let local_var_configuration = configuration;
4236
4237    let local_var_client = &local_var_configuration.client;
4238
4239    let local_var_uri_str = format!("{}/system/reboot", local_var_configuration.base_path);
4240    let mut local_var_req_builder =
4241        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4242    local_var_req_builder = local_var_req_builder
4243        .config()
4244        .http_status_as_error(false)
4245        .build();
4246
4247    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4248        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4249    }
4250    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4251        let value = super::basic_auth(local_var_auth_conf);
4252
4253        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4254    };
4255
4256    let local_var_result = local_var_req_builder.send_empty();
4257
4258    let local_var_resp = local_var_result?;
4259
4260    let local_var_status = local_var_resp.status().as_u16();
4261    if local_var_status < 400 {
4262        ResponseContent::unit(local_var_resp)
4263    } else {
4264        ResponseContent::new(local_var_resp, |data| {
4265            SystemRebootPostError::new(local_var_status, data).map_err(From::from)
4266        })
4267        .and_then(|content| Err(Error::ResponseError(content)))
4268    }
4269}
4270
4271/// Restore the key store and user store from a backup file. If NetHSM is *Unprovisioned*, then the configuration is restored.
4272pub fn system_restore_post(
4273    configuration: &configuration::Configuration,
4274    arguments: Option<crate::models::RestoreRequestArguments>,
4275    backup_file: Option<std::vec::Vec<u8>>,
4276) -> Result<ResponseContent<()>, Error<SystemRestorePostError>> {
4277    let local_var_configuration = configuration;
4278
4279    let local_var_client = &local_var_configuration.client;
4280
4281    let local_var_uri_str = format!("{}/system/restore", local_var_configuration.base_path);
4282    let mut local_var_req_builder =
4283        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4284    local_var_req_builder = local_var_req_builder
4285        .config()
4286        .http_status_as_error(false)
4287        .build();
4288
4289    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4290        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4291    }
4292    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4293        let value = super::basic_auth(local_var_auth_conf);
4294
4295        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4296    };
4297
4298    let mut local_var_multipart = ::multipart::client::lazy::Multipart::new();
4299
4300    if let Some(backup_file) = backup_file {
4301        local_var_multipart.add_stream(
4302            "backup_file",
4303            ::std::io::Cursor::new(backup_file),
4304            None::<&str>,
4305            None,
4306        );
4307    }
4308    if let Some(arguments) = arguments {
4309        let arguments = ::serde_json::to_vec(&arguments)?;
4310        local_var_multipart.add_stream(
4311            "arguments",
4312            ::std::io::Cursor::new(arguments),
4313            None::<&str>,
4314            None,
4315        );
4316    }
4317
4318    let mut local_var_multipart = local_var_multipart.prepare()?;
4319    local_var_req_builder = local_var_req_builder.header(
4320        "content-type",
4321        &format!(
4322            "multipart/form-data; boundary={}",
4323            local_var_multipart.boundary()
4324        ),
4325    );
4326    let local_var_result =
4327        local_var_req_builder.send(ureq::SendBody::from_reader(&mut local_var_multipart));
4328
4329    let local_var_resp = local_var_result?;
4330
4331    let local_var_status = local_var_resp.status().as_u16();
4332    if local_var_status < 400 {
4333        ResponseContent::unit(local_var_resp)
4334    } else {
4335        ResponseContent::new(local_var_resp, |data| {
4336            SystemRestorePostError::new(local_var_status, data).map_err(From::from)
4337        })
4338        .and_then(|content| Err(Error::ResponseError(content)))
4339    }
4340}
4341
4342/// Shut down NetHSM.  Authentication behavior varies by NetHSM state: - **Operational**: Requires Administrator authentication - **Locked** or **Unprovisioned**: No authentication required
4343pub fn system_shutdown_post(
4344    configuration: &configuration::Configuration,
4345) -> Result<ResponseContent<()>, Error<SystemShutdownPostError>> {
4346    let local_var_configuration = configuration;
4347
4348    let local_var_client = &local_var_configuration.client;
4349
4350    let local_var_uri_str = format!("{}/system/shutdown", local_var_configuration.base_path);
4351    let mut local_var_req_builder =
4352        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4353    local_var_req_builder = local_var_req_builder
4354        .config()
4355        .http_status_as_error(false)
4356        .build();
4357
4358    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4359        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4360    }
4361    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4362        let value = super::basic_auth(local_var_auth_conf);
4363
4364        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4365    };
4366
4367    let local_var_result = local_var_req_builder.send_empty();
4368
4369    let local_var_resp = local_var_result?;
4370
4371    let local_var_status = local_var_resp.status().as_u16();
4372    if local_var_status < 400 {
4373        ResponseContent::unit(local_var_resp)
4374    } else {
4375        ResponseContent::new(local_var_resp, |data| {
4376            SystemShutdownPostError::new(local_var_status, data).map_err(From::from)
4377        })
4378        .and_then(|content| Err(Error::ResponseError(content)))
4379    }
4380}
4381
4382/// Update NetHSM software.
4383pub fn system_update_post(
4384    configuration: &configuration::Configuration,
4385    body: std::vec::Vec<u8>,
4386) -> Result<ResponseContent<crate::models::SystemUpdateData>, Error<SystemUpdatePostError>> {
4387    let local_var_configuration = configuration;
4388
4389    let local_var_client = &local_var_configuration.client;
4390
4391    let local_var_uri_str = format!("{}/system/update", local_var_configuration.base_path);
4392    let mut local_var_req_builder =
4393        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4394    local_var_req_builder = local_var_req_builder
4395        .config()
4396        .http_status_as_error(false)
4397        .build();
4398
4399    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4400        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4401    }
4402    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4403        let value = super::basic_auth(local_var_auth_conf);
4404
4405        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4406    };
4407    let accept_str = "application/json";
4408    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4409
4410    local_var_req_builder =
4411        local_var_req_builder.header("content-type", "application/octet-stream");
4412    let local_var_result = local_var_req_builder.send(body);
4413
4414    let local_var_resp = local_var_result?;
4415
4416    let local_var_status = local_var_resp.status().as_u16();
4417    if local_var_status < 400 {
4418        ResponseContent::deserialized(local_var_resp)
4419    } else {
4420        ResponseContent::new(local_var_resp, |data| {
4421            SystemUpdatePostError::new(local_var_status, data).map_err(From::from)
4422        })
4423        .and_then(|content| Err(Error::ResponseError(content)))
4424    }
4425}
4426
4427/// Brings a *Locked* NetHSM into *Operational* state.
4428pub fn unlock_post(
4429    configuration: &configuration::Configuration,
4430    unlock_request_data: crate::models::UnlockRequestData,
4431) -> Result<ResponseContent<()>, Error<UnlockPostError>> {
4432    let local_var_configuration = configuration;
4433
4434    let local_var_client = &local_var_configuration.client;
4435
4436    let local_var_uri_str = format!("{}/unlock", local_var_configuration.base_path);
4437    let mut local_var_req_builder =
4438        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4439    local_var_req_builder = local_var_req_builder
4440        .config()
4441        .http_status_as_error(false)
4442        .build();
4443
4444    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4445        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4446    }
4447
4448    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4449    let local_var_result = local_var_req_builder.send_json(unlock_request_data);
4450
4451    let local_var_resp = local_var_result?;
4452
4453    let local_var_status = local_var_resp.status().as_u16();
4454    if local_var_status < 400 {
4455        ResponseContent::unit(local_var_resp)
4456    } else {
4457        ResponseContent::new(local_var_resp, |data| {
4458            UnlockPostError::new(local_var_status, data).map_err(From::from)
4459        })
4460        .and_then(|content| Err(Error::ResponseError(content)))
4461    }
4462}
4463
4464/// Get a list of all user ids that have accounts on NetHSM. If the caller is in a namespace, return only users in that namespace.
4465pub fn users_get(
4466    configuration: &configuration::Configuration,
4467) -> Result<ResponseContent<Vec<crate::models::UserItem>>, Error<UsersGetError>> {
4468    let local_var_configuration = configuration;
4469
4470    let local_var_client = &local_var_configuration.client;
4471
4472    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
4473    let mut local_var_req_builder =
4474        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4475    local_var_req_builder = local_var_req_builder
4476        .config()
4477        .http_status_as_error(false)
4478        .build();
4479
4480    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4481        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4482    }
4483    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4484        let value = super::basic_auth(local_var_auth_conf);
4485
4486        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4487    };
4488    let accept_str = "application/json";
4489    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4490
4491    let local_var_result = local_var_req_builder.send_empty();
4492
4493    let local_var_resp = local_var_result?;
4494
4495    let local_var_status = local_var_resp.status().as_u16();
4496    if local_var_status < 400 {
4497        ResponseContent::deserialized(local_var_resp)
4498    } else {
4499        ResponseContent::new(local_var_resp, |data| {
4500            UsersGetError::new(local_var_status, data).map_err(From::from)
4501        })
4502        .and_then(|content| Err(Error::ResponseError(content)))
4503    }
4504}
4505
4506/// Create a new user on NetHSM, inheriting the caller's namespace. The user-ID is generated by NetHSM.
4507pub fn users_post(
4508    configuration: &configuration::Configuration,
4509    user_post_data: crate::models::UserPostData,
4510) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<UsersPostError>> {
4511    let local_var_configuration = configuration;
4512
4513    let local_var_client = &local_var_configuration.client;
4514
4515    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
4516    let mut local_var_req_builder =
4517        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4518    local_var_req_builder = local_var_req_builder
4519        .config()
4520        .http_status_as_error(false)
4521        .build();
4522
4523    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4524        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4525    }
4526    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4527        let value = super::basic_auth(local_var_auth_conf);
4528
4529        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4530    };
4531    let accept_str = "application/json";
4532    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4533
4534    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4535    let local_var_result = local_var_req_builder.send_json(user_post_data);
4536
4537    let local_var_resp = local_var_result?;
4538
4539    let local_var_status = local_var_resp.status().as_u16();
4540    if local_var_status < 400 {
4541        ResponseContent::deserialized(local_var_resp)
4542    } else {
4543        ResponseContent::new(local_var_resp, |data| {
4544            UsersPostError::new(local_var_status, data).map_err(From::from)
4545        })
4546        .and_then(|content| Err(Error::ResponseError(content)))
4547    }
4548}
4549
4550/// Delete a user from keyfender.
4551pub fn users_user_id_delete(
4552    configuration: &configuration::Configuration,
4553    user_id: &str,
4554) -> Result<ResponseContent<()>, Error<UsersUserIdDeleteError>> {
4555    let local_var_configuration = configuration;
4556
4557    let local_var_client = &local_var_configuration.client;
4558
4559    let local_var_uri_str = format!(
4560        "{}/users/{UserID}",
4561        local_var_configuration.base_path,
4562        UserID = crate::apis::urlencode(user_id)
4563    );
4564    let mut local_var_req_builder =
4565        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
4566    local_var_req_builder = local_var_req_builder
4567        .config()
4568        .http_status_as_error(false)
4569        .build();
4570
4571    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4572        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4573    }
4574    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4575        let value = super::basic_auth(local_var_auth_conf);
4576
4577        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4578    };
4579
4580    let local_var_result = local_var_req_builder.send_empty();
4581
4582    let local_var_resp = local_var_result?;
4583
4584    let local_var_status = local_var_resp.status().as_u16();
4585    if local_var_status < 400 {
4586        ResponseContent::unit(local_var_resp)
4587    } else {
4588        ResponseContent::new(local_var_resp, |data| {
4589            UsersUserIdDeleteError::new(local_var_status, data).map_err(From::from)
4590        })
4591        .and_then(|content| Err(Error::ResponseError(content)))
4592    }
4593}
4594
4595/// Get user info: name and role.
4596pub fn users_user_id_get(
4597    configuration: &configuration::Configuration,
4598    user_id: &str,
4599) -> Result<ResponseContent<crate::models::UserData>, Error<UsersUserIdGetError>> {
4600    let local_var_configuration = configuration;
4601
4602    let local_var_client = &local_var_configuration.client;
4603
4604    let local_var_uri_str = format!(
4605        "{}/users/{UserID}",
4606        local_var_configuration.base_path,
4607        UserID = crate::apis::urlencode(user_id)
4608    );
4609    let mut local_var_req_builder =
4610        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4611    local_var_req_builder = local_var_req_builder
4612        .config()
4613        .http_status_as_error(false)
4614        .build();
4615
4616    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4617        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4618    }
4619    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4620        let value = super::basic_auth(local_var_auth_conf);
4621
4622        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4623    };
4624    let accept_str = "application/json";
4625    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4626
4627    let local_var_result = local_var_req_builder.send_empty();
4628
4629    let local_var_resp = local_var_result?;
4630
4631    let local_var_status = local_var_resp.status().as_u16();
4632    if local_var_status < 400 {
4633        ResponseContent::deserialized(local_var_resp)
4634    } else {
4635        ResponseContent::new(local_var_resp, |data| {
4636            UsersUserIdGetError::new(local_var_status, data).map_err(From::from)
4637        })
4638        .and_then(|content| Err(Error::ResponseError(content)))
4639    }
4640}
4641
4642/// Update the passphrase.
4643pub fn users_user_id_passphrase_post(
4644    configuration: &configuration::Configuration,
4645    user_id: &str,
4646    user_passphrase_post_data: crate::models::UserPassphrasePostData,
4647) -> Result<ResponseContent<()>, Error<UsersUserIdPassphrasePostError>> {
4648    let local_var_configuration = configuration;
4649
4650    let local_var_client = &local_var_configuration.client;
4651
4652    let local_var_uri_str = format!(
4653        "{}/users/{UserID}/passphrase",
4654        local_var_configuration.base_path,
4655        UserID = crate::apis::urlencode(user_id)
4656    );
4657    let mut local_var_req_builder =
4658        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4659    local_var_req_builder = local_var_req_builder
4660        .config()
4661        .http_status_as_error(false)
4662        .build();
4663
4664    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4665        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4666    }
4667    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4668        let value = super::basic_auth(local_var_auth_conf);
4669
4670        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4671    };
4672
4673    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4674    let local_var_result = local_var_req_builder.send_json(user_passphrase_post_data);
4675
4676    let local_var_resp = local_var_result?;
4677
4678    let local_var_status = local_var_resp.status().as_u16();
4679    if local_var_status < 400 {
4680        ResponseContent::unit(local_var_resp)
4681    } else {
4682        ResponseContent::new(local_var_resp, |data| {
4683            UsersUserIdPassphrasePostError::new(local_var_status, data).map_err(From::from)
4684        })
4685        .and_then(|content| Err(Error::ResponseError(content)))
4686    }
4687}
4688
4689/// Create a new user on NetHSM, in the namespace specified as a prefix in the path with the format 'namespace~'. For example, a POST request on \"https://nethsm.local/v1/users/namespace1~\" will generate a user-ID and create that user in \"namespace1\". The namespace prefix *must* be present: for creating users without a namespace, use a POST on \"/v1/users\".
4690pub fn users_user_id_post(
4691    configuration: &configuration::Configuration,
4692    user_id: &str,
4693    user_post_data: crate::models::UserPostData,
4694) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<UsersUserIdPostError>> {
4695    let local_var_configuration = configuration;
4696
4697    let local_var_client = &local_var_configuration.client;
4698
4699    let local_var_uri_str = format!(
4700        "{}/users/{UserID}",
4701        local_var_configuration.base_path,
4702        UserID = crate::apis::urlencode(user_id)
4703    );
4704    let mut local_var_req_builder =
4705        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4706    local_var_req_builder = local_var_req_builder
4707        .config()
4708        .http_status_as_error(false)
4709        .build();
4710
4711    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4712        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4713    }
4714    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4715        let value = super::basic_auth(local_var_auth_conf);
4716
4717        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4718    };
4719    let accept_str = "application/json";
4720    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4721
4722    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4723    let local_var_result = local_var_req_builder.send_json(user_post_data);
4724
4725    let local_var_resp = local_var_result?;
4726
4727    let local_var_status = local_var_resp.status().as_u16();
4728    if local_var_status < 400 {
4729        ResponseContent::deserialized(local_var_resp)
4730    } else {
4731        ResponseContent::new(local_var_resp, |data| {
4732            UsersUserIdPostError::new(local_var_status, data).map_err(From::from)
4733        })
4734        .and_then(|content| Err(Error::ResponseError(content)))
4735    }
4736}
4737
4738/// Create a user on keyfender. The new user must either be in the same namespace as the caller, or be in a namespace not created yet if the caller has no namespace.
4739pub fn users_user_id_put(
4740    configuration: &configuration::Configuration,
4741    user_id: &str,
4742    user_post_data: crate::models::UserPostData,
4743) -> Result<ResponseContent<()>, Error<UsersUserIdPutError>> {
4744    let local_var_configuration = configuration;
4745
4746    let local_var_client = &local_var_configuration.client;
4747
4748    let local_var_uri_str = format!(
4749        "{}/users/{UserID}",
4750        local_var_configuration.base_path,
4751        UserID = crate::apis::urlencode(user_id)
4752    );
4753    let mut local_var_req_builder =
4754        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
4755    local_var_req_builder = local_var_req_builder
4756        .config()
4757        .http_status_as_error(false)
4758        .build();
4759
4760    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4761        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4762    }
4763    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4764        let value = super::basic_auth(local_var_auth_conf);
4765
4766        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4767    };
4768
4769    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4770    let local_var_result = local_var_req_builder.send_json(user_post_data);
4771
4772    let local_var_resp = local_var_result?;
4773
4774    let local_var_status = local_var_resp.status().as_u16();
4775    if local_var_status < 400 {
4776        ResponseContent::unit(local_var_resp)
4777    } else {
4778        ResponseContent::new(local_var_resp, |data| {
4779            UsersUserIdPutError::new(local_var_status, data).map_err(From::from)
4780        })
4781        .and_then(|content| Err(Error::ResponseError(content)))
4782    }
4783}
4784
4785/// Get the list of tags set to an Operator user.
4786pub fn users_user_id_tags_get(
4787    configuration: &configuration::Configuration,
4788    user_id: &str,
4789) -> Result<ResponseContent<Vec<String>>, Error<UsersUserIdTagsGetError>> {
4790    let local_var_configuration = configuration;
4791
4792    let local_var_client = &local_var_configuration.client;
4793
4794    let local_var_uri_str = format!(
4795        "{}/users/{UserID}/tags",
4796        local_var_configuration.base_path,
4797        UserID = crate::apis::urlencode(user_id)
4798    );
4799    let mut local_var_req_builder =
4800        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4801    local_var_req_builder = local_var_req_builder
4802        .config()
4803        .http_status_as_error(false)
4804        .build();
4805
4806    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4807        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4808    }
4809    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4810        let value = super::basic_auth(local_var_auth_conf);
4811
4812        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4813    };
4814    let accept_str = "application/json";
4815    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4816
4817    let local_var_result = local_var_req_builder.send_empty();
4818
4819    let local_var_resp = local_var_result?;
4820
4821    let local_var_status = local_var_resp.status().as_u16();
4822    if local_var_status < 400 {
4823        ResponseContent::deserialized(local_var_resp)
4824    } else {
4825        ResponseContent::new(local_var_resp, |data| {
4826            UsersUserIdTagsGetError::new(local_var_status, data).map_err(From::from)
4827        })
4828        .and_then(|content| Err(Error::ResponseError(content)))
4829    }
4830}
4831
4832/// Delete a tag from the Operator user
4833pub fn users_user_id_tags_tag_delete(
4834    configuration: &configuration::Configuration,
4835    user_id: &str,
4836    tag: &str,
4837) -> Result<ResponseContent<()>, Error<UsersUserIdTagsTagDeleteError>> {
4838    let local_var_configuration = configuration;
4839
4840    let local_var_client = &local_var_configuration.client;
4841
4842    let local_var_uri_str = format!(
4843        "{}/users/{UserID}/tags/{Tag}",
4844        local_var_configuration.base_path,
4845        UserID = crate::apis::urlencode(user_id),
4846        Tag = crate::apis::urlencode(tag)
4847    );
4848    let mut local_var_req_builder =
4849        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
4850    local_var_req_builder = local_var_req_builder
4851        .config()
4852        .http_status_as_error(false)
4853        .build();
4854
4855    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4856        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4857    }
4858    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4859        let value = super::basic_auth(local_var_auth_conf);
4860
4861        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4862    };
4863
4864    let local_var_result = local_var_req_builder.send_empty();
4865
4866    let local_var_resp = local_var_result?;
4867
4868    let local_var_status = local_var_resp.status().as_u16();
4869    if local_var_status < 400 {
4870        ResponseContent::unit(local_var_resp)
4871    } else {
4872        ResponseContent::new(local_var_resp, |data| {
4873            UsersUserIdTagsTagDeleteError::new(local_var_status, data).map_err(From::from)
4874        })
4875        .and_then(|content| Err(Error::ResponseError(content)))
4876    }
4877}
4878
4879/// Add a tag to the Operator user.
4880pub fn users_user_id_tags_tag_put(
4881    configuration: &configuration::Configuration,
4882    user_id: &str,
4883    tag: &str,
4884) -> Result<ResponseContent<()>, Error<UsersUserIdTagsTagPutError>> {
4885    let local_var_configuration = configuration;
4886
4887    let local_var_client = &local_var_configuration.client;
4888
4889    let local_var_uri_str = format!(
4890        "{}/users/{UserID}/tags/{Tag}",
4891        local_var_configuration.base_path,
4892        UserID = crate::apis::urlencode(user_id),
4893        Tag = crate::apis::urlencode(tag)
4894    );
4895    let mut local_var_req_builder =
4896        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
4897    local_var_req_builder = local_var_req_builder
4898        .config()
4899        .http_status_as_error(false)
4900        .build();
4901
4902    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4903        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4904    }
4905    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4906        let value = super::basic_auth(local_var_auth_conf);
4907
4908        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4909    };
4910
4911    let local_var_result = local_var_req_builder.send_empty();
4912
4913    let local_var_resp = local_var_result?;
4914
4915    let local_var_status = local_var_resp.status().as_u16();
4916    if local_var_status < 400 {
4917        ResponseContent::unit(local_var_resp)
4918    } else {
4919        ResponseContent::new(local_var_resp, |data| {
4920            UsersUserIdTagsTagPutError::new(local_var_status, data).map_err(From::from)
4921        })
4922        .and_then(|content| Err(Error::ResponseError(content)))
4923    }
4924}