antimatter_api 2.0.13

Interact with the Antimatter Cloud API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
/*
 * Antimatter Public API
 *
 * Interact with the Antimatter Cloud API
 *
 * The version of the OpenAPI document: 2.0.13
 * Contact: support@antimatter.io
 * Generated by: https://openapi-generator.tech
 */


use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};


/// struct for typed errors of method [`domain_authenticate`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainAuthenticateError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_contact_issue_verify`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainContactIssueVerifyError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_contact_verify`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainContactVerifyError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_delete_capability`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainDeleteCapabilityError {
    Status404(models::ResourceNotFoundError),
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_delete_identity_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainDeleteIdentityProviderError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_delete_identity_provider_principal`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainDeleteIdentityProviderPrincipalError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_capabilities`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetCapabilitiesError {
    Status404(models::ResourceNotFoundError),
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_capability`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetCapabilityError {
    Status404(models::ResourceNotFoundError),
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_identity_group_providers`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetIdentityGroupProvidersError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_identity_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetIdentityProviderError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_identity_provider_principal`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetIdentityProviderPrincipalError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_get_identity_provider_principals`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainGetIdentityProviderPrincipalsError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_insert_identity_provider_principal`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainInsertIdentityProviderPrincipalError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_list_identity_providers`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainListIdentityProvidersError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_put_capability`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainPutCapabilityError {
    Status404(models::ResourceNotFoundError),
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_put_vendor_settings`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainPutVendorSettingsError {
    Status404(models::ResourceNotFoundError),
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_update_identity_provider_principal`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainUpdateIdentityProviderPrincipalError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`domain_upsert_identity_provider`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DomainUpsertIdentityProviderError {
    Status400(models::InvalidRequestError),
    Status401(models::UnauthorizedError),
    Status404(models::ResourceNotFoundError),
    Status409(models::ConflictError),
    Status412(models::PreconditionFailedError),
    Status429(models::ResourceExhaustedError),
    DefaultResponse(models::Error),
    UnknownValue(serde_json::Value),
}


/// Use an authentication method to obtain a domain ID token which is used as the bearer for all other endpoints. You can use the `/public-info` route to obtain a list of identity providers supported by this endpoint. 
pub async fn domain_authenticate(configuration: &configuration::Configuration, domain_id: &str, domain_authenticate: models::DomainAuthenticate, identity_provider_name: Option<&str>, token_exchange: Option<bool>, token_lifetime: Option<i32>) -> Result<models::DomainAuthenticateResponse, Error<DomainAuthenticateError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/authenticate", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = identity_provider_name {
        local_var_req_builder = local_var_req_builder.query(&[("identityProviderName", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = token_exchange {
        local_var_req_builder = local_var_req_builder.query(&[("tokenExchange", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = token_lifetime {
        local_var_req_builder = local_var_req_builder.query(&[("tokenLifetime", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&domain_authenticate);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainAuthenticateError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Issue a new verification request to a pending contact email associated with the domain. There is a rate limiter on this endpoint, you may need to wait between invocations. 
pub async fn domain_contact_issue_verify(configuration: &configuration::Configuration, domain_id: &str, domain_contact_issue_verify_request: models::DomainContactIssueVerifyRequest) -> Result<(), Error<DomainContactIssueVerifyError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/account/verify", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&domain_contact_issue_verify_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainContactIssueVerifyError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Verify an admin contact email recently associated with a domain. The token will have been emailed (in the form of a link) to the email address when `/account/verify` is called, the domain was initially created, or the email was added via the settings endpoint. 
pub async fn domain_contact_verify(configuration: &configuration::Configuration, domain_id: &str, address: &str, token: Option<&str>, google_jwt: Option<&str>) -> Result<models::VerifyContactResponse, Error<DomainContactVerifyError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/account/verify", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = token {
        local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_str) = google_jwt {
        local_var_req_builder = local_var_req_builder.query(&[("googleJWT", &local_var_str.to_string())]);
    }
    local_var_req_builder = local_var_req_builder.query(&[("address", &address.to_string())]);
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainContactVerifyError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Delete a capability. All rules that reference the capability must have already been deleted, or you will get an error 
pub async fn domain_delete_capability(configuration: &configuration::Configuration, domain_id: &str, capability: &str) -> Result<(), Error<DomainDeleteCapabilityError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/capabilities/{capability}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), capability=crate::apis::urlencode(capability));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainDeleteCapabilityError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Delete an identity provider. All domain tokens created using this identity provider will be invalidated. Take care not to remove the identity provider that is providing you admin access to your domain, as you may \"lock yourself out\". 
pub async fn domain_delete_identity_provider(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str) -> Result<(), Error<DomainDeleteIdentityProviderError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainDeleteIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Delete an identity provider principal. 
pub async fn domain_delete_identity_provider_principal(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str, principal_id: &str) -> Result<(), Error<DomainDeleteIdentityProviderPrincipalError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}/principals/{principalID}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name), principalID=crate::apis::urlencode(principal_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainDeleteIdentityProviderPrincipalError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Get the capabilities configured within the domain. A capability is a key/value pair that can be attached to a principal by an identity provider. The capabilities can be referenced by the domain policy rules. 
pub async fn domain_get_capabilities(configuration: &configuration::Configuration, domain_id: &str) -> Result<models::CapabilityDefinitionList, Error<DomainGetCapabilitiesError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/capabilities", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetCapabilitiesError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Get a capability. A capability is a key/value pair that can be  attached to a domain identity by an identity provider. The capabilities can be referenced by the domain policy rules. 
pub async fn domain_get_capability(configuration: &configuration::Configuration, domain_id: &str, capability: &str) -> Result<models::CapabilityDefinition, Error<DomainGetCapabilityError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/capabilities/{capability}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), capability=crate::apis::urlencode(capability));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetCapabilityError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Retrieve details on what information is required in order to allow for mapping external domain group membership to capabilities at authentication. 
pub async fn domain_get_identity_group_providers(configuration: &configuration::Configuration, domain_id: &str) -> Result<models::DomainIdentityGroupProviderDetails, Error<DomainGetIdentityGroupProvidersError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/group-providers", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetIdentityGroupProvidersError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Retrieve detailed information and configuration of an identity provider. 
pub async fn domain_get_identity_provider(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str) -> Result<models::DomainIdentityProviderInfo, Error<DomainGetIdentityProviderError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Retrieve detailed information about an identity provider principal. 
pub async fn domain_get_identity_provider_principal(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str, principal_id: &str) -> Result<models::PrincipalInfo, Error<DomainGetIdentityProviderPrincipalError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}/principals/{principalID}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name), principalID=crate::apis::urlencode(principal_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetIdentityProviderPrincipalError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Retrieve a list of principals for an identity provider 
pub async fn domain_get_identity_provider_principals(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str) -> Result<models::DomainIdentityProviderPrincipalList, Error<DomainGetIdentityProviderPrincipalsError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}/principals", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainGetIdentityProviderPrincipalsError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Create a new principal for the provider. Note that the identityProviderName must refer to an existing identity provider or the response will be a 400. 
pub async fn domain_insert_identity_provider_principal(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str, domain_identity_provider_principal_params: models::DomainIdentityProviderPrincipalParams) -> Result<models::DomainInsertIdentityProviderPrincipal200Response, Error<DomainInsertIdentityProviderPrincipalError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}/principals", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    local_var_req_builder = local_var_req_builder.json(&domain_identity_provider_principal_params);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainInsertIdentityProviderPrincipalError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Retrieve the domain's identity providers and a brief overview of their configuration. This endpoint requires authentication, but you can obtain an abridged list of the domain identity providers prior to authentication using the `/public-info` endpoint. 
pub async fn domain_list_identity_providers(configuration: &configuration::Configuration, domain_id: &str) -> Result<models::DomainIdentityProviderList, Error<DomainListIdentityProvidersError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainListIdentityProvidersError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Create or update a capability. If you want to return an error if the capability already existed, set createonly=true 
pub async fn domain_put_capability(configuration: &configuration::Configuration, domain_id: &str, capability: &str, new_capability_definition: models::NewCapabilityDefinition, createonly: Option<bool>) -> Result<(), Error<DomainPutCapabilityError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/capabilities/{capability}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), capability=crate::apis::urlencode(capability));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());

    if let Some(ref local_var_str) = createonly {
        local_var_req_builder = local_var_req_builder.query(&[("createonly", &local_var_str.to_string())]);
    }
    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    local_var_req_builder = local_var_req_builder.json(&new_capability_definition);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainPutCapabilityError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Create or update the vendor settings for a given domain. 
pub async fn domain_put_vendor_settings(configuration: &configuration::Configuration, domain_id: &str, new_vendor_settings: models::NewVendorSettings) -> Result<(), Error<DomainPutVendorSettingsError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/vendor/settings", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    local_var_req_builder = local_var_req_builder.json(&new_vendor_settings);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainPutVendorSettingsError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Update the set of capabilities assigned to an identity provider principal. The capabilities must exist. 
pub async fn domain_update_identity_provider_principal(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str, principal_id: &str, update_principal_params: models::UpdatePrincipalParams) -> Result<(), Error<DomainUpdateIdentityProviderPrincipalError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}/principals/{principalID}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name), principalID=crate::apis::urlencode(principal_id));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    local_var_req_builder = local_var_req_builder.json(&update_principal_params);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        Ok(())
    } else {
        let local_var_entity: Option<DomainUpdateIdentityProviderPrincipalError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}

/// Create or configure an identity provider. 
pub async fn domain_upsert_identity_provider(configuration: &configuration::Configuration, domain_id: &str, identity_provider_name: &str, domain_identity_provider_details: models::DomainIdentityProviderDetails) -> Result<models::DomainIdentityProviderInfo, Error<DomainUpsertIdentityProviderError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/domains/{domainID}/control/identities/{identityProviderName}", local_var_configuration.base_path, domainID=crate::apis::urlencode(domain_id), identityProviderName=crate::apis::urlencode(identity_provider_name));
    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
    };
    local_var_req_builder = local_var_req_builder.json(&domain_identity_provider_details);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<DomainUpsertIdentityProviderError> = serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
        Err(Error::ResponseError(local_var_error))
    }
}