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_public_pem_get`]
967#[derive(Debug, Clone, Serialize, Deserialize)]
968#[serde(untagged)]
969pub enum KeysKeyIdPublicPemGetError {
970    Status400(),
971    Status401(),
972    Status403(),
973    Status404(),
974    Status406(),
975    Status412(),
976    UnknownValue(serde_json::Value),
977}
978
979impl KeysKeyIdPublicPemGetError {
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            406 => Ok(Self::Status406()),
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_put`]
1001#[derive(Debug, Clone, Serialize, Deserialize)]
1002#[serde(untagged)]
1003pub enum KeysKeyIdPutError {
1004    Status400(),
1005    Status401(),
1006    Status403(),
1007    Status406(),
1008    Status409(),
1009    Status412(),
1010    UnknownValue(serde_json::Value),
1011}
1012
1013impl KeysKeyIdPutError {
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            406 => Ok(Self::Status406()),
1021            409 => Ok(Self::Status409()),
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_restrictions_tags_tag_delete`]
1035#[derive(Debug, Clone, Serialize, Deserialize)]
1036#[serde(untagged)]
1037pub enum KeysKeyIdRestrictionsTagsTagDeleteError {
1038    Status401(),
1039    Status403(),
1040    Status404(),
1041    Status406(),
1042    Status412(),
1043    UnknownValue(serde_json::Value),
1044}
1045
1046impl KeysKeyIdRestrictionsTagsTagDeleteError {
1047    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1048        // to do: support payloads once added to API spec
1049        match status {
1050            401 => Ok(Self::Status401()),
1051            403 => Ok(Self::Status403()),
1052            404 => Ok(Self::Status404()),
1053            406 => Ok(Self::Status406()),
1054            412 => Ok(Self::Status412()),
1055            _ => {
1056                if data.is_empty() {
1057                    Ok(Self::UnknownValue(serde_json::Value::Null))
1058                } else {
1059                    serde_json::from_slice(data).map(Self::UnknownValue)
1060                }
1061            }
1062        }
1063    }
1064}
1065
1066/// struct for typed errors of method [`keys_key_id_restrictions_tags_tag_put`]
1067#[derive(Debug, Clone, Serialize, Deserialize)]
1068#[serde(untagged)]
1069pub enum KeysKeyIdRestrictionsTagsTagPutError {
1070    Status400(),
1071    Status401(),
1072    Status403(),
1073    Status404(),
1074    Status406(),
1075    Status412(),
1076    UnknownValue(serde_json::Value),
1077}
1078
1079impl KeysKeyIdRestrictionsTagsTagPutError {
1080    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1081        // to do: support payloads once added to API spec
1082        match status {
1083            400 => Ok(Self::Status400()),
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_sign_post`]
1101#[derive(Debug, Clone, Serialize, Deserialize)]
1102#[serde(untagged)]
1103pub enum KeysKeyIdSignPostError {
1104    Status400(),
1105    Status401(),
1106    Status403(),
1107    Status404(),
1108    Status406(),
1109    Status412(),
1110    UnknownValue(serde_json::Value),
1111}
1112
1113impl KeysKeyIdSignPostError {
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_post`]
1135#[derive(Debug, Clone, Serialize, Deserialize)]
1136#[serde(untagged)]
1137pub enum KeysPostError {
1138    Status400(),
1139    Status401(),
1140    Status403(),
1141    Status406(),
1142    Status412(),
1143    UnknownValue(serde_json::Value),
1144}
1145
1146impl KeysPostError {
1147    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1148        // to do: support payloads once added to API spec
1149        match status {
1150            400 => Ok(Self::Status400()),
1151            401 => Ok(Self::Status401()),
1152            403 => Ok(Self::Status403()),
1153            406 => Ok(Self::Status406()),
1154            412 => Ok(Self::Status412()),
1155            _ => {
1156                if data.is_empty() {
1157                    Ok(Self::UnknownValue(serde_json::Value::Null))
1158                } else {
1159                    serde_json::from_slice(data).map(Self::UnknownValue)
1160                }
1161            }
1162        }
1163    }
1164}
1165
1166/// struct for typed errors of method [`lock_post`]
1167#[derive(Debug, Clone, Serialize, Deserialize)]
1168#[serde(untagged)]
1169pub enum LockPostError {
1170    Status401(),
1171    Status403(),
1172    Status406(),
1173    Status412(),
1174    UnknownValue(serde_json::Value),
1175}
1176
1177impl LockPostError {
1178    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1179        // to do: support payloads once added to API spec
1180        match status {
1181            401 => Ok(Self::Status401()),
1182            403 => Ok(Self::Status403()),
1183            406 => Ok(Self::Status406()),
1184            412 => Ok(Self::Status412()),
1185            _ => {
1186                if data.is_empty() {
1187                    Ok(Self::UnknownValue(serde_json::Value::Null))
1188                } else {
1189                    serde_json::from_slice(data).map(Self::UnknownValue)
1190                }
1191            }
1192        }
1193    }
1194}
1195
1196/// struct for typed errors of method [`metrics_get`]
1197#[derive(Debug, Clone, Serialize, Deserialize)]
1198#[serde(untagged)]
1199pub enum MetricsGetError {
1200    Status401(),
1201    Status403(),
1202    Status406(),
1203    Status412(),
1204    UnknownValue(serde_json::Value),
1205}
1206
1207impl MetricsGetError {
1208    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1209        // to do: support payloads once added to API spec
1210        match status {
1211            401 => Ok(Self::Status401()),
1212            403 => Ok(Self::Status403()),
1213            406 => Ok(Self::Status406()),
1214            412 => Ok(Self::Status412()),
1215            _ => {
1216                if data.is_empty() {
1217                    Ok(Self::UnknownValue(serde_json::Value::Null))
1218                } else {
1219                    serde_json::from_slice(data).map(Self::UnknownValue)
1220                }
1221            }
1222        }
1223    }
1224}
1225
1226/// struct for typed errors of method [`namespaces_get`]
1227#[derive(Debug, Clone, Serialize, Deserialize)]
1228#[serde(untagged)]
1229pub enum NamespacesGetError {
1230    Status401(),
1231    Status403(),
1232    Status406(),
1233    Status412(),
1234    UnknownValue(serde_json::Value),
1235}
1236
1237impl NamespacesGetError {
1238    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1239        // to do: support payloads once added to API spec
1240        match status {
1241            401 => Ok(Self::Status401()),
1242            403 => Ok(Self::Status403()),
1243            406 => Ok(Self::Status406()),
1244            412 => Ok(Self::Status412()),
1245            _ => {
1246                if data.is_empty() {
1247                    Ok(Self::UnknownValue(serde_json::Value::Null))
1248                } else {
1249                    serde_json::from_slice(data).map(Self::UnknownValue)
1250                }
1251            }
1252        }
1253    }
1254}
1255
1256/// struct for typed errors of method [`namespaces_namespace_id_delete`]
1257#[derive(Debug, Clone, Serialize, Deserialize)]
1258#[serde(untagged)]
1259pub enum NamespacesNamespaceIdDeleteError {
1260    Status400(),
1261    Status401(),
1262    Status403(),
1263    Status404(),
1264    Status412(),
1265    UnknownValue(serde_json::Value),
1266}
1267
1268impl NamespacesNamespaceIdDeleteError {
1269    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1270        // to do: support payloads once added to API spec
1271        match status {
1272            400 => Ok(Self::Status400()),
1273            401 => Ok(Self::Status401()),
1274            403 => Ok(Self::Status403()),
1275            404 => Ok(Self::Status404()),
1276            412 => Ok(Self::Status412()),
1277            _ => {
1278                if data.is_empty() {
1279                    Ok(Self::UnknownValue(serde_json::Value::Null))
1280                } else {
1281                    serde_json::from_slice(data).map(Self::UnknownValue)
1282                }
1283            }
1284        }
1285    }
1286}
1287
1288/// struct for typed errors of method [`namespaces_namespace_id_put`]
1289#[derive(Debug, Clone, Serialize, Deserialize)]
1290#[serde(untagged)]
1291pub enum NamespacesNamespaceIdPutError {
1292    Status400(),
1293    Status401(),
1294    Status403(),
1295    Status406(),
1296    Status409(),
1297    Status412(),
1298    UnknownValue(serde_json::Value),
1299}
1300
1301impl NamespacesNamespaceIdPutError {
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            400 => Ok(Self::Status400()),
1306            401 => Ok(Self::Status401()),
1307            403 => Ok(Self::Status403()),
1308            406 => Ok(Self::Status406()),
1309            409 => Ok(Self::Status409()),
1310            412 => Ok(Self::Status412()),
1311            _ => {
1312                if data.is_empty() {
1313                    Ok(Self::UnknownValue(serde_json::Value::Null))
1314                } else {
1315                    serde_json::from_slice(data).map(Self::UnknownValue)
1316                }
1317            }
1318        }
1319    }
1320}
1321
1322/// struct for typed errors of method [`provision_post`]
1323#[derive(Debug, Clone, Serialize, Deserialize)]
1324#[serde(untagged)]
1325pub enum ProvisionPostError {
1326    Status400(),
1327    Status406(),
1328    Status412(),
1329    UnknownValue(serde_json::Value),
1330}
1331
1332impl ProvisionPostError {
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            406 => Ok(Self::Status406()),
1338            412 => Ok(Self::Status412()),
1339            _ => {
1340                if data.is_empty() {
1341                    Ok(Self::UnknownValue(serde_json::Value::Null))
1342                } else {
1343                    serde_json::from_slice(data).map(Self::UnknownValue)
1344                }
1345            }
1346        }
1347    }
1348}
1349
1350/// struct for typed errors of method [`random_post`]
1351#[derive(Debug, Clone, Serialize, Deserialize)]
1352#[serde(untagged)]
1353pub enum RandomPostError {
1354    Status400(),
1355    Status401(),
1356    Status403(),
1357    Status406(),
1358    Status412(),
1359    UnknownValue(serde_json::Value),
1360}
1361
1362impl RandomPostError {
1363    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1364        // to do: support payloads once added to API spec
1365        match status {
1366            400 => Ok(Self::Status400()),
1367            401 => Ok(Self::Status401()),
1368            403 => Ok(Self::Status403()),
1369            406 => Ok(Self::Status406()),
1370            412 => Ok(Self::Status412()),
1371            _ => {
1372                if data.is_empty() {
1373                    Ok(Self::UnknownValue(serde_json::Value::Null))
1374                } else {
1375                    serde_json::from_slice(data).map(Self::UnknownValue)
1376                }
1377            }
1378        }
1379    }
1380}
1381
1382/// struct for typed errors of method [`system_backup_post`]
1383#[derive(Debug, Clone, Serialize, Deserialize)]
1384#[serde(untagged)]
1385pub enum SystemBackupPostError {
1386    Status401(),
1387    Status403(),
1388    Status406(),
1389    Status412(),
1390    UnknownValue(serde_json::Value),
1391}
1392
1393impl SystemBackupPostError {
1394    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1395        // to do: support payloads once added to API spec
1396        match status {
1397            401 => Ok(Self::Status401()),
1398            403 => Ok(Self::Status403()),
1399            406 => Ok(Self::Status406()),
1400            412 => Ok(Self::Status412()),
1401            _ => {
1402                if data.is_empty() {
1403                    Ok(Self::UnknownValue(serde_json::Value::Null))
1404                } else {
1405                    serde_json::from_slice(data).map(Self::UnknownValue)
1406                }
1407            }
1408        }
1409    }
1410}
1411
1412/// struct for typed errors of method [`system_cancel_update_post`]
1413#[derive(Debug, Clone, Serialize, Deserialize)]
1414#[serde(untagged)]
1415pub enum SystemCancelUpdatePostError {
1416    Status401(),
1417    Status403(),
1418    Status406(),
1419    Status412(),
1420    UnknownValue(serde_json::Value),
1421}
1422
1423impl SystemCancelUpdatePostError {
1424    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1425        // to do: support payloads once added to API spec
1426        match status {
1427            401 => Ok(Self::Status401()),
1428            403 => Ok(Self::Status403()),
1429            406 => Ok(Self::Status406()),
1430            412 => Ok(Self::Status412()),
1431            _ => {
1432                if data.is_empty() {
1433                    Ok(Self::UnknownValue(serde_json::Value::Null))
1434                } else {
1435                    serde_json::from_slice(data).map(Self::UnknownValue)
1436                }
1437            }
1438        }
1439    }
1440}
1441
1442/// struct for typed errors of method [`system_commit_update_post`]
1443#[derive(Debug, Clone, Serialize, Deserialize)]
1444#[serde(untagged)]
1445pub enum SystemCommitUpdatePostError {
1446    Status401(),
1447    Status403(),
1448    Status406(),
1449    Status412(),
1450    UnknownValue(serde_json::Value),
1451}
1452
1453impl SystemCommitUpdatePostError {
1454    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1455        // to do: support payloads once added to API spec
1456        match status {
1457            401 => Ok(Self::Status401()),
1458            403 => Ok(Self::Status403()),
1459            406 => Ok(Self::Status406()),
1460            412 => Ok(Self::Status412()),
1461            _ => {
1462                if data.is_empty() {
1463                    Ok(Self::UnknownValue(serde_json::Value::Null))
1464                } else {
1465                    serde_json::from_slice(data).map(Self::UnknownValue)
1466                }
1467            }
1468        }
1469    }
1470}
1471
1472/// struct for typed errors of method [`system_factory_reset_post`]
1473#[derive(Debug, Clone, Serialize, Deserialize)]
1474#[serde(untagged)]
1475pub enum SystemFactoryResetPostError {
1476    Status401(),
1477    Status403(),
1478    Status406(),
1479    Status412(),
1480    UnknownValue(serde_json::Value),
1481}
1482
1483impl SystemFactoryResetPostError {
1484    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1485        // to do: support payloads once added to API spec
1486        match status {
1487            401 => Ok(Self::Status401()),
1488            403 => Ok(Self::Status403()),
1489            406 => Ok(Self::Status406()),
1490            412 => Ok(Self::Status412()),
1491            _ => {
1492                if data.is_empty() {
1493                    Ok(Self::UnknownValue(serde_json::Value::Null))
1494                } else {
1495                    serde_json::from_slice(data).map(Self::UnknownValue)
1496                }
1497            }
1498        }
1499    }
1500}
1501
1502/// struct for typed errors of method [`system_info_get`]
1503#[derive(Debug, Clone, Serialize, Deserialize)]
1504#[serde(untagged)]
1505pub enum SystemInfoGetError {
1506    Status401(),
1507    Status403(),
1508    Status406(),
1509    Status412(),
1510    UnknownValue(serde_json::Value),
1511}
1512
1513impl SystemInfoGetError {
1514    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1515        // to do: support payloads once added to API spec
1516        match status {
1517            401 => Ok(Self::Status401()),
1518            403 => Ok(Self::Status403()),
1519            406 => Ok(Self::Status406()),
1520            412 => Ok(Self::Status412()),
1521            _ => {
1522                if data.is_empty() {
1523                    Ok(Self::UnknownValue(serde_json::Value::Null))
1524                } else {
1525                    serde_json::from_slice(data).map(Self::UnknownValue)
1526                }
1527            }
1528        }
1529    }
1530}
1531
1532/// struct for typed errors of method [`system_reboot_post`]
1533#[derive(Debug, Clone, Serialize, Deserialize)]
1534#[serde(untagged)]
1535pub enum SystemRebootPostError {
1536    Status401(),
1537    Status403(),
1538    Status406(),
1539    Status412(),
1540    UnknownValue(serde_json::Value),
1541}
1542
1543impl SystemRebootPostError {
1544    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1545        // to do: support payloads once added to API spec
1546        match status {
1547            401 => Ok(Self::Status401()),
1548            403 => Ok(Self::Status403()),
1549            406 => Ok(Self::Status406()),
1550            412 => Ok(Self::Status412()),
1551            _ => {
1552                if data.is_empty() {
1553                    Ok(Self::UnknownValue(serde_json::Value::Null))
1554                } else {
1555                    serde_json::from_slice(data).map(Self::UnknownValue)
1556                }
1557            }
1558        }
1559    }
1560}
1561
1562/// struct for typed errors of method [`system_restore_post`]
1563#[derive(Debug, Clone, Serialize, Deserialize)]
1564#[serde(untagged)]
1565pub enum SystemRestorePostError {
1566    Status400(),
1567    Status406(),
1568    Status412(),
1569    UnknownValue(serde_json::Value),
1570}
1571
1572impl SystemRestorePostError {
1573    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1574        // to do: support payloads once added to API spec
1575        match status {
1576            400 => Ok(Self::Status400()),
1577            406 => Ok(Self::Status406()),
1578            412 => Ok(Self::Status412()),
1579            _ => {
1580                if data.is_empty() {
1581                    Ok(Self::UnknownValue(serde_json::Value::Null))
1582                } else {
1583                    serde_json::from_slice(data).map(Self::UnknownValue)
1584                }
1585            }
1586        }
1587    }
1588}
1589
1590/// struct for typed errors of method [`system_shutdown_post`]
1591#[derive(Debug, Clone, Serialize, Deserialize)]
1592#[serde(untagged)]
1593pub enum SystemShutdownPostError {
1594    Status401(),
1595    Status403(),
1596    Status406(),
1597    Status412(),
1598    UnknownValue(serde_json::Value),
1599}
1600
1601impl SystemShutdownPostError {
1602    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1603        // to do: support payloads once added to API spec
1604        match status {
1605            401 => Ok(Self::Status401()),
1606            403 => Ok(Self::Status403()),
1607            406 => Ok(Self::Status406()),
1608            412 => Ok(Self::Status412()),
1609            _ => {
1610                if data.is_empty() {
1611                    Ok(Self::UnknownValue(serde_json::Value::Null))
1612                } else {
1613                    serde_json::from_slice(data).map(Self::UnknownValue)
1614                }
1615            }
1616        }
1617    }
1618}
1619
1620/// struct for typed errors of method [`system_update_post`]
1621#[derive(Debug, Clone, Serialize, Deserialize)]
1622#[serde(untagged)]
1623pub enum SystemUpdatePostError {
1624    Status400(),
1625    Status401(),
1626    Status403(),
1627    Status406(),
1628    Status409(),
1629    Status412(),
1630    UnknownValue(serde_json::Value),
1631}
1632
1633impl SystemUpdatePostError {
1634    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1635        // to do: support payloads once added to API spec
1636        match status {
1637            400 => Ok(Self::Status400()),
1638            401 => Ok(Self::Status401()),
1639            403 => Ok(Self::Status403()),
1640            406 => Ok(Self::Status406()),
1641            409 => Ok(Self::Status409()),
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 [`unlock_post`]
1655#[derive(Debug, Clone, Serialize, Deserialize)]
1656#[serde(untagged)]
1657pub enum UnlockPostError {
1658    Status400(),
1659    Status403(),
1660    Status406(),
1661    Status412(),
1662    UnknownValue(serde_json::Value),
1663}
1664
1665impl UnlockPostError {
1666    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1667        // to do: support payloads once added to API spec
1668        match status {
1669            400 => Ok(Self::Status400()),
1670            403 => Ok(Self::Status403()),
1671            406 => Ok(Self::Status406()),
1672            412 => Ok(Self::Status412()),
1673            _ => {
1674                if data.is_empty() {
1675                    Ok(Self::UnknownValue(serde_json::Value::Null))
1676                } else {
1677                    serde_json::from_slice(data).map(Self::UnknownValue)
1678                }
1679            }
1680        }
1681    }
1682}
1683
1684/// struct for typed errors of method [`users_get`]
1685#[derive(Debug, Clone, Serialize, Deserialize)]
1686#[serde(untagged)]
1687pub enum UsersGetError {
1688    Status401(),
1689    Status403(),
1690    Status406(),
1691    Status412(),
1692    UnknownValue(serde_json::Value),
1693}
1694
1695impl UsersGetError {
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            401 => Ok(Self::Status401()),
1700            403 => Ok(Self::Status403()),
1701            406 => Ok(Self::Status406()),
1702            412 => Ok(Self::Status412()),
1703            _ => {
1704                if data.is_empty() {
1705                    Ok(Self::UnknownValue(serde_json::Value::Null))
1706                } else {
1707                    serde_json::from_slice(data).map(Self::UnknownValue)
1708                }
1709            }
1710        }
1711    }
1712}
1713
1714/// struct for typed errors of method [`users_post`]
1715#[derive(Debug, Clone, Serialize, Deserialize)]
1716#[serde(untagged)]
1717pub enum UsersPostError {
1718    Status400(),
1719    Status401(),
1720    Status403(),
1721    Status406(),
1722    Status412(),
1723    UnknownValue(serde_json::Value),
1724}
1725
1726impl UsersPostError {
1727    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1728        // to do: support payloads once added to API spec
1729        match status {
1730            400 => Ok(Self::Status400()),
1731            401 => Ok(Self::Status401()),
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_user_id_delete`]
1747#[derive(Debug, Clone, Serialize, Deserialize)]
1748#[serde(untagged)]
1749pub enum UsersUserIdDeleteError {
1750    Status400(),
1751    Status401(),
1752    Status403(),
1753    Status404(),
1754    Status406(),
1755    Status412(),
1756    UnknownValue(serde_json::Value),
1757}
1758
1759impl UsersUserIdDeleteError {
1760    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1761        // to do: support payloads once added to API spec
1762        match status {
1763            400 => Ok(Self::Status400()),
1764            401 => Ok(Self::Status401()),
1765            403 => Ok(Self::Status403()),
1766            404 => Ok(Self::Status404()),
1767            406 => Ok(Self::Status406()),
1768            412 => Ok(Self::Status412()),
1769            _ => {
1770                if data.is_empty() {
1771                    Ok(Self::UnknownValue(serde_json::Value::Null))
1772                } else {
1773                    serde_json::from_slice(data).map(Self::UnknownValue)
1774                }
1775            }
1776        }
1777    }
1778}
1779
1780/// struct for typed errors of method [`users_user_id_get`]
1781#[derive(Debug, Clone, Serialize, Deserialize)]
1782#[serde(untagged)]
1783pub enum UsersUserIdGetError {
1784    Status400(),
1785    Status401(),
1786    Status403(),
1787    Status404(),
1788    Status406(),
1789    Status412(),
1790    UnknownValue(serde_json::Value),
1791}
1792
1793impl UsersUserIdGetError {
1794    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1795        // to do: support payloads once added to API spec
1796        match status {
1797            400 => Ok(Self::Status400()),
1798            401 => Ok(Self::Status401()),
1799            403 => Ok(Self::Status403()),
1800            404 => Ok(Self::Status404()),
1801            406 => Ok(Self::Status406()),
1802            412 => Ok(Self::Status412()),
1803            _ => {
1804                if data.is_empty() {
1805                    Ok(Self::UnknownValue(serde_json::Value::Null))
1806                } else {
1807                    serde_json::from_slice(data).map(Self::UnknownValue)
1808                }
1809            }
1810        }
1811    }
1812}
1813
1814/// struct for typed errors of method [`users_user_id_passphrase_post`]
1815#[derive(Debug, Clone, Serialize, Deserialize)]
1816#[serde(untagged)]
1817pub enum UsersUserIdPassphrasePostError {
1818    Status400(),
1819    Status401(),
1820    Status403(),
1821    Status404(),
1822    Status406(),
1823    Status412(),
1824    UnknownValue(serde_json::Value),
1825}
1826
1827impl UsersUserIdPassphrasePostError {
1828    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1829        // to do: support payloads once added to API spec
1830        match status {
1831            400 => Ok(Self::Status400()),
1832            401 => Ok(Self::Status401()),
1833            403 => Ok(Self::Status403()),
1834            404 => Ok(Self::Status404()),
1835            406 => Ok(Self::Status406()),
1836            412 => Ok(Self::Status412()),
1837            _ => {
1838                if data.is_empty() {
1839                    Ok(Self::UnknownValue(serde_json::Value::Null))
1840                } else {
1841                    serde_json::from_slice(data).map(Self::UnknownValue)
1842                }
1843            }
1844        }
1845    }
1846}
1847
1848/// struct for typed errors of method [`users_user_id_post`]
1849#[derive(Debug, Clone, Serialize, Deserialize)]
1850#[serde(untagged)]
1851pub enum UsersUserIdPostError {
1852    Status400(),
1853    Status401(),
1854    Status403(),
1855    Status406(),
1856    Status412(),
1857    UnknownValue(serde_json::Value),
1858}
1859
1860impl UsersUserIdPostError {
1861    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1862        // to do: support payloads once added to API spec
1863        match status {
1864            400 => Ok(Self::Status400()),
1865            401 => Ok(Self::Status401()),
1866            403 => Ok(Self::Status403()),
1867            406 => Ok(Self::Status406()),
1868            412 => Ok(Self::Status412()),
1869            _ => {
1870                if data.is_empty() {
1871                    Ok(Self::UnknownValue(serde_json::Value::Null))
1872                } else {
1873                    serde_json::from_slice(data).map(Self::UnknownValue)
1874                }
1875            }
1876        }
1877    }
1878}
1879
1880/// struct for typed errors of method [`users_user_id_put`]
1881#[derive(Debug, Clone, Serialize, Deserialize)]
1882#[serde(untagged)]
1883pub enum UsersUserIdPutError {
1884    Status400(),
1885    Status401(),
1886    Status403(),
1887    Status406(),
1888    Status409(),
1889    Status412(),
1890    UnknownValue(serde_json::Value),
1891}
1892
1893impl UsersUserIdPutError {
1894    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1895        // to do: support payloads once added to API spec
1896        match status {
1897            400 => Ok(Self::Status400()),
1898            401 => Ok(Self::Status401()),
1899            403 => Ok(Self::Status403()),
1900            406 => Ok(Self::Status406()),
1901            409 => Ok(Self::Status409()),
1902            412 => Ok(Self::Status412()),
1903            _ => {
1904                if data.is_empty() {
1905                    Ok(Self::UnknownValue(serde_json::Value::Null))
1906                } else {
1907                    serde_json::from_slice(data).map(Self::UnknownValue)
1908                }
1909            }
1910        }
1911    }
1912}
1913
1914/// struct for typed errors of method [`users_user_id_tags_get`]
1915#[derive(Debug, Clone, Serialize, Deserialize)]
1916#[serde(untagged)]
1917pub enum UsersUserIdTagsGetError {
1918    Status400(),
1919    Status401(),
1920    Status403(),
1921    Status404(),
1922    Status406(),
1923    Status412(),
1924    UnknownValue(serde_json::Value),
1925}
1926
1927impl UsersUserIdTagsGetError {
1928    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1929        // to do: support payloads once added to API spec
1930        match status {
1931            400 => Ok(Self::Status400()),
1932            401 => Ok(Self::Status401()),
1933            403 => Ok(Self::Status403()),
1934            404 => Ok(Self::Status404()),
1935            406 => Ok(Self::Status406()),
1936            412 => Ok(Self::Status412()),
1937            _ => {
1938                if data.is_empty() {
1939                    Ok(Self::UnknownValue(serde_json::Value::Null))
1940                } else {
1941                    serde_json::from_slice(data).map(Self::UnknownValue)
1942                }
1943            }
1944        }
1945    }
1946}
1947
1948/// struct for typed errors of method [`users_user_id_tags_tag_delete`]
1949#[derive(Debug, Clone, Serialize, Deserialize)]
1950#[serde(untagged)]
1951pub enum UsersUserIdTagsTagDeleteError {
1952    Status401(),
1953    Status403(),
1954    Status404(),
1955    Status406(),
1956    Status412(),
1957    UnknownValue(serde_json::Value),
1958}
1959
1960impl UsersUserIdTagsTagDeleteError {
1961    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1962        // to do: support payloads once added to API spec
1963        match status {
1964            401 => Ok(Self::Status401()),
1965            403 => Ok(Self::Status403()),
1966            404 => Ok(Self::Status404()),
1967            406 => Ok(Self::Status406()),
1968            412 => Ok(Self::Status412()),
1969            _ => {
1970                if data.is_empty() {
1971                    Ok(Self::UnknownValue(serde_json::Value::Null))
1972                } else {
1973                    serde_json::from_slice(data).map(Self::UnknownValue)
1974                }
1975            }
1976        }
1977    }
1978}
1979
1980/// struct for typed errors of method [`users_user_id_tags_tag_put`]
1981#[derive(Debug, Clone, Serialize, Deserialize)]
1982#[serde(untagged)]
1983pub enum UsersUserIdTagsTagPutError {
1984    Status400(),
1985    Status401(),
1986    Status403(),
1987    Status404(),
1988    Status406(),
1989    Status412(),
1990    UnknownValue(serde_json::Value),
1991}
1992
1993impl UsersUserIdTagsTagPutError {
1994    fn new(status: u16, data: &[u8]) -> Result<Self, serde_json::Error> {
1995        // to do: support payloads once added to API spec
1996        match status {
1997            400 => Ok(Self::Status400()),
1998            401 => Ok(Self::Status401()),
1999            403 => Ok(Self::Status403()),
2000            404 => Ok(Self::Status404()),
2001            406 => Ok(Self::Status406()),
2002            412 => Ok(Self::Status412()),
2003            _ => {
2004                if data.is_empty() {
2005                    Ok(Self::UnknownValue(serde_json::Value::Null))
2006                } else {
2007                    serde_json::from_slice(data).map(Self::UnknownValue)
2008                }
2009            }
2010        }
2011    }
2012}
2013
2014/// 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.
2015pub fn config_backup_passphrase_put(
2016    configuration: &configuration::Configuration,
2017    backup_passphrase_config: crate::models::BackupPassphraseConfig,
2018) -> Result<ResponseContent<()>, Error<ConfigBackupPassphrasePutError>> {
2019    let local_var_configuration = configuration;
2020
2021    let local_var_client = &local_var_configuration.client;
2022
2023    let local_var_uri_str = format!(
2024        "{}/config/backup-passphrase",
2025        local_var_configuration.base_path
2026    );
2027    let mut local_var_req_builder =
2028        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2029    local_var_req_builder = local_var_req_builder
2030        .config()
2031        .http_status_as_error(false)
2032        .build();
2033
2034    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2035        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2036    }
2037    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2038        let value = super::basic_auth(local_var_auth_conf);
2039
2040        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2041    };
2042
2043    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2044    let local_var_result = local_var_req_builder.send_json(backup_passphrase_config);
2045
2046    let local_var_resp = local_var_result?;
2047
2048    let local_var_status = local_var_resp.status().as_u16();
2049    if local_var_status < 400 {
2050        ResponseContent::unit(local_var_resp)
2051    } else {
2052        ResponseContent::new(local_var_resp, |data| {
2053            ConfigBackupPassphrasePutError::new(local_var_status, data).map_err(From::from)
2054        })
2055        .and_then(|content| Err(Error::ResponseError(content)))
2056    }
2057}
2058
2059/// Get logging configuration. Protocol is always syslog over UDP. Configurable are IP adress and port, log level.
2060pub fn config_logging_get(
2061    configuration: &configuration::Configuration,
2062) -> Result<ResponseContent<crate::models::LoggingConfig>, Error<ConfigLoggingGetError>> {
2063    let local_var_configuration = configuration;
2064
2065    let local_var_client = &local_var_configuration.client;
2066
2067    let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path);
2068    let mut local_var_req_builder =
2069        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2070    local_var_req_builder = local_var_req_builder
2071        .config()
2072        .http_status_as_error(false)
2073        .build();
2074
2075    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2076        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2077    }
2078    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2079        let value = super::basic_auth(local_var_auth_conf);
2080
2081        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2082    };
2083    let accept_str = "application/json";
2084    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2085
2086    let local_var_result = local_var_req_builder.send_empty();
2087
2088    let local_var_resp = local_var_result?;
2089
2090    let local_var_status = local_var_resp.status().as_u16();
2091    if local_var_status < 400 {
2092        ResponseContent::deserialized(local_var_resp)
2093    } else {
2094        ResponseContent::new(local_var_resp, |data| {
2095            ConfigLoggingGetError::new(local_var_status, data).map_err(From::from)
2096        })
2097        .and_then(|content| Err(Error::ResponseError(content)))
2098    }
2099}
2100
2101/// Configure log level and destination.
2102pub fn config_logging_put(
2103    configuration: &configuration::Configuration,
2104    logging_config: crate::models::LoggingConfig,
2105) -> Result<ResponseContent<()>, Error<ConfigLoggingPutError>> {
2106    let local_var_configuration = configuration;
2107
2108    let local_var_client = &local_var_configuration.client;
2109
2110    let local_var_uri_str = format!("{}/config/logging", local_var_configuration.base_path);
2111    let mut local_var_req_builder =
2112        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2113    local_var_req_builder = local_var_req_builder
2114        .config()
2115        .http_status_as_error(false)
2116        .build();
2117
2118    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2119        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2120    }
2121    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2122        let value = super::basic_auth(local_var_auth_conf);
2123
2124        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2125    };
2126
2127    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2128    let local_var_result = local_var_req_builder.send_json(logging_config);
2129
2130    let local_var_resp = local_var_result?;
2131
2132    let local_var_status = local_var_resp.status().as_u16();
2133    if local_var_status < 400 {
2134        ResponseContent::unit(local_var_resp)
2135    } else {
2136        ResponseContent::new(local_var_resp, |data| {
2137            ConfigLoggingPutError::new(local_var_status, data).map_err(From::from)
2138        })
2139        .and_then(|content| Err(Error::ResponseError(content)))
2140    }
2141}
2142
2143/// Get network configuration. IP address, netmask, router.
2144pub fn config_network_get(
2145    configuration: &configuration::Configuration,
2146) -> Result<ResponseContent<crate::models::NetworkConfig>, Error<ConfigNetworkGetError>> {
2147    let local_var_configuration = configuration;
2148
2149    let local_var_client = &local_var_configuration.client;
2150
2151    let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path);
2152    let mut local_var_req_builder =
2153        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2154    local_var_req_builder = local_var_req_builder
2155        .config()
2156        .http_status_as_error(false)
2157        .build();
2158
2159    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2160        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2161    }
2162    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2163        let value = super::basic_auth(local_var_auth_conf);
2164
2165        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2166    };
2167    let accept_str = "application/json";
2168    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2169
2170    let local_var_result = local_var_req_builder.send_empty();
2171
2172    let local_var_resp = local_var_result?;
2173
2174    let local_var_status = local_var_resp.status().as_u16();
2175    if local_var_status < 400 {
2176        ResponseContent::deserialized(local_var_resp)
2177    } else {
2178        ResponseContent::new(local_var_resp, |data| {
2179            ConfigNetworkGetError::new(local_var_status, data).map_err(From::from)
2180        })
2181        .and_then(|content| Err(Error::ResponseError(content)))
2182    }
2183}
2184
2185/// Configure network.
2186pub fn config_network_put(
2187    configuration: &configuration::Configuration,
2188    network_config: crate::models::NetworkConfig,
2189) -> Result<ResponseContent<()>, Error<ConfigNetworkPutError>> {
2190    let local_var_configuration = configuration;
2191
2192    let local_var_client = &local_var_configuration.client;
2193
2194    let local_var_uri_str = format!("{}/config/network", local_var_configuration.base_path);
2195    let mut local_var_req_builder =
2196        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2197    local_var_req_builder = local_var_req_builder
2198        .config()
2199        .http_status_as_error(false)
2200        .build();
2201
2202    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2203        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2204    }
2205    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2206        let value = super::basic_auth(local_var_auth_conf);
2207
2208        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2209    };
2210
2211    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2212    let local_var_result = local_var_req_builder.send_json(network_config);
2213
2214    let local_var_resp = local_var_result?;
2215
2216    let local_var_status = local_var_resp.status().as_u16();
2217    if local_var_status < 400 {
2218        ResponseContent::unit(local_var_resp)
2219    } else {
2220        ResponseContent::new(local_var_resp, |data| {
2221            ConfigNetworkPutError::new(local_var_status, data).map_err(From::from)
2222        })
2223        .and_then(|content| Err(Error::ResponseError(content)))
2224    }
2225}
2226
2227/// Get system time.
2228pub fn config_time_get(
2229    configuration: &configuration::Configuration,
2230) -> Result<ResponseContent<crate::models::TimeConfig>, Error<ConfigTimeGetError>> {
2231    let local_var_configuration = configuration;
2232
2233    let local_var_client = &local_var_configuration.client;
2234
2235    let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path);
2236    let mut local_var_req_builder =
2237        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2238    local_var_req_builder = local_var_req_builder
2239        .config()
2240        .http_status_as_error(false)
2241        .build();
2242
2243    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2244        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2245    }
2246    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2247        let value = super::basic_auth(local_var_auth_conf);
2248
2249        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2250    };
2251    let accept_str = "application/json";
2252    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2253
2254    let local_var_result = local_var_req_builder.send_empty();
2255
2256    let local_var_resp = local_var_result?;
2257
2258    let local_var_status = local_var_resp.status().as_u16();
2259    if local_var_status < 400 {
2260        ResponseContent::deserialized(local_var_resp)
2261    } else {
2262        ResponseContent::new(local_var_resp, |data| {
2263            ConfigTimeGetError::new(local_var_status, data).map_err(From::from)
2264        })
2265        .and_then(|content| Err(Error::ResponseError(content)))
2266    }
2267}
2268
2269/// Configure system time.
2270pub fn config_time_put(
2271    configuration: &configuration::Configuration,
2272    time_config: crate::models::TimeConfig,
2273) -> Result<ResponseContent<()>, Error<ConfigTimePutError>> {
2274    let local_var_configuration = configuration;
2275
2276    let local_var_client = &local_var_configuration.client;
2277
2278    let local_var_uri_str = format!("{}/config/time", local_var_configuration.base_path);
2279    let mut local_var_req_builder =
2280        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2281    local_var_req_builder = local_var_req_builder
2282        .config()
2283        .http_status_as_error(false)
2284        .build();
2285
2286    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2287        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2288    }
2289    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2290        let value = super::basic_auth(local_var_auth_conf);
2291
2292        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2293    };
2294
2295    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2296    let local_var_result = local_var_req_builder.send_json(time_config);
2297
2298    let local_var_resp = local_var_result?;
2299
2300    let local_var_status = local_var_resp.status().as_u16();
2301    if local_var_status < 400 {
2302        ResponseContent::unit(local_var_resp)
2303    } else {
2304        ResponseContent::new(local_var_resp, |data| {
2305            ConfigTimePutError::new(local_var_status, data).map_err(From::from)
2306        })
2307        .and_then(|content| Err(Error::ResponseError(content)))
2308    }
2309}
2310
2311/// Get certificate for NetHSMs https API.
2312pub fn config_tls_cert_pem_get(
2313    configuration: &configuration::Configuration,
2314) -> Result<ResponseContent<String>, Error<ConfigTlsCertPemGetError>> {
2315    let local_var_configuration = configuration;
2316
2317    let local_var_client = &local_var_configuration.client;
2318
2319    let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path);
2320    let mut local_var_req_builder =
2321        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2322    local_var_req_builder = local_var_req_builder
2323        .config()
2324        .http_status_as_error(false)
2325        .build();
2326
2327    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2328        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2329    }
2330    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2331        let value = super::basic_auth(local_var_auth_conf);
2332
2333        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2334    };
2335    let accept_str = "application/x-pem-file";
2336    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2337
2338    let local_var_result = local_var_req_builder.send_empty();
2339
2340    let local_var_resp = local_var_result?;
2341
2342    let local_var_status = local_var_resp.status().as_u16();
2343    if local_var_status < 400 {
2344        ResponseContent::string(local_var_resp)
2345    } else {
2346        ResponseContent::new(local_var_resp, |data| {
2347            ConfigTlsCertPemGetError::new(local_var_status, data).map_err(From::from)
2348        })
2349        .and_then(|content| Err(Error::ResponseError(content)))
2350    }
2351}
2352
2353/// Set certificate for NetHSMs https API e.g. to replace self-signed intital certificate.
2354pub fn config_tls_cert_pem_put(
2355    configuration: &configuration::Configuration,
2356    body: &str,
2357) -> Result<ResponseContent<()>, Error<ConfigTlsCertPemPutError>> {
2358    let local_var_configuration = configuration;
2359
2360    let local_var_client = &local_var_configuration.client;
2361
2362    let local_var_uri_str = format!("{}/config/tls/cert.pem", local_var_configuration.base_path);
2363    let mut local_var_req_builder =
2364        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2365    local_var_req_builder = local_var_req_builder
2366        .config()
2367        .http_status_as_error(false)
2368        .build();
2369
2370    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2371        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2372    }
2373    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2374        let value = super::basic_auth(local_var_auth_conf);
2375
2376        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2377    };
2378
2379    local_var_req_builder = local_var_req_builder.header("content-type", "application/x-pem-file");
2380    let local_var_result = local_var_req_builder.send(body);
2381
2382    let local_var_resp = local_var_result?;
2383
2384    let local_var_status = local_var_resp.status().as_u16();
2385    if local_var_status < 400 {
2386        ResponseContent::unit(local_var_resp)
2387    } else {
2388        ResponseContent::new(local_var_resp, |data| {
2389            ConfigTlsCertPemPutError::new(local_var_status, data).map_err(From::from)
2390        })
2391        .and_then(|content| Err(Error::ResponseError(content)))
2392    }
2393}
2394
2395/// Get NetHSM certificate signing request e.g. to replace self-signed intital certificate.
2396pub fn config_tls_csr_pem_post(
2397    configuration: &configuration::Configuration,
2398    distinguished_name: crate::models::DistinguishedName,
2399) -> Result<ResponseContent<String>, Error<ConfigTlsCsrPemPostError>> {
2400    let local_var_configuration = configuration;
2401
2402    let local_var_client = &local_var_configuration.client;
2403
2404    let local_var_uri_str = format!("{}/config/tls/csr.pem", local_var_configuration.base_path);
2405    let mut local_var_req_builder =
2406        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2407    local_var_req_builder = local_var_req_builder
2408        .config()
2409        .http_status_as_error(false)
2410        .build();
2411
2412    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2413        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2414    }
2415    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2416        let value = super::basic_auth(local_var_auth_conf);
2417
2418        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2419    };
2420    let accept_str = "application/x-pem-file";
2421    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2422
2423    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2424    let local_var_result = local_var_req_builder.send_json(distinguished_name);
2425
2426    let local_var_resp = local_var_result?;
2427
2428    let local_var_status = local_var_resp.status().as_u16();
2429    if local_var_status < 400 {
2430        ResponseContent::string(local_var_resp)
2431    } else {
2432        ResponseContent::new(local_var_resp, |data| {
2433            ConfigTlsCsrPemPostError::new(local_var_status, data).map_err(From::from)
2434        })
2435        .and_then(|content| Err(Error::ResponseError(content)))
2436    }
2437}
2438
2439/// Generate a new pair of public and private key for NetHSM's https API.
2440pub fn config_tls_generate_post(
2441    configuration: &configuration::Configuration,
2442    tls_key_generate_request_data: crate::models::TlsKeyGenerateRequestData,
2443) -> Result<ResponseContent<()>, Error<ConfigTlsGeneratePostError>> {
2444    let local_var_configuration = configuration;
2445
2446    let local_var_client = &local_var_configuration.client;
2447
2448    let local_var_uri_str = format!("{}/config/tls/generate", local_var_configuration.base_path);
2449    let mut local_var_req_builder =
2450        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2451    local_var_req_builder = local_var_req_builder
2452        .config()
2453        .http_status_as_error(false)
2454        .build();
2455
2456    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2457        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2458    }
2459    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2460        let value = super::basic_auth(local_var_auth_conf);
2461
2462        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2463    };
2464
2465    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2466    let local_var_result = local_var_req_builder.send_json(tls_key_generate_request_data);
2467
2468    let local_var_resp = local_var_result?;
2469
2470    let local_var_status = local_var_resp.status().as_u16();
2471    if local_var_status < 400 {
2472        ResponseContent::unit(local_var_resp)
2473    } else {
2474        ResponseContent::new(local_var_resp, |data| {
2475            ConfigTlsGeneratePostError::new(local_var_status, data).map_err(From::from)
2476        })
2477        .and_then(|content| Err(Error::ResponseError(content)))
2478    }
2479}
2480
2481/// Get public key for NetHSMs https API.
2482pub fn config_tls_public_pem_get(
2483    configuration: &configuration::Configuration,
2484) -> Result<ResponseContent<String>, Error<ConfigTlsPublicPemGetError>> {
2485    let local_var_configuration = configuration;
2486
2487    let local_var_client = &local_var_configuration.client;
2488
2489    let local_var_uri_str = format!(
2490        "{}/config/tls/public.pem",
2491        local_var_configuration.base_path
2492    );
2493    let mut local_var_req_builder =
2494        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2495    local_var_req_builder = local_var_req_builder
2496        .config()
2497        .http_status_as_error(false)
2498        .build();
2499
2500    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2501        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2502    }
2503    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2504        let value = super::basic_auth(local_var_auth_conf);
2505
2506        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2507    };
2508    let accept_str = "application/x-pem-file";
2509    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2510
2511    let local_var_result = local_var_req_builder.send_empty();
2512
2513    let local_var_resp = local_var_result?;
2514
2515    let local_var_status = local_var_resp.status().as_u16();
2516    if local_var_status < 400 {
2517        ResponseContent::string(local_var_resp)
2518    } else {
2519        ResponseContent::new(local_var_resp, |data| {
2520            ConfigTlsPublicPemGetError::new(local_var_status, data).map_err(From::from)
2521        })
2522        .and_then(|content| Err(Error::ResponseError(content)))
2523    }
2524}
2525
2526/// Read unattended boot configuration: is it on or off?
2527pub fn config_unattended_boot_get(
2528    configuration: &configuration::Configuration,
2529) -> Result<ResponseContent<crate::models::UnattendedBootConfig>, Error<ConfigUnattendedBootGetError>>
2530{
2531    let local_var_configuration = configuration;
2532
2533    let local_var_client = &local_var_configuration.client;
2534
2535    let local_var_uri_str = format!(
2536        "{}/config/unattended-boot",
2537        local_var_configuration.base_path
2538    );
2539    let mut local_var_req_builder =
2540        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2541    local_var_req_builder = local_var_req_builder
2542        .config()
2543        .http_status_as_error(false)
2544        .build();
2545
2546    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2547        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2548    }
2549    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2550        let value = super::basic_auth(local_var_auth_conf);
2551
2552        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2553    };
2554    let accept_str = "application/json";
2555    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2556
2557    let local_var_result = local_var_req_builder.send_empty();
2558
2559    let local_var_resp = local_var_result?;
2560
2561    let local_var_status = local_var_resp.status().as_u16();
2562    if local_var_status < 400 {
2563        ResponseContent::deserialized(local_var_resp)
2564    } else {
2565        ResponseContent::new(local_var_resp, |data| {
2566            ConfigUnattendedBootGetError::new(local_var_status, data).map_err(From::from)
2567        })
2568        .and_then(|content| Err(Error::ResponseError(content)))
2569    }
2570}
2571
2572/// Configure unattended boot: switch it on or off (flip the switch).
2573pub fn config_unattended_boot_put(
2574    configuration: &configuration::Configuration,
2575    unattended_boot_config: crate::models::UnattendedBootConfig,
2576) -> Result<ResponseContent<()>, Error<ConfigUnattendedBootPutError>> {
2577    let local_var_configuration = configuration;
2578
2579    let local_var_client = &local_var_configuration.client;
2580
2581    let local_var_uri_str = format!(
2582        "{}/config/unattended-boot",
2583        local_var_configuration.base_path
2584    );
2585    let mut local_var_req_builder =
2586        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2587    local_var_req_builder = local_var_req_builder
2588        .config()
2589        .http_status_as_error(false)
2590        .build();
2591
2592    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2593        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2594    }
2595    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2596        let value = super::basic_auth(local_var_auth_conf);
2597
2598        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2599    };
2600
2601    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2602    let local_var_result = local_var_req_builder.send_json(unattended_boot_config);
2603
2604    let local_var_resp = local_var_result?;
2605
2606    let local_var_status = local_var_resp.status().as_u16();
2607    if local_var_status < 400 {
2608        ResponseContent::unit(local_var_resp)
2609    } else {
2610        ResponseContent::new(local_var_resp, |data| {
2611            ConfigUnattendedBootPutError::new(local_var_status, data).map_err(From::from)
2612        })
2613        .and_then(|content| Err(Error::ResponseError(content)))
2614    }
2615}
2616
2617/// 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.
2618pub fn config_unlock_passphrase_put(
2619    configuration: &configuration::Configuration,
2620    unlock_passphrase_config: crate::models::UnlockPassphraseConfig,
2621) -> Result<ResponseContent<()>, Error<ConfigUnlockPassphrasePutError>> {
2622    let local_var_configuration = configuration;
2623
2624    let local_var_client = &local_var_configuration.client;
2625
2626    let local_var_uri_str = format!(
2627        "{}/config/unlock-passphrase",
2628        local_var_configuration.base_path
2629    );
2630    let mut local_var_req_builder =
2631        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
2632    local_var_req_builder = local_var_req_builder
2633        .config()
2634        .http_status_as_error(false)
2635        .build();
2636
2637    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2638        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2639    }
2640    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2641        let value = super::basic_auth(local_var_auth_conf);
2642
2643        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2644    };
2645
2646    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2647    let local_var_result = local_var_req_builder.send_json(unlock_passphrase_config);
2648
2649    let local_var_resp = local_var_result?;
2650
2651    let local_var_status = local_var_resp.status().as_u16();
2652    if local_var_status < 400 {
2653        ResponseContent::unit(local_var_resp)
2654    } else {
2655        ResponseContent::new(local_var_resp, |data| {
2656            ConfigUnlockPassphrasePutError::new(local_var_status, data).map_err(From::from)
2657        })
2658        .and_then(|content| Err(Error::ResponseError(content)))
2659    }
2660}
2661
2662/// Retrieve whether NetHSM is fully started but not ready to take traffic. This corresponds to the state *Locked* or *Unprovisioned*.
2663pub fn health_alive_get(
2664    configuration: &configuration::Configuration,
2665) -> Result<ResponseContent<()>, Error<HealthAliveGetError>> {
2666    let local_var_configuration = configuration;
2667
2668    let local_var_client = &local_var_configuration.client;
2669
2670    let local_var_uri_str = format!("{}/health/alive", local_var_configuration.base_path);
2671    let mut local_var_req_builder =
2672        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2673    local_var_req_builder = local_var_req_builder
2674        .config()
2675        .http_status_as_error(false)
2676        .build();
2677
2678    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2679        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2680    }
2681
2682    let local_var_result = local_var_req_builder.send_empty();
2683
2684    let local_var_resp = local_var_result?;
2685
2686    let local_var_status = local_var_resp.status().as_u16();
2687    if local_var_status < 400 {
2688        ResponseContent::unit(local_var_resp)
2689    } else {
2690        ResponseContent::new(local_var_resp, |data| {
2691            HealthAliveGetError::new(local_var_status, data).map_err(From::from)
2692        })
2693        .and_then(|content| Err(Error::ResponseError(content)))
2694    }
2695}
2696
2697/// Retrieve whether NetHSM is in state *Operational* and thus ready to take traffic.
2698pub fn health_ready_get(
2699    configuration: &configuration::Configuration,
2700) -> Result<ResponseContent<()>, Error<HealthReadyGetError>> {
2701    let local_var_configuration = configuration;
2702
2703    let local_var_client = &local_var_configuration.client;
2704
2705    let local_var_uri_str = format!("{}/health/ready", local_var_configuration.base_path);
2706    let mut local_var_req_builder =
2707        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2708    local_var_req_builder = local_var_req_builder
2709        .config()
2710        .http_status_as_error(false)
2711        .build();
2712
2713    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2714        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2715    }
2716
2717    let local_var_result = local_var_req_builder.send_empty();
2718
2719    let local_var_resp = local_var_result?;
2720
2721    let local_var_status = local_var_resp.status().as_u16();
2722    if local_var_status < 400 {
2723        ResponseContent::unit(local_var_resp)
2724    } else {
2725        ResponseContent::new(local_var_resp, |data| {
2726            HealthReadyGetError::new(local_var_status, data).map_err(From::from)
2727        })
2728        .and_then(|content| Err(Error::ResponseError(content)))
2729    }
2730}
2731
2732/// Retrieve the state of NetHSM.
2733pub fn health_state_get(
2734    configuration: &configuration::Configuration,
2735) -> Result<ResponseContent<crate::models::HealthStateData>, Error<HealthStateGetError>> {
2736    let local_var_configuration = configuration;
2737
2738    let local_var_client = &local_var_configuration.client;
2739
2740    let local_var_uri_str = format!("{}/health/state", local_var_configuration.base_path);
2741    let mut local_var_req_builder =
2742        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2743    local_var_req_builder = local_var_req_builder
2744        .config()
2745        .http_status_as_error(false)
2746        .build();
2747
2748    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2749        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2750    }
2751    let accept_str = "application/json";
2752    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2753
2754    let local_var_result = local_var_req_builder.send_empty();
2755
2756    let local_var_resp = local_var_result?;
2757
2758    let local_var_status = local_var_resp.status().as_u16();
2759    if local_var_status < 400 {
2760        ResponseContent::deserialized(local_var_resp)
2761    } else {
2762        ResponseContent::new(local_var_resp, |data| {
2763            HealthStateGetError::new(local_var_status, data).map_err(From::from)
2764        })
2765        .and_then(|content| Err(Error::ResponseError(content)))
2766    }
2767}
2768
2769/// Information about the vendor and product.
2770pub fn info_get(
2771    configuration: &configuration::Configuration,
2772) -> Result<ResponseContent<crate::models::InfoData>, Error<InfoGetError>> {
2773    let local_var_configuration = configuration;
2774
2775    let local_var_client = &local_var_configuration.client;
2776
2777    let local_var_uri_str = format!("{}/info", local_var_configuration.base_path);
2778    let mut local_var_req_builder =
2779        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2780    local_var_req_builder = local_var_req_builder
2781        .config()
2782        .http_status_as_error(false)
2783        .build();
2784
2785    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2786        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2787    }
2788    let accept_str = "application/json";
2789    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2790
2791    let local_var_result = local_var_req_builder.send_empty();
2792
2793    let local_var_resp = local_var_result?;
2794
2795    let local_var_status = local_var_resp.status().as_u16();
2796    if local_var_status < 400 {
2797        ResponseContent::deserialized(local_var_resp)
2798    } else {
2799        ResponseContent::new(local_var_resp, |data| {
2800            InfoGetError::new(local_var_status, data).map_err(From::from)
2801        })
2802        .and_then(|content| Err(Error::ResponseError(content)))
2803    }
2804}
2805
2806/// 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.
2807pub fn keys_generate_post(
2808    configuration: &configuration::Configuration,
2809    key_generate_request_data: crate::models::KeyGenerateRequestData,
2810) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<KeysGeneratePostError>> {
2811    let local_var_configuration = configuration;
2812
2813    let local_var_client = &local_var_configuration.client;
2814
2815    let local_var_uri_str = format!("{}/keys/generate", local_var_configuration.base_path);
2816    let mut local_var_req_builder =
2817        create_request!(local_var_client, POST, local_var_uri_str.as_str());
2818    local_var_req_builder = local_var_req_builder
2819        .config()
2820        .http_status_as_error(false)
2821        .build();
2822
2823    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2824        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2825    }
2826    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2827        let value = super::basic_auth(local_var_auth_conf);
2828
2829        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2830    };
2831    let accept_str = "application/json";
2832    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2833
2834    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
2835    let local_var_result = local_var_req_builder.send_json(key_generate_request_data);
2836
2837    let local_var_resp = local_var_result?;
2838
2839    let local_var_status = local_var_resp.status().as_u16();
2840    if local_var_status < 400 {
2841        ResponseContent::deserialized(local_var_resp)
2842    } else {
2843        ResponseContent::new(local_var_resp, |data| {
2844            KeysGeneratePostError::new(local_var_status, data).map_err(From::from)
2845        })
2846        .and_then(|content| Err(Error::ResponseError(content)))
2847    }
2848}
2849
2850/// 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.
2851pub fn keys_get(
2852    configuration: &configuration::Configuration,
2853    filter: Option<&str>,
2854) -> Result<ResponseContent<Vec<crate::models::KeyItem>>, Error<KeysGetError>> {
2855    let local_var_configuration = configuration;
2856
2857    let local_var_client = &local_var_configuration.client;
2858
2859    let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
2860    let mut local_var_req_builder =
2861        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2862    local_var_req_builder = local_var_req_builder
2863        .config()
2864        .http_status_as_error(false)
2865        .build();
2866
2867    if let Some(local_var_str) = filter {
2868        local_var_req_builder =
2869            local_var_req_builder.query_pairs([("filter", local_var_str.to_string().as_str())]);
2870    }
2871    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2872        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2873    }
2874    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2875        let value = super::basic_auth(local_var_auth_conf);
2876
2877        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2878    };
2879    let accept_str = "application/json";
2880    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2881
2882    let local_var_result = local_var_req_builder.send_empty();
2883
2884    let local_var_resp = local_var_result?;
2885
2886    let local_var_status = local_var_resp.status().as_u16();
2887    if local_var_status < 400 {
2888        ResponseContent::deserialized(local_var_resp)
2889    } else {
2890        ResponseContent::new(local_var_resp, |data| {
2891            KeysGetError::new(local_var_status, data).map_err(From::from)
2892        })
2893        .and_then(|content| Err(Error::ResponseError(content)))
2894    }
2895}
2896
2897/// Delete the certificate.
2898pub fn keys_key_id_cert_delete(
2899    configuration: &configuration::Configuration,
2900    key_id: &str,
2901) -> Result<ResponseContent<()>, Error<KeysKeyIdCertDeleteError>> {
2902    let local_var_configuration = configuration;
2903
2904    let local_var_client = &local_var_configuration.client;
2905
2906    let local_var_uri_str = format!(
2907        "{}/keys/{KeyID}/cert",
2908        local_var_configuration.base_path,
2909        KeyID = crate::apis::urlencode(key_id)
2910    );
2911    let mut local_var_req_builder =
2912        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
2913    local_var_req_builder = local_var_req_builder
2914        .config()
2915        .http_status_as_error(false)
2916        .build();
2917
2918    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2919        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2920    }
2921    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2922        let value = super::basic_auth(local_var_auth_conf);
2923
2924        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2925    };
2926
2927    let local_var_result = local_var_req_builder.send_empty();
2928
2929    let local_var_resp = local_var_result?;
2930
2931    let local_var_status = local_var_resp.status().as_u16();
2932    if local_var_status < 400 {
2933        ResponseContent::unit(local_var_resp)
2934    } else {
2935        ResponseContent::new(local_var_resp, |data| {
2936            KeysKeyIdCertDeleteError::new(local_var_status, data).map_err(From::from)
2937        })
2938        .and_then(|content| Err(Error::ResponseError(content)))
2939    }
2940}
2941
2942/// Retrieve a stored certificate in the exact format it was stored.
2943pub fn keys_key_id_cert_get(
2944    configuration: &configuration::Configuration,
2945    key_id: &str,
2946) -> Result<ResponseContent<std::vec::Vec<u8>>, Error<KeysKeyIdCertGetError>> {
2947    let local_var_configuration = configuration;
2948
2949    let local_var_client = &local_var_configuration.client;
2950
2951    let local_var_uri_str = format!(
2952        "{}/keys/{KeyID}/cert",
2953        local_var_configuration.base_path,
2954        KeyID = crate::apis::urlencode(key_id)
2955    );
2956    let mut local_var_req_builder =
2957        create_request!(local_var_client, GET, local_var_uri_str.as_str());
2958    local_var_req_builder = local_var_req_builder
2959        .config()
2960        .http_status_as_error(false)
2961        .build();
2962
2963    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2964        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
2965    }
2966    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
2967        let value = super::basic_auth(local_var_auth_conf);
2968
2969        local_var_req_builder = local_var_req_builder.header("authorization", &value);
2970    };
2971    let accept_str = "application/octet-stream";
2972    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
2973
2974    let local_var_result = local_var_req_builder.send_empty();
2975
2976    let local_var_resp = local_var_result?;
2977
2978    let local_var_status = local_var_resp.status().as_u16();
2979    if local_var_status < 400 {
2980        ResponseContent::bytes(local_var_resp)
2981    } else {
2982        ResponseContent::new(local_var_resp, |data| {
2983            KeysKeyIdCertGetError::new(local_var_status, data).map_err(From::from)
2984        })
2985        .and_then(|content| Err(Error::ResponseError(content)))
2986    }
2987}
2988
2989/// Store a certificate. Maximum size 1MB. The Content-Type must be application/octet-stream.
2990pub fn keys_key_id_cert_put(
2991    configuration: &configuration::Configuration,
2992    key_id: &str,
2993    body: std::vec::Vec<u8>,
2994) -> Result<ResponseContent<()>, Error<KeysKeyIdCertPutError>> {
2995    let local_var_configuration = configuration;
2996
2997    let local_var_client = &local_var_configuration.client;
2998
2999    let local_var_uri_str = format!(
3000        "{}/keys/{KeyID}/cert",
3001        local_var_configuration.base_path,
3002        KeyID = crate::apis::urlencode(key_id)
3003    );
3004    let mut local_var_req_builder =
3005        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3006    local_var_req_builder = local_var_req_builder
3007        .config()
3008        .http_status_as_error(false)
3009        .build();
3010
3011    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3012        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3013    }
3014    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3015        let value = super::basic_auth(local_var_auth_conf);
3016
3017        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3018    };
3019
3020    local_var_req_builder =
3021        local_var_req_builder.header("content-type", "application/octet-stream");
3022    let local_var_result = local_var_req_builder.send(body);
3023
3024    let local_var_resp = local_var_result?;
3025
3026    let local_var_status = local_var_resp.status().as_u16();
3027    if local_var_status < 400 {
3028        ResponseContent::unit(local_var_resp)
3029    } else {
3030        ResponseContent::new(local_var_resp, |data| {
3031            KeysKeyIdCertPutError::new(local_var_status, data).map_err(From::from)
3032        })
3033        .and_then(|content| Err(Error::ResponseError(content)))
3034    }
3035}
3036
3037/// Retrieve a certificate signing request in PEM format.
3038pub fn keys_key_id_csr_pem_post(
3039    configuration: &configuration::Configuration,
3040    key_id: &str,
3041    distinguished_name: crate::models::DistinguishedName,
3042) -> Result<ResponseContent<String>, Error<KeysKeyIdCsrPemPostError>> {
3043    let local_var_configuration = configuration;
3044
3045    let local_var_client = &local_var_configuration.client;
3046
3047    let local_var_uri_str = format!(
3048        "{}/keys/{KeyID}/csr.pem",
3049        local_var_configuration.base_path,
3050        KeyID = crate::apis::urlencode(key_id)
3051    );
3052    let mut local_var_req_builder =
3053        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3054    local_var_req_builder = local_var_req_builder
3055        .config()
3056        .http_status_as_error(false)
3057        .build();
3058
3059    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3060        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3061    }
3062    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3063        let value = super::basic_auth(local_var_auth_conf);
3064
3065        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3066    };
3067    let accept_str = "application/x-pem-file";
3068    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3069
3070    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3071    let local_var_result = local_var_req_builder.send_json(distinguished_name);
3072
3073    let local_var_resp = local_var_result?;
3074
3075    let local_var_status = local_var_resp.status().as_u16();
3076    if local_var_status < 400 {
3077        ResponseContent::string(local_var_resp)
3078    } else {
3079        ResponseContent::new(local_var_resp, |data| {
3080            KeysKeyIdCsrPemPostError::new(local_var_status, data).map_err(From::from)
3081        })
3082        .and_then(|content| Err(Error::ResponseError(content)))
3083    }
3084}
3085
3086/// Decrypt an encrypted message with the secret key.
3087pub fn keys_key_id_decrypt_post(
3088    configuration: &configuration::Configuration,
3089    key_id: &str,
3090    decrypt_request_data: crate::models::DecryptRequestData,
3091) -> Result<ResponseContent<crate::models::DecryptData>, Error<KeysKeyIdDecryptPostError>> {
3092    let local_var_configuration = configuration;
3093
3094    let local_var_client = &local_var_configuration.client;
3095
3096    let local_var_uri_str = format!(
3097        "{}/keys/{KeyID}/decrypt",
3098        local_var_configuration.base_path,
3099        KeyID = crate::apis::urlencode(key_id)
3100    );
3101    let mut local_var_req_builder =
3102        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3103    local_var_req_builder = local_var_req_builder
3104        .config()
3105        .http_status_as_error(false)
3106        .build();
3107
3108    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3109        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3110    }
3111    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3112        let value = super::basic_auth(local_var_auth_conf);
3113
3114        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3115    };
3116    let accept_str = "application/json";
3117    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3118
3119    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3120    let local_var_result = local_var_req_builder.send_json(decrypt_request_data);
3121
3122    let local_var_resp = local_var_result?;
3123
3124    let local_var_status = local_var_resp.status().as_u16();
3125    if local_var_status < 400 {
3126        ResponseContent::deserialized(local_var_resp)
3127    } else {
3128        ResponseContent::new(local_var_resp, |data| {
3129            KeysKeyIdDecryptPostError::new(local_var_status, data).map_err(From::from)
3130        })
3131        .and_then(|content| Err(Error::ResponseError(content)))
3132    }
3133}
3134
3135/// Delete a pair of public and private key.
3136pub fn keys_key_id_delete(
3137    configuration: &configuration::Configuration,
3138    key_id: &str,
3139) -> Result<ResponseContent<()>, Error<KeysKeyIdDeleteError>> {
3140    let local_var_configuration = configuration;
3141
3142    let local_var_client = &local_var_configuration.client;
3143
3144    let local_var_uri_str = format!(
3145        "{}/keys/{KeyID}",
3146        local_var_configuration.base_path,
3147        KeyID = crate::apis::urlencode(key_id)
3148    );
3149    let mut local_var_req_builder =
3150        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3151    local_var_req_builder = local_var_req_builder
3152        .config()
3153        .http_status_as_error(false)
3154        .build();
3155
3156    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3157        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3158    }
3159    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3160        let value = super::basic_auth(local_var_auth_conf);
3161
3162        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3163    };
3164
3165    let local_var_result = local_var_req_builder.send_empty();
3166
3167    let local_var_resp = local_var_result?;
3168
3169    let local_var_status = local_var_resp.status().as_u16();
3170    if local_var_status < 400 {
3171        ResponseContent::unit(local_var_resp)
3172    } else {
3173        ResponseContent::new(local_var_resp, |data| {
3174            KeysKeyIdDeleteError::new(local_var_status, data).map_err(From::from)
3175        })
3176        .and_then(|content| Err(Error::ResponseError(content)))
3177    }
3178}
3179
3180/// Encrypt a message with the secret key.
3181pub fn keys_key_id_encrypt_post(
3182    configuration: &configuration::Configuration,
3183    key_id: &str,
3184    encrypt_request_data: crate::models::EncryptRequestData,
3185) -> Result<ResponseContent<crate::models::EncryptData>, Error<KeysKeyIdEncryptPostError>> {
3186    let local_var_configuration = configuration;
3187
3188    let local_var_client = &local_var_configuration.client;
3189
3190    let local_var_uri_str = format!(
3191        "{}/keys/{KeyID}/encrypt",
3192        local_var_configuration.base_path,
3193        KeyID = crate::apis::urlencode(key_id)
3194    );
3195    let mut local_var_req_builder =
3196        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3197    local_var_req_builder = local_var_req_builder
3198        .config()
3199        .http_status_as_error(false)
3200        .build();
3201
3202    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3203        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3204    }
3205    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3206        let value = super::basic_auth(local_var_auth_conf);
3207
3208        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3209    };
3210    let accept_str = "application/json";
3211    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3212
3213    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3214    let local_var_result = local_var_req_builder.send_json(encrypt_request_data);
3215
3216    let local_var_resp = local_var_result?;
3217
3218    let local_var_status = local_var_resp.status().as_u16();
3219    if local_var_status < 400 {
3220        ResponseContent::deserialized(local_var_resp)
3221    } else {
3222        ResponseContent::new(local_var_resp, |data| {
3223            KeysKeyIdEncryptPostError::new(local_var_status, data).map_err(From::from)
3224        })
3225        .and_then(|content| Err(Error::ResponseError(content)))
3226    }
3227}
3228
3229/// Retrieve the public key.
3230pub fn keys_key_id_get(
3231    configuration: &configuration::Configuration,
3232    key_id: &str,
3233) -> Result<ResponseContent<crate::models::PublicKey>, Error<KeysKeyIdGetError>> {
3234    let local_var_configuration = configuration;
3235
3236    let local_var_client = &local_var_configuration.client;
3237
3238    let local_var_uri_str = format!(
3239        "{}/keys/{KeyID}",
3240        local_var_configuration.base_path,
3241        KeyID = crate::apis::urlencode(key_id)
3242    );
3243    let mut local_var_req_builder =
3244        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3245    local_var_req_builder = local_var_req_builder
3246        .config()
3247        .http_status_as_error(false)
3248        .build();
3249
3250    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3251        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3252    }
3253    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3254        let value = super::basic_auth(local_var_auth_conf);
3255
3256        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3257    };
3258    let accept_str = "application/json";
3259    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3260
3261    let local_var_result = local_var_req_builder.send_empty();
3262
3263    let local_var_resp = local_var_result?;
3264
3265    let local_var_status = local_var_resp.status().as_u16();
3266    if local_var_status < 400 {
3267        ResponseContent::deserialized(local_var_resp)
3268    } else {
3269        ResponseContent::new(local_var_resp, |data| {
3270            KeysKeyIdGetError::new(local_var_status, data).map_err(From::from)
3271        })
3272        .and_then(|content| Err(Error::ResponseError(content)))
3273    }
3274}
3275
3276/// Retrieve public key in PEM format.
3277pub fn keys_key_id_public_pem_get(
3278    configuration: &configuration::Configuration,
3279    key_id: &str,
3280) -> Result<ResponseContent<String>, Error<KeysKeyIdPublicPemGetError>> {
3281    let local_var_configuration = configuration;
3282
3283    let local_var_client = &local_var_configuration.client;
3284
3285    let local_var_uri_str = format!(
3286        "{}/keys/{KeyID}/public.pem",
3287        local_var_configuration.base_path,
3288        KeyID = crate::apis::urlencode(key_id)
3289    );
3290    let mut local_var_req_builder =
3291        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3292    local_var_req_builder = local_var_req_builder
3293        .config()
3294        .http_status_as_error(false)
3295        .build();
3296
3297    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3298        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3299    }
3300    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3301        let value = super::basic_auth(local_var_auth_conf);
3302
3303        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3304    };
3305    let accept_str = "application/x-pem-file";
3306    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3307
3308    let local_var_result = local_var_req_builder.send_empty();
3309
3310    let local_var_resp = local_var_result?;
3311
3312    let local_var_status = local_var_resp.status().as_u16();
3313    if local_var_status < 400 {
3314        ResponseContent::string(local_var_resp)
3315    } else {
3316        ResponseContent::new(local_var_resp, |data| {
3317            KeysKeyIdPublicPemGetError::new(local_var_status, data).map_err(From::from)
3318        })
3319        .and_then(|content| Err(Error::ResponseError(content)))
3320    }
3321}
3322
3323/// 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.
3324pub fn keys_key_id_put(
3325    configuration: &configuration::Configuration,
3326    key_id: &str,
3327    body: KeysKeyIdPutBody,
3328) -> Result<ResponseContent<()>, Error<KeysKeyIdPutError>> {
3329    let local_var_configuration = configuration;
3330
3331    let local_var_client = &local_var_configuration.client;
3332
3333    let local_var_uri_str = format!(
3334        "{}/keys/{KeyID}",
3335        local_var_configuration.base_path,
3336        KeyID = crate::apis::urlencode(key_id)
3337    );
3338    let mut local_var_req_builder =
3339        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3340    local_var_req_builder = local_var_req_builder
3341        .config()
3342        .http_status_as_error(false)
3343        .build();
3344
3345    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3346        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3347    }
3348    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3349        let value = super::basic_auth(local_var_auth_conf);
3350
3351        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3352    };
3353
3354    let body_json = body.is_json();
3355    local_var_req_builder = local_var_req_builder.header("content-type", body.content_type());
3356
3357    let local_var_result = if body_json {
3358        local_var_req_builder.send_json(body)
3359    } else {
3360        local_var_req_builder.send(body.get_string().as_str())
3361    };
3362
3363    let local_var_resp = local_var_result?;
3364
3365    let local_var_status = local_var_resp.status().as_u16();
3366    if local_var_status < 400 {
3367        ResponseContent::unit(local_var_resp)
3368    } else {
3369        ResponseContent::new(local_var_resp, |data| {
3370            KeysKeyIdPutError::new(local_var_status, data).map_err(From::from)
3371        })
3372        .and_then(|content| Err(Error::ResponseError(content)))
3373    }
3374}
3375
3376/// Delete a tag from the authorized set
3377pub fn keys_key_id_restrictions_tags_tag_delete(
3378    configuration: &configuration::Configuration,
3379    tag: &str,
3380    key_id: &str,
3381) -> Result<ResponseContent<()>, Error<KeysKeyIdRestrictionsTagsTagDeleteError>> {
3382    let local_var_configuration = configuration;
3383
3384    let local_var_client = &local_var_configuration.client;
3385
3386    let local_var_uri_str = format!(
3387        "{}/keys/{KeyID}/restrictions/tags/{Tag}",
3388        local_var_configuration.base_path,
3389        Tag = crate::apis::urlencode(tag),
3390        KeyID = crate::apis::urlencode(key_id)
3391    );
3392    let mut local_var_req_builder =
3393        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3394    local_var_req_builder = local_var_req_builder
3395        .config()
3396        .http_status_as_error(false)
3397        .build();
3398
3399    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3400        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3401    }
3402    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3403        let value = super::basic_auth(local_var_auth_conf);
3404
3405        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3406    };
3407
3408    let local_var_result = local_var_req_builder.send_empty();
3409
3410    let local_var_resp = local_var_result?;
3411
3412    let local_var_status = local_var_resp.status().as_u16();
3413    if local_var_status < 400 {
3414        ResponseContent::unit(local_var_resp)
3415    } else {
3416        ResponseContent::new(local_var_resp, |data| {
3417            KeysKeyIdRestrictionsTagsTagDeleteError::new(local_var_status, data).map_err(From::from)
3418        })
3419        .and_then(|content| Err(Error::ResponseError(content)))
3420    }
3421}
3422
3423/// Add a tag to the authorized set
3424pub fn keys_key_id_restrictions_tags_tag_put(
3425    configuration: &configuration::Configuration,
3426    tag: &str,
3427    key_id: &str,
3428) -> Result<ResponseContent<()>, Error<KeysKeyIdRestrictionsTagsTagPutError>> {
3429    let local_var_configuration = configuration;
3430
3431    let local_var_client = &local_var_configuration.client;
3432
3433    let local_var_uri_str = format!(
3434        "{}/keys/{KeyID}/restrictions/tags/{Tag}",
3435        local_var_configuration.base_path,
3436        Tag = crate::apis::urlencode(tag),
3437        KeyID = crate::apis::urlencode(key_id)
3438    );
3439    let mut local_var_req_builder =
3440        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3441    local_var_req_builder = local_var_req_builder
3442        .config()
3443        .http_status_as_error(false)
3444        .build();
3445
3446    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3447        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3448    }
3449    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3450        let value = super::basic_auth(local_var_auth_conf);
3451
3452        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3453    };
3454
3455    let local_var_result = local_var_req_builder.send_empty();
3456
3457    let local_var_resp = local_var_result?;
3458
3459    let local_var_status = local_var_resp.status().as_u16();
3460    if local_var_status < 400 {
3461        ResponseContent::unit(local_var_resp)
3462    } else {
3463        ResponseContent::new(local_var_resp, |data| {
3464            KeysKeyIdRestrictionsTagsTagPutError::new(local_var_status, data).map_err(From::from)
3465        })
3466        .and_then(|content| Err(Error::ResponseError(content)))
3467    }
3468}
3469
3470/// Sign a message with the secret key.
3471pub fn keys_key_id_sign_post(
3472    configuration: &configuration::Configuration,
3473    key_id: &str,
3474    sign_request_data: crate::models::SignRequestData,
3475) -> Result<ResponseContent<crate::models::SignData>, Error<KeysKeyIdSignPostError>> {
3476    let local_var_configuration = configuration;
3477
3478    let local_var_client = &local_var_configuration.client;
3479
3480    let local_var_uri_str = format!(
3481        "{}/keys/{KeyID}/sign",
3482        local_var_configuration.base_path,
3483        KeyID = crate::apis::urlencode(key_id)
3484    );
3485    let mut local_var_req_builder =
3486        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3487    local_var_req_builder = local_var_req_builder
3488        .config()
3489        .http_status_as_error(false)
3490        .build();
3491
3492    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3493        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3494    }
3495    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3496        let value = super::basic_auth(local_var_auth_conf);
3497
3498        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3499    };
3500    let accept_str = "application/json";
3501    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3502
3503    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3504    let local_var_result = local_var_req_builder.send_json(sign_request_data);
3505
3506    let local_var_resp = local_var_result?;
3507
3508    let local_var_status = local_var_resp.status().as_u16();
3509    if local_var_status < 400 {
3510        ResponseContent::deserialized(local_var_resp)
3511    } else {
3512        ResponseContent::new(local_var_resp, |data| {
3513            KeysKeyIdSignPostError::new(local_var_status, data).map_err(From::from)
3514        })
3515        .and_then(|content| Err(Error::ResponseError(content)))
3516    }
3517}
3518
3519/// 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.
3520pub fn keys_post(
3521    configuration: &configuration::Configuration,
3522    body: KeysPostBody,
3523) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<KeysPostError>> {
3524    let local_var_configuration = configuration;
3525
3526    let local_var_client = &local_var_configuration.client;
3527
3528    let local_var_uri_str = format!("{}/keys", local_var_configuration.base_path);
3529    let mut local_var_req_builder =
3530        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3531    local_var_req_builder = local_var_req_builder
3532        .config()
3533        .http_status_as_error(false)
3534        .build();
3535
3536    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3537        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3538    }
3539    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3540        let value = super::basic_auth(local_var_auth_conf);
3541
3542        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3543    };
3544    let accept_str = "application/json";
3545    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3546
3547    let body_json = body.is_json();
3548    local_var_req_builder = local_var_req_builder.header("content-type", body.content_type());
3549
3550    let local_var_result = if body_json {
3551        local_var_req_builder.send_json(body)
3552    } else {
3553        local_var_req_builder.send(body.get_string().as_str())
3554    };
3555
3556    let local_var_resp = local_var_result?;
3557
3558    let local_var_status = local_var_resp.status().as_u16();
3559    if local_var_status < 400 {
3560        ResponseContent::deserialized(local_var_resp)
3561    } else {
3562        ResponseContent::new(local_var_resp, |data| {
3563            KeysPostError::new(local_var_status, data).map_err(From::from)
3564        })
3565        .and_then(|content| Err(Error::ResponseError(content)))
3566    }
3567}
3568
3569/// Brings an *Operational* NetHSM into *Locked* state.
3570pub fn lock_post(
3571    configuration: &configuration::Configuration,
3572) -> Result<ResponseContent<()>, Error<LockPostError>> {
3573    let local_var_configuration = configuration;
3574
3575    let local_var_client = &local_var_configuration.client;
3576
3577    let local_var_uri_str = format!("{}/lock", local_var_configuration.base_path);
3578    let mut local_var_req_builder =
3579        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3580    local_var_req_builder = local_var_req_builder
3581        .config()
3582        .http_status_as_error(false)
3583        .build();
3584
3585    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3586        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3587    }
3588    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3589        let value = super::basic_auth(local_var_auth_conf);
3590
3591        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3592    };
3593
3594    let local_var_result = local_var_req_builder.send_empty();
3595
3596    let local_var_resp = local_var_result?;
3597
3598    let local_var_status = local_var_resp.status().as_u16();
3599    if local_var_status < 400 {
3600        ResponseContent::unit(local_var_resp)
3601    } else {
3602        ResponseContent::new(local_var_resp, |data| {
3603            LockPostError::new(local_var_status, data).map_err(From::from)
3604        })
3605        .and_then(|content| Err(Error::ResponseError(content)))
3606    }
3607}
3608
3609/// Get metrics. Precondition: NetHSM is *Operational* and a **R-Metrics** can be authenticated.
3610pub fn metrics_get(
3611    configuration: &configuration::Configuration,
3612) -> Result<ResponseContent<serde_json::Value>, Error<MetricsGetError>> {
3613    let local_var_configuration = configuration;
3614
3615    let local_var_client = &local_var_configuration.client;
3616
3617    let local_var_uri_str = format!("{}/metrics", local_var_configuration.base_path);
3618    let mut local_var_req_builder =
3619        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3620    local_var_req_builder = local_var_req_builder
3621        .config()
3622        .http_status_as_error(false)
3623        .build();
3624
3625    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3626        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3627    }
3628    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3629        let value = super::basic_auth(local_var_auth_conf);
3630
3631        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3632    };
3633    let accept_str = "application/json";
3634    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3635
3636    let local_var_result = local_var_req_builder.send_empty();
3637
3638    let local_var_resp = local_var_result?;
3639
3640    let local_var_status = local_var_resp.status().as_u16();
3641    if local_var_status < 400 {
3642        ResponseContent::deserialized(local_var_resp)
3643    } else {
3644        ResponseContent::new(local_var_resp, |data| {
3645            MetricsGetError::new(local_var_status, data).map_err(From::from)
3646        })
3647        .and_then(|content| Err(Error::ResponseError(content)))
3648    }
3649}
3650
3651/// 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.
3652pub fn namespaces_get(
3653    configuration: &configuration::Configuration,
3654) -> Result<ResponseContent<Vec<crate::models::NamespaceItem>>, Error<NamespacesGetError>> {
3655    let local_var_configuration = configuration;
3656
3657    let local_var_client = &local_var_configuration.client;
3658
3659    let local_var_uri_str = format!("{}/namespaces", local_var_configuration.base_path);
3660    let mut local_var_req_builder =
3661        create_request!(local_var_client, GET, local_var_uri_str.as_str());
3662    local_var_req_builder = local_var_req_builder
3663        .config()
3664        .http_status_as_error(false)
3665        .build();
3666
3667    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3668        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3669    }
3670    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3671        let value = super::basic_auth(local_var_auth_conf);
3672
3673        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3674    };
3675    let accept_str = "application/json";
3676    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3677
3678    let local_var_result = local_var_req_builder.send_empty();
3679
3680    let local_var_resp = local_var_result?;
3681
3682    let local_var_status = local_var_resp.status().as_u16();
3683    if local_var_status < 400 {
3684        ResponseContent::deserialized(local_var_resp)
3685    } else {
3686        ResponseContent::new(local_var_resp, |data| {
3687            NamespacesGetError::new(local_var_status, data).map_err(From::from)
3688        })
3689        .and_then(|content| Err(Error::ResponseError(content)))
3690    }
3691}
3692
3693/// Delete a namespace. **WARNING: all keys from that namespace are deleted.**
3694pub fn namespaces_namespace_id_delete(
3695    configuration: &configuration::Configuration,
3696    namespace_id: &str,
3697) -> Result<ResponseContent<()>, Error<NamespacesNamespaceIdDeleteError>> {
3698    let local_var_configuration = configuration;
3699
3700    let local_var_client = &local_var_configuration.client;
3701
3702    let local_var_uri_str = format!(
3703        "{}/namespaces/{NamespaceID}",
3704        local_var_configuration.base_path,
3705        NamespaceID = crate::apis::urlencode(namespace_id)
3706    );
3707    let mut local_var_req_builder =
3708        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
3709    local_var_req_builder = local_var_req_builder
3710        .config()
3711        .http_status_as_error(false)
3712        .build();
3713
3714    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3715        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3716    }
3717    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3718        let value = super::basic_auth(local_var_auth_conf);
3719
3720        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3721    };
3722
3723    let local_var_result = local_var_req_builder.send_empty();
3724
3725    let local_var_resp = local_var_result?;
3726
3727    let local_var_status = local_var_resp.status().as_u16();
3728    if local_var_status < 400 {
3729        ResponseContent::unit(local_var_resp)
3730    } else {
3731        ResponseContent::new(local_var_resp, |data| {
3732            NamespacesNamespaceIdDeleteError::new(local_var_status, data).map_err(From::from)
3733        })
3734        .and_then(|content| Err(Error::ResponseError(content)))
3735    }
3736}
3737
3738/// 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.
3739pub fn namespaces_namespace_id_put(
3740    configuration: &configuration::Configuration,
3741    namespace_id: &str,
3742) -> Result<ResponseContent<()>, Error<NamespacesNamespaceIdPutError>> {
3743    let local_var_configuration = configuration;
3744
3745    let local_var_client = &local_var_configuration.client;
3746
3747    let local_var_uri_str = format!(
3748        "{}/namespaces/{NamespaceID}",
3749        local_var_configuration.base_path,
3750        NamespaceID = crate::apis::urlencode(namespace_id)
3751    );
3752    let mut local_var_req_builder =
3753        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
3754    local_var_req_builder = local_var_req_builder
3755        .config()
3756        .http_status_as_error(false)
3757        .build();
3758
3759    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3760        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3761    }
3762    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3763        let value = super::basic_auth(local_var_auth_conf);
3764
3765        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3766    };
3767
3768    let local_var_result = local_var_req_builder.send_empty();
3769
3770    let local_var_resp = local_var_result?;
3771
3772    let local_var_status = local_var_resp.status().as_u16();
3773    if local_var_status < 400 {
3774        ResponseContent::unit(local_var_resp)
3775    } else {
3776        ResponseContent::new(local_var_resp, |data| {
3777            NamespacesNamespaceIdPutError::new(local_var_status, data).map_err(From::from)
3778        })
3779        .and_then(|content| Err(Error::ResponseError(content)))
3780    }
3781}
3782
3783/// 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.
3784pub fn provision_post(
3785    configuration: &configuration::Configuration,
3786    provision_request_data: crate::models::ProvisionRequestData,
3787) -> Result<ResponseContent<()>, Error<ProvisionPostError>> {
3788    let local_var_configuration = configuration;
3789
3790    let local_var_client = &local_var_configuration.client;
3791
3792    let local_var_uri_str = format!("{}/provision", local_var_configuration.base_path);
3793    let mut local_var_req_builder =
3794        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3795    local_var_req_builder = local_var_req_builder
3796        .config()
3797        .http_status_as_error(false)
3798        .build();
3799
3800    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3801        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3802    }
3803
3804    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3805    let local_var_result = local_var_req_builder.send_json(provision_request_data);
3806
3807    let local_var_resp = local_var_result?;
3808
3809    let local_var_status = local_var_resp.status().as_u16();
3810    if local_var_status < 400 {
3811        ResponseContent::unit(local_var_resp)
3812    } else {
3813        ResponseContent::new(local_var_resp, |data| {
3814            ProvisionPostError::new(local_var_status, data).map_err(From::from)
3815        })
3816        .and_then(|content| Err(Error::ResponseError(content)))
3817    }
3818}
3819
3820/// Retrieve cryptographically strong random bytes from NetHSM. Precondition: NetHSM is *Operational* and a **R-Operator** can be authenticated.
3821pub fn random_post(
3822    configuration: &configuration::Configuration,
3823    random_request_data: crate::models::RandomRequestData,
3824) -> Result<ResponseContent<crate::models::RandomData>, Error<RandomPostError>> {
3825    let local_var_configuration = configuration;
3826
3827    let local_var_client = &local_var_configuration.client;
3828
3829    let local_var_uri_str = format!("{}/random", local_var_configuration.base_path);
3830    let mut local_var_req_builder =
3831        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3832    local_var_req_builder = local_var_req_builder
3833        .config()
3834        .http_status_as_error(false)
3835        .build();
3836
3837    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3838        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3839    }
3840    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3841        let value = super::basic_auth(local_var_auth_conf);
3842
3843        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3844    };
3845    let accept_str = "application/json";
3846    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3847
3848    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
3849    let local_var_result = local_var_req_builder.send_json(random_request_data);
3850
3851    let local_var_resp = local_var_result?;
3852
3853    let local_var_status = local_var_resp.status().as_u16();
3854    if local_var_status < 400 {
3855        ResponseContent::deserialized(local_var_resp)
3856    } else {
3857        ResponseContent::new(local_var_resp, |data| {
3858            RandomPostError::new(local_var_status, data).map_err(From::from)
3859        })
3860        .and_then(|content| Err(Error::ResponseError(content)))
3861    }
3862}
3863
3864/// Back up the key store to a backup file.
3865pub fn system_backup_post(
3866    configuration: &configuration::Configuration,
3867) -> Result<ResponseContent<std::vec::Vec<u8>>, Error<SystemBackupPostError>> {
3868    let local_var_configuration = configuration;
3869
3870    let local_var_client = &local_var_configuration.client;
3871
3872    let local_var_uri_str = format!("{}/system/backup", local_var_configuration.base_path);
3873    let mut local_var_req_builder =
3874        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3875    local_var_req_builder = local_var_req_builder
3876        .config()
3877        .http_status_as_error(false)
3878        .build();
3879
3880    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3881        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3882    }
3883    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3884        let value = super::basic_auth(local_var_auth_conf);
3885
3886        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3887    };
3888    let accept_str = "application/octet-stream";
3889    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
3890
3891    let local_var_result = local_var_req_builder.send_empty();
3892
3893    let local_var_resp = local_var_result?;
3894
3895    let local_var_status = local_var_resp.status().as_u16();
3896    if local_var_status < 400 {
3897        ResponseContent::bytes(local_var_resp)
3898    } else {
3899        ResponseContent::new(local_var_resp, |data| {
3900            SystemBackupPostError::new(local_var_status, data).map_err(From::from)
3901        })
3902        .and_then(|content| Err(Error::ResponseError(content)))
3903    }
3904}
3905
3906/// Cancel update of NetHSM software.
3907pub fn system_cancel_update_post(
3908    configuration: &configuration::Configuration,
3909) -> Result<ResponseContent<()>, Error<SystemCancelUpdatePostError>> {
3910    let local_var_configuration = configuration;
3911
3912    let local_var_client = &local_var_configuration.client;
3913
3914    let local_var_uri_str = format!("{}/system/cancel-update", local_var_configuration.base_path);
3915    let mut local_var_req_builder =
3916        create_request!(local_var_client, POST, 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            SystemCancelUpdatePostError::new(local_var_status, data).map_err(From::from)
3941        })
3942        .and_then(|content| Err(Error::ResponseError(content)))
3943    }
3944}
3945
3946/// Commit update of NetHSM software.
3947pub fn system_commit_update_post(
3948    configuration: &configuration::Configuration,
3949) -> Result<ResponseContent<()>, Error<SystemCommitUpdatePostError>> {
3950    let local_var_configuration = configuration;
3951
3952    let local_var_client = &local_var_configuration.client;
3953
3954    let local_var_uri_str = format!("{}/system/commit-update", local_var_configuration.base_path);
3955    let mut local_var_req_builder =
3956        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3957    local_var_req_builder = local_var_req_builder
3958        .config()
3959        .http_status_as_error(false)
3960        .build();
3961
3962    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3963        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
3964    }
3965    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
3966        let value = super::basic_auth(local_var_auth_conf);
3967
3968        local_var_req_builder = local_var_req_builder.header("authorization", &value);
3969    };
3970
3971    let local_var_result = local_var_req_builder.send_empty();
3972
3973    let local_var_resp = local_var_result?;
3974
3975    let local_var_status = local_var_resp.status().as_u16();
3976    if local_var_status < 400 {
3977        ResponseContent::unit(local_var_resp)
3978    } else {
3979        ResponseContent::new(local_var_resp, |data| {
3980            SystemCommitUpdatePostError::new(local_var_status, data).map_err(From::from)
3981        })
3982        .and_then(|content| Err(Error::ResponseError(content)))
3983    }
3984}
3985
3986/// Reset NetHSM to factory settings.
3987pub fn system_factory_reset_post(
3988    configuration: &configuration::Configuration,
3989) -> Result<ResponseContent<()>, Error<SystemFactoryResetPostError>> {
3990    let local_var_configuration = configuration;
3991
3992    let local_var_client = &local_var_configuration.client;
3993
3994    let local_var_uri_str = format!("{}/system/factory-reset", local_var_configuration.base_path);
3995    let mut local_var_req_builder =
3996        create_request!(local_var_client, POST, local_var_uri_str.as_str());
3997    local_var_req_builder = local_var_req_builder
3998        .config()
3999        .http_status_as_error(false)
4000        .build();
4001
4002    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4003        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4004    }
4005    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4006        let value = super::basic_auth(local_var_auth_conf);
4007
4008        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4009    };
4010
4011    let local_var_result = local_var_req_builder.send_empty();
4012
4013    let local_var_resp = local_var_result?;
4014
4015    let local_var_status = local_var_resp.status().as_u16();
4016    if local_var_status < 400 {
4017        ResponseContent::unit(local_var_resp)
4018    } else {
4019        ResponseContent::new(local_var_resp, |data| {
4020            SystemFactoryResetPostError::new(local_var_status, data).map_err(From::from)
4021        })
4022        .and_then(|content| Err(Error::ResponseError(content)))
4023    }
4024}
4025
4026/// Get detailed system information, including firmware, system, and hardware version.
4027pub fn system_info_get(
4028    configuration: &configuration::Configuration,
4029) -> Result<ResponseContent<crate::models::SystemInfo>, Error<SystemInfoGetError>> {
4030    let local_var_configuration = configuration;
4031
4032    let local_var_client = &local_var_configuration.client;
4033
4034    let local_var_uri_str = format!("{}/system/info", local_var_configuration.base_path);
4035    let mut local_var_req_builder =
4036        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4037    local_var_req_builder = local_var_req_builder
4038        .config()
4039        .http_status_as_error(false)
4040        .build();
4041
4042    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4043        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4044    }
4045    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4046        let value = super::basic_auth(local_var_auth_conf);
4047
4048        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4049    };
4050    let accept_str = "application/json";
4051    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4052
4053    let local_var_result = local_var_req_builder.send_empty();
4054
4055    let local_var_resp = local_var_result?;
4056
4057    let local_var_status = local_var_resp.status().as_u16();
4058    if local_var_status < 400 {
4059        ResponseContent::deserialized(local_var_resp)
4060    } else {
4061        ResponseContent::new(local_var_resp, |data| {
4062            SystemInfoGetError::new(local_var_status, data).map_err(From::from)
4063        })
4064        .and_then(|content| Err(Error::ResponseError(content)))
4065    }
4066}
4067
4068/// Reboot NetHSM.
4069pub fn system_reboot_post(
4070    configuration: &configuration::Configuration,
4071) -> Result<ResponseContent<()>, Error<SystemRebootPostError>> {
4072    let local_var_configuration = configuration;
4073
4074    let local_var_client = &local_var_configuration.client;
4075
4076    let local_var_uri_str = format!("{}/system/reboot", local_var_configuration.base_path);
4077    let mut local_var_req_builder =
4078        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4079    local_var_req_builder = local_var_req_builder
4080        .config()
4081        .http_status_as_error(false)
4082        .build();
4083
4084    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4085        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4086    }
4087    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4088        let value = super::basic_auth(local_var_auth_conf);
4089
4090        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4091    };
4092
4093    let local_var_result = local_var_req_builder.send_empty();
4094
4095    let local_var_resp = local_var_result?;
4096
4097    let local_var_status = local_var_resp.status().as_u16();
4098    if local_var_status < 400 {
4099        ResponseContent::unit(local_var_resp)
4100    } else {
4101        ResponseContent::new(local_var_resp, |data| {
4102            SystemRebootPostError::new(local_var_status, data).map_err(From::from)
4103        })
4104        .and_then(|content| Err(Error::ResponseError(content)))
4105    }
4106}
4107
4108/// Restore the key store and user store from a backup file. If NetHSM is *Unprovisioned*, then the configuration is restored.
4109pub fn system_restore_post(
4110    configuration: &configuration::Configuration,
4111    arguments: Option<crate::models::RestoreRequestArguments>,
4112    backup_file: Option<std::vec::Vec<u8>>,
4113) -> Result<ResponseContent<()>, Error<SystemRestorePostError>> {
4114    let local_var_configuration = configuration;
4115
4116    let local_var_client = &local_var_configuration.client;
4117
4118    let local_var_uri_str = format!("{}/system/restore", local_var_configuration.base_path);
4119    let mut local_var_req_builder =
4120        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4121    local_var_req_builder = local_var_req_builder
4122        .config()
4123        .http_status_as_error(false)
4124        .build();
4125
4126    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4127        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4128    }
4129    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4130        let value = super::basic_auth(local_var_auth_conf);
4131
4132        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4133    };
4134
4135    let mut local_var_multipart = ::multipart::client::lazy::Multipart::new();
4136
4137    if let Some(backup_file) = backup_file {
4138        local_var_multipart.add_stream(
4139            "backup_file",
4140            ::std::io::Cursor::new(backup_file),
4141            None::<&str>,
4142            None,
4143        );
4144    }
4145    if let Some(arguments) = arguments {
4146        let arguments = ::serde_json::to_vec(&arguments)?;
4147        local_var_multipart.add_stream(
4148            "arguments",
4149            ::std::io::Cursor::new(arguments),
4150            None::<&str>,
4151            None,
4152        );
4153    }
4154
4155    let mut local_var_multipart = local_var_multipart.prepare()?;
4156    local_var_req_builder = local_var_req_builder.header(
4157        "content-type",
4158        &format!(
4159            "multipart/form-data; boundary={}",
4160            local_var_multipart.boundary()
4161        ),
4162    );
4163    let local_var_result =
4164        local_var_req_builder.send(ureq::SendBody::from_reader(&mut local_var_multipart));
4165
4166    let local_var_resp = local_var_result?;
4167
4168    let local_var_status = local_var_resp.status().as_u16();
4169    if local_var_status < 400 {
4170        ResponseContent::unit(local_var_resp)
4171    } else {
4172        ResponseContent::new(local_var_resp, |data| {
4173            SystemRestorePostError::new(local_var_status, data).map_err(From::from)
4174        })
4175        .and_then(|content| Err(Error::ResponseError(content)))
4176    }
4177}
4178
4179/// Shut down NetHSM.
4180pub fn system_shutdown_post(
4181    configuration: &configuration::Configuration,
4182) -> Result<ResponseContent<()>, Error<SystemShutdownPostError>> {
4183    let local_var_configuration = configuration;
4184
4185    let local_var_client = &local_var_configuration.client;
4186
4187    let local_var_uri_str = format!("{}/system/shutdown", local_var_configuration.base_path);
4188    let mut local_var_req_builder =
4189        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4190    local_var_req_builder = local_var_req_builder
4191        .config()
4192        .http_status_as_error(false)
4193        .build();
4194
4195    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4196        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4197    }
4198    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4199        let value = super::basic_auth(local_var_auth_conf);
4200
4201        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4202    };
4203
4204    let local_var_result = local_var_req_builder.send_empty();
4205
4206    let local_var_resp = local_var_result?;
4207
4208    let local_var_status = local_var_resp.status().as_u16();
4209    if local_var_status < 400 {
4210        ResponseContent::unit(local_var_resp)
4211    } else {
4212        ResponseContent::new(local_var_resp, |data| {
4213            SystemShutdownPostError::new(local_var_status, data).map_err(From::from)
4214        })
4215        .and_then(|content| Err(Error::ResponseError(content)))
4216    }
4217}
4218
4219/// Update NetHSM software.
4220pub fn system_update_post(
4221    configuration: &configuration::Configuration,
4222    body: std::vec::Vec<u8>,
4223) -> Result<ResponseContent<crate::models::SystemUpdateData>, Error<SystemUpdatePostError>> {
4224    let local_var_configuration = configuration;
4225
4226    let local_var_client = &local_var_configuration.client;
4227
4228    let local_var_uri_str = format!("{}/system/update", local_var_configuration.base_path);
4229    let mut local_var_req_builder =
4230        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4231    local_var_req_builder = local_var_req_builder
4232        .config()
4233        .http_status_as_error(false)
4234        .build();
4235
4236    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4237        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4238    }
4239    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4240        let value = super::basic_auth(local_var_auth_conf);
4241
4242        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4243    };
4244    let accept_str = "application/json";
4245    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4246
4247    local_var_req_builder =
4248        local_var_req_builder.header("content-type", "application/octet-stream");
4249    let local_var_result = local_var_req_builder.send(body);
4250
4251    let local_var_resp = local_var_result?;
4252
4253    let local_var_status = local_var_resp.status().as_u16();
4254    if local_var_status < 400 {
4255        ResponseContent::deserialized(local_var_resp)
4256    } else {
4257        ResponseContent::new(local_var_resp, |data| {
4258            SystemUpdatePostError::new(local_var_status, data).map_err(From::from)
4259        })
4260        .and_then(|content| Err(Error::ResponseError(content)))
4261    }
4262}
4263
4264/// Brings a *Locked* NetHSM into *Operational* state.
4265pub fn unlock_post(
4266    configuration: &configuration::Configuration,
4267    unlock_request_data: crate::models::UnlockRequestData,
4268) -> Result<ResponseContent<()>, Error<UnlockPostError>> {
4269    let local_var_configuration = configuration;
4270
4271    let local_var_client = &local_var_configuration.client;
4272
4273    let local_var_uri_str = format!("{}/unlock", local_var_configuration.base_path);
4274    let mut local_var_req_builder =
4275        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4276    local_var_req_builder = local_var_req_builder
4277        .config()
4278        .http_status_as_error(false)
4279        .build();
4280
4281    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4282        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4283    }
4284
4285    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4286    let local_var_result = local_var_req_builder.send_json(unlock_request_data);
4287
4288    let local_var_resp = local_var_result?;
4289
4290    let local_var_status = local_var_resp.status().as_u16();
4291    if local_var_status < 400 {
4292        ResponseContent::unit(local_var_resp)
4293    } else {
4294        ResponseContent::new(local_var_resp, |data| {
4295            UnlockPostError::new(local_var_status, data).map_err(From::from)
4296        })
4297        .and_then(|content| Err(Error::ResponseError(content)))
4298    }
4299}
4300
4301/// 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.
4302pub fn users_get(
4303    configuration: &configuration::Configuration,
4304) -> Result<ResponseContent<Vec<crate::models::UserItem>>, Error<UsersGetError>> {
4305    let local_var_configuration = configuration;
4306
4307    let local_var_client = &local_var_configuration.client;
4308
4309    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
4310    let mut local_var_req_builder =
4311        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4312    local_var_req_builder = local_var_req_builder
4313        .config()
4314        .http_status_as_error(false)
4315        .build();
4316
4317    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4318        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4319    }
4320    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4321        let value = super::basic_auth(local_var_auth_conf);
4322
4323        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4324    };
4325    let accept_str = "application/json";
4326    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4327
4328    let local_var_result = local_var_req_builder.send_empty();
4329
4330    let local_var_resp = local_var_result?;
4331
4332    let local_var_status = local_var_resp.status().as_u16();
4333    if local_var_status < 400 {
4334        ResponseContent::deserialized(local_var_resp)
4335    } else {
4336        ResponseContent::new(local_var_resp, |data| {
4337            UsersGetError::new(local_var_status, data).map_err(From::from)
4338        })
4339        .and_then(|content| Err(Error::ResponseError(content)))
4340    }
4341}
4342
4343/// Create a new user on NetHSM, inheriting the caller's namespace. The user-ID is generated by NetHSM.
4344pub fn users_post(
4345    configuration: &configuration::Configuration,
4346    user_post_data: crate::models::UserPostData,
4347) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<UsersPostError>> {
4348    let local_var_configuration = configuration;
4349
4350    let local_var_client = &local_var_configuration.client;
4351
4352    let local_var_uri_str = format!("{}/users", local_var_configuration.base_path);
4353    let mut local_var_req_builder =
4354        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4355    local_var_req_builder = local_var_req_builder
4356        .config()
4357        .http_status_as_error(false)
4358        .build();
4359
4360    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4361        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4362    }
4363    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4364        let value = super::basic_auth(local_var_auth_conf);
4365
4366        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4367    };
4368    let accept_str = "application/json";
4369    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4370
4371    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4372    let local_var_result = local_var_req_builder.send_json(user_post_data);
4373
4374    let local_var_resp = local_var_result?;
4375
4376    let local_var_status = local_var_resp.status().as_u16();
4377    if local_var_status < 400 {
4378        ResponseContent::deserialized(local_var_resp)
4379    } else {
4380        ResponseContent::new(local_var_resp, |data| {
4381            UsersPostError::new(local_var_status, data).map_err(From::from)
4382        })
4383        .and_then(|content| Err(Error::ResponseError(content)))
4384    }
4385}
4386
4387/// Delete a user from keyfender.
4388pub fn users_user_id_delete(
4389    configuration: &configuration::Configuration,
4390    user_id: &str,
4391) -> Result<ResponseContent<()>, Error<UsersUserIdDeleteError>> {
4392    let local_var_configuration = configuration;
4393
4394    let local_var_client = &local_var_configuration.client;
4395
4396    let local_var_uri_str = format!(
4397        "{}/users/{UserID}",
4398        local_var_configuration.base_path,
4399        UserID = crate::apis::urlencode(user_id)
4400    );
4401    let mut local_var_req_builder =
4402        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
4403    local_var_req_builder = local_var_req_builder
4404        .config()
4405        .http_status_as_error(false)
4406        .build();
4407
4408    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4409        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4410    }
4411    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4412        let value = super::basic_auth(local_var_auth_conf);
4413
4414        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4415    };
4416
4417    let local_var_result = local_var_req_builder.send_empty();
4418
4419    let local_var_resp = local_var_result?;
4420
4421    let local_var_status = local_var_resp.status().as_u16();
4422    if local_var_status < 400 {
4423        ResponseContent::unit(local_var_resp)
4424    } else {
4425        ResponseContent::new(local_var_resp, |data| {
4426            UsersUserIdDeleteError::new(local_var_status, data).map_err(From::from)
4427        })
4428        .and_then(|content| Err(Error::ResponseError(content)))
4429    }
4430}
4431
4432/// Get user info: name and role.
4433pub fn users_user_id_get(
4434    configuration: &configuration::Configuration,
4435    user_id: &str,
4436) -> Result<ResponseContent<crate::models::UserData>, Error<UsersUserIdGetError>> {
4437    let local_var_configuration = configuration;
4438
4439    let local_var_client = &local_var_configuration.client;
4440
4441    let local_var_uri_str = format!(
4442        "{}/users/{UserID}",
4443        local_var_configuration.base_path,
4444        UserID = crate::apis::urlencode(user_id)
4445    );
4446    let mut local_var_req_builder =
4447        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4448    local_var_req_builder = local_var_req_builder
4449        .config()
4450        .http_status_as_error(false)
4451        .build();
4452
4453    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4454        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4455    }
4456    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4457        let value = super::basic_auth(local_var_auth_conf);
4458
4459        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4460    };
4461    let accept_str = "application/json";
4462    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4463
4464    let local_var_result = local_var_req_builder.send_empty();
4465
4466    let local_var_resp = local_var_result?;
4467
4468    let local_var_status = local_var_resp.status().as_u16();
4469    if local_var_status < 400 {
4470        ResponseContent::deserialized(local_var_resp)
4471    } else {
4472        ResponseContent::new(local_var_resp, |data| {
4473            UsersUserIdGetError::new(local_var_status, data).map_err(From::from)
4474        })
4475        .and_then(|content| Err(Error::ResponseError(content)))
4476    }
4477}
4478
4479/// Update the passphrase.
4480pub fn users_user_id_passphrase_post(
4481    configuration: &configuration::Configuration,
4482    user_id: &str,
4483    user_passphrase_post_data: crate::models::UserPassphrasePostData,
4484) -> Result<ResponseContent<()>, Error<UsersUserIdPassphrasePostError>> {
4485    let local_var_configuration = configuration;
4486
4487    let local_var_client = &local_var_configuration.client;
4488
4489    let local_var_uri_str = format!(
4490        "{}/users/{UserID}/passphrase",
4491        local_var_configuration.base_path,
4492        UserID = crate::apis::urlencode(user_id)
4493    );
4494    let mut local_var_req_builder =
4495        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4496    local_var_req_builder = local_var_req_builder
4497        .config()
4498        .http_status_as_error(false)
4499        .build();
4500
4501    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4502        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4503    }
4504    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4505        let value = super::basic_auth(local_var_auth_conf);
4506
4507        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4508    };
4509
4510    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4511    let local_var_result = local_var_req_builder.send_json(user_passphrase_post_data);
4512
4513    let local_var_resp = local_var_result?;
4514
4515    let local_var_status = local_var_resp.status().as_u16();
4516    if local_var_status < 400 {
4517        ResponseContent::unit(local_var_resp)
4518    } else {
4519        ResponseContent::new(local_var_resp, |data| {
4520            UsersUserIdPassphrasePostError::new(local_var_status, data).map_err(From::from)
4521        })
4522        .and_then(|content| Err(Error::ResponseError(content)))
4523    }
4524}
4525
4526/// 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\".
4527pub fn users_user_id_post(
4528    configuration: &configuration::Configuration,
4529    user_id: &str,
4530    user_post_data: crate::models::UserPostData,
4531) -> Result<ResponseContent<crate::models::CreateResourceId>, Error<UsersUserIdPostError>> {
4532    let local_var_configuration = configuration;
4533
4534    let local_var_client = &local_var_configuration.client;
4535
4536    let local_var_uri_str = format!(
4537        "{}/users/{UserID}",
4538        local_var_configuration.base_path,
4539        UserID = crate::apis::urlencode(user_id)
4540    );
4541    let mut local_var_req_builder =
4542        create_request!(local_var_client, POST, local_var_uri_str.as_str());
4543    local_var_req_builder = local_var_req_builder
4544        .config()
4545        .http_status_as_error(false)
4546        .build();
4547
4548    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4549        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4550    }
4551    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4552        let value = super::basic_auth(local_var_auth_conf);
4553
4554        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4555    };
4556    let accept_str = "application/json";
4557    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4558
4559    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4560    let local_var_result = local_var_req_builder.send_json(user_post_data);
4561
4562    let local_var_resp = local_var_result?;
4563
4564    let local_var_status = local_var_resp.status().as_u16();
4565    if local_var_status < 400 {
4566        ResponseContent::deserialized(local_var_resp)
4567    } else {
4568        ResponseContent::new(local_var_resp, |data| {
4569            UsersUserIdPostError::new(local_var_status, data).map_err(From::from)
4570        })
4571        .and_then(|content| Err(Error::ResponseError(content)))
4572    }
4573}
4574
4575/// 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.
4576pub fn users_user_id_put(
4577    configuration: &configuration::Configuration,
4578    user_id: &str,
4579    user_post_data: crate::models::UserPostData,
4580) -> Result<ResponseContent<()>, Error<UsersUserIdPutError>> {
4581    let local_var_configuration = configuration;
4582
4583    let local_var_client = &local_var_configuration.client;
4584
4585    let local_var_uri_str = format!(
4586        "{}/users/{UserID}",
4587        local_var_configuration.base_path,
4588        UserID = crate::apis::urlencode(user_id)
4589    );
4590    let mut local_var_req_builder =
4591        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
4592    local_var_req_builder = local_var_req_builder
4593        .config()
4594        .http_status_as_error(false)
4595        .build();
4596
4597    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4598        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4599    }
4600    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4601        let value = super::basic_auth(local_var_auth_conf);
4602
4603        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4604    };
4605
4606    local_var_req_builder = local_var_req_builder.header("content-type", "application/json");
4607    let local_var_result = local_var_req_builder.send_json(user_post_data);
4608
4609    let local_var_resp = local_var_result?;
4610
4611    let local_var_status = local_var_resp.status().as_u16();
4612    if local_var_status < 400 {
4613        ResponseContent::unit(local_var_resp)
4614    } else {
4615        ResponseContent::new(local_var_resp, |data| {
4616            UsersUserIdPutError::new(local_var_status, data).map_err(From::from)
4617        })
4618        .and_then(|content| Err(Error::ResponseError(content)))
4619    }
4620}
4621
4622/// Get the list of tags set to an Operator user.
4623pub fn users_user_id_tags_get(
4624    configuration: &configuration::Configuration,
4625    user_id: &str,
4626) -> Result<ResponseContent<Vec<String>>, Error<UsersUserIdTagsGetError>> {
4627    let local_var_configuration = configuration;
4628
4629    let local_var_client = &local_var_configuration.client;
4630
4631    let local_var_uri_str = format!(
4632        "{}/users/{UserID}/tags",
4633        local_var_configuration.base_path,
4634        UserID = crate::apis::urlencode(user_id)
4635    );
4636    let mut local_var_req_builder =
4637        create_request!(local_var_client, GET, local_var_uri_str.as_str());
4638    local_var_req_builder = local_var_req_builder
4639        .config()
4640        .http_status_as_error(false)
4641        .build();
4642
4643    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4644        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4645    }
4646    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4647        let value = super::basic_auth(local_var_auth_conf);
4648
4649        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4650    };
4651    let accept_str = "application/json";
4652    local_var_req_builder = local_var_req_builder.header("accept", accept_str);
4653
4654    let local_var_result = local_var_req_builder.send_empty();
4655
4656    let local_var_resp = local_var_result?;
4657
4658    let local_var_status = local_var_resp.status().as_u16();
4659    if local_var_status < 400 {
4660        ResponseContent::deserialized(local_var_resp)
4661    } else {
4662        ResponseContent::new(local_var_resp, |data| {
4663            UsersUserIdTagsGetError::new(local_var_status, data).map_err(From::from)
4664        })
4665        .and_then(|content| Err(Error::ResponseError(content)))
4666    }
4667}
4668
4669/// Delete a tag from the Operator user
4670pub fn users_user_id_tags_tag_delete(
4671    configuration: &configuration::Configuration,
4672    user_id: &str,
4673    tag: &str,
4674) -> Result<ResponseContent<()>, Error<UsersUserIdTagsTagDeleteError>> {
4675    let local_var_configuration = configuration;
4676
4677    let local_var_client = &local_var_configuration.client;
4678
4679    let local_var_uri_str = format!(
4680        "{}/users/{UserID}/tags/{Tag}",
4681        local_var_configuration.base_path,
4682        UserID = crate::apis::urlencode(user_id),
4683        Tag = crate::apis::urlencode(tag)
4684    );
4685    let mut local_var_req_builder =
4686        create_request!(local_var_client, DELETE, local_var_uri_str.as_str());
4687    local_var_req_builder = local_var_req_builder
4688        .config()
4689        .http_status_as_error(false)
4690        .build();
4691
4692    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4693        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4694    }
4695    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4696        let value = super::basic_auth(local_var_auth_conf);
4697
4698        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4699    };
4700
4701    let local_var_result = local_var_req_builder.send_empty();
4702
4703    let local_var_resp = local_var_result?;
4704
4705    let local_var_status = local_var_resp.status().as_u16();
4706    if local_var_status < 400 {
4707        ResponseContent::unit(local_var_resp)
4708    } else {
4709        ResponseContent::new(local_var_resp, |data| {
4710            UsersUserIdTagsTagDeleteError::new(local_var_status, data).map_err(From::from)
4711        })
4712        .and_then(|content| Err(Error::ResponseError(content)))
4713    }
4714}
4715
4716/// Add a tag to the Operator user.
4717pub fn users_user_id_tags_tag_put(
4718    configuration: &configuration::Configuration,
4719    user_id: &str,
4720    tag: &str,
4721) -> Result<ResponseContent<()>, Error<UsersUserIdTagsTagPutError>> {
4722    let local_var_configuration = configuration;
4723
4724    let local_var_client = &local_var_configuration.client;
4725
4726    let local_var_uri_str = format!(
4727        "{}/users/{UserID}/tags/{Tag}",
4728        local_var_configuration.base_path,
4729        UserID = crate::apis::urlencode(user_id),
4730        Tag = crate::apis::urlencode(tag)
4731    );
4732    let mut local_var_req_builder =
4733        create_request!(local_var_client, PUT, local_var_uri_str.as_str());
4734    local_var_req_builder = local_var_req_builder
4735        .config()
4736        .http_status_as_error(false)
4737        .build();
4738
4739    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
4740        local_var_req_builder = local_var_req_builder.header("user-agent", local_var_user_agent);
4741    }
4742    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
4743        let value = super::basic_auth(local_var_auth_conf);
4744
4745        local_var_req_builder = local_var_req_builder.header("authorization", &value);
4746    };
4747
4748    let local_var_result = local_var_req_builder.send_empty();
4749
4750    let local_var_resp = local_var_result?;
4751
4752    let local_var_status = local_var_resp.status().as_u16();
4753    if local_var_status < 400 {
4754        ResponseContent::unit(local_var_resp)
4755    } else {
4756        ResponseContent::new(local_var_resp, |data| {
4757            UsersUserIdTagsTagPutError::new(local_var_status, data).map_err(From::from)
4758        })
4759        .and_then(|content| Err(Error::ResponseError(content)))
4760    }
4761}