Source file values.ml

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
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
(* generated by: awso-codegen generate-all --botocore-data vendor/botocore/botocore/data -o aws --runtime-dir lib/runtime/awso --cli-dir awso-cli *)
open Awso
open! Import
[@@@warning "-32"]
let service = Service.migrationhub_config
let apiVersion = "2019-06-30"
let endpointPrefix = "migrationhub-config"
let serviceFullName = "AWS Migration Hub Config"
let signatureVersion = "v4"
let protocol = "json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let targetPrefix = "AWSMigrationHubMultiAccountService"
let simple_to_json to_value x =
  Botodata.Json.value_to_json_scalar (to_value x)
let composed_to_json to_value x = Botodata.Json.value_to_json (to_value x)
let to_query to_value x = Client.Query.of_value (to_value x)
let structure_to_value_aux st ~f =
  let filter = function | (k, Some v) -> Some (k, v) | _ -> None in
  let pair k v = (k, v) in
  let defer_value (k, dv) = pair k dv in
  ((List.filter_map st ~f:filter) |> (List.map ~f:defer_value)) |>
    (fun x -> `Structure (f x))
let structure_to_value = structure_to_value_aux ~f:Fn.id
let structure_to_wrapped_value ~wrapper ~response =
  structure_to_value_aux
    ~f:(fun x -> [(wrapper, (`Structure x)); (response, (`Structure []))])
module TargetId =
  struct
    type nonrec t = string
    let context_ = "TargetId"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:12) >>=
             (fun () ->
                (check_string_max i ~max:12) >>=
                  (fun () -> check_pattern i ~pattern:"^\\d{12}$")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"TargetId" j
    let to_json = simple_to_json to_value
  end
module TargetType =
  struct
    type nonrec t =
      | ACCOUNT 
      | Non_static_id of string 
    let make i = i
    let to_string = function | ACCOUNT -> "ACCOUNT" | Non_static_id s -> s
    let of_string = function | "ACCOUNT" -> ACCOUNT | x -> Non_static_id x
    let to_value x = `Enum (to_string x)
    let to_query v = to_query to_value v
    let to_header x = to_string x
    let of_xml xml_arg0 =
      of_string (string_of_xml ~kind:"enumeration TargetType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"TargetType" j)
    let to_json = simple_to_json to_value
  end
module ControlId =
  struct
    type nonrec t = string
    let context_ = "ControlId"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:50) >>=
                  (fun () -> check_pattern i ~pattern:"^hrc-[a-z0-9]{12}$")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ControlId" j
    let to_json = simple_to_json to_value
  end
module HomeRegion =
  struct
    type nonrec t = string
    let context_ = "HomeRegion"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:50) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^([a-z]+)-([a-z]+)-([0-9]+)$")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"HomeRegion" j
    let to_json = simple_to_json to_value
  end
module RequestedTime =
  struct
    type nonrec t = string
    let make i = i
    let of_string x = x
    let to_value x = `Timestamp x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = string_of_xml ~kind:"a timestamp"
    let of_json = timestamp_of_json
    let to_json = simple_to_json to_value
  end
module Target =
  struct
    type nonrec t =
      {
      type_: TargetType.t
        [@ocaml.doc "The target type is always an ACCOUNT."];
      id: TargetId.t option
        [@ocaml.doc
          "The TargetID is a 12-character identifier of the ACCOUNT for which the control was created. (This must be the current account.)"]}
    let context_ = "Target"
    let make ?id = fun ~type_ -> fun () -> { id; type_ }
    let to_value x =
      structure_to_value
        [("Type", (Some (TargetType.to_value x.type_)));
        ("Id", (Option.map x.id ~f:TargetId.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let id = (Option.map ~f:TargetId.of_xml) (Xml.child xml_arg0 "Id") in
      let type_ =
        TargetType.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Type") in
      make ?id ~type_ ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let id = field_map json__ "Id" TargetId.of_json in
      let type_ = field_map_exn json__ "Type" TargetType.of_json in
      make ?id ~type_ ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The target parameter specifies the identifier to which the home region is applied, which is always an ACCOUNT. It applies the home region to the current ACCOUNT."]
module ErrorMessage =
  struct
    type nonrec t = string
    let context_ = "ErrorMessage"
    let make i = i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ErrorMessage" j
    let to_json = simple_to_json to_value
  end
module RetryAfterSeconds =
  struct
    type nonrec t = int
    let make i = i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for RetryAfterSeconds" xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module HomeRegionControl =
  struct
    type nonrec t =
      {
      controlId: ControlId.t option
        [@ocaml.doc
          "A unique identifier that's generated for each home region control. It's always a string that begins with \"hrc-\" followed by 12 lowercase letters and numbers."];
      homeRegion: HomeRegion.t option
        [@ocaml.doc
          "The AWS Region that's been set as home region. For example, \"us-west-2\" or \"eu-central-1\" are valid home regions."];
      target: Target.t option
        [@ocaml.doc
          "The target parameter specifies the identifier to which the home region is applied, which is always an ACCOUNT. It applies the home region to the current ACCOUNT."];
      requestedTime: RequestedTime.t option
        [@ocaml.doc
          "A timestamp representing the time when the customer called CreateHomeregionControl and set the home region for the account."]}
    let make ?controlId =
      fun ?homeRegion ->
        fun ?target ->
          fun ?requestedTime ->
            fun () -> { controlId; homeRegion; target; requestedTime }
    let to_value x =
      structure_to_value
        [("ControlId", (Option.map x.controlId ~f:ControlId.to_value));
        ("HomeRegion", (Option.map x.homeRegion ~f:HomeRegion.to_value));
        ("Target", (Option.map x.target ~f:Target.to_value));
        ("RequestedTime",
          (Option.map x.requestedTime ~f:RequestedTime.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let requestedTime =
        (Option.map ~f:RequestedTime.of_xml)
          (Xml.child xml_arg0 "RequestedTime") in
      let target =
        (Option.map ~f:Target.of_xml) (Xml.child xml_arg0 "Target") in
      let homeRegion =
        (Option.map ~f:HomeRegion.of_xml) (Xml.child xml_arg0 "HomeRegion") in
      let controlId =
        (Option.map ~f:ControlId.of_xml) (Xml.child xml_arg0 "ControlId") in
      make ?requestedTime ?target ?homeRegion ?controlId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let requestedTime =
        field_map json__ "RequestedTime" RequestedTime.of_json in
      let target = field_map json__ "Target" Target.of_json in
      let homeRegion = field_map json__ "HomeRegion" HomeRegion.of_json in
      let controlId = field_map json__ "ControlId" ControlId.of_json in
      make ?requestedTime ?target ?homeRegion ?controlId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A home region control is an object that specifies the home region for an account, with some additional information. It contains a target (always of type ACCOUNT), an ID, and a time at which the home region was set."]
module AccessDeniedException =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "You do not have sufficient access to perform this action."]
module InternalServerError =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Exception raised when an internal, configuration, or dependency error is encountered."]
module InvalidInputException =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Exception raised when the provided input violates a policy constraint or is entered in the wrong format or data type."]
module ServiceUnavailableException =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Exception raised when a request fails due to temporary unavailability of the service."]
module ThrottlingException =
  struct
    type nonrec t =
      {
      message: ErrorMessage.t option ;
      retryAfterSeconds: RetryAfterSeconds.t option
        [@ocaml.doc
          "The number of seconds the caller should wait before retrying."]}
    let make ?message =
      fun ?retryAfterSeconds -> fun () -> { message; retryAfterSeconds }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value));
        ("RetryAfterSeconds",
          (Option.map x.retryAfterSeconds ~f:RetryAfterSeconds.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let retryAfterSeconds =
        (Option.map ~f:RetryAfterSeconds.of_xml)
          (Xml.child xml_arg0 "RetryAfterSeconds") in
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?retryAfterSeconds ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let retryAfterSeconds =
        field_map json__ "RetryAfterSeconds" RetryAfterSeconds.of_json in
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?retryAfterSeconds ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to request throttling."]
module HomeRegionControls =
  struct
    type nonrec t = HomeRegionControl.t list
    let make i =
      let open Result in ok_or_failwith (check_list_max i ~max:100); i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:HomeRegionControl.to_value)) |> (fun x -> `List x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for List_shape objects" ()
    let of_xml x =
      make
        (List.map
           ((Xml.all_children x) |>
              (List.filter
                 ~f:(function
                     | `Data s ->
                         (match Stdlib.String.trim s with
                          | "" -> false
                          | _ -> true)
                     | _ -> true))) ~f:HomeRegionControl.of_xml)
    let of_json j =
      list_of_json ~kind:"HomeRegionControls"
        ~of_json:HomeRegionControl.of_json j
    let to_json v = composed_to_json to_value v
  end
module Token =
  struct
    type nonrec t = string
    let context_ = "Token"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:0) >>=
             (fun () ->
                (check_string_max i ~max:2048) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"^[a-zA-Z0-9\\/\\+\\=]{0,2048}$")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Token" j
    let to_json = simple_to_json to_value
  end
module DescribeHomeRegionControlsMaxResults =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:100) >>= (fun () -> check_int_min i ~min:1));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml
           ~kind:"an integer for DescribeHomeRegionControlsMaxResults"
           xml_arg0)
    let of_json j = Int.of_float (float_of_json ~kind:"an integer" j)
    let to_json = simple_to_json to_value
  end
module DryRunOperation =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Exception raised to indicate that authorization of an action was successful, when the DryRun flag is set to true."]
module DryRun =
  struct
    type nonrec t = bool
    let make i = i
    let of_string = Bool.of_string
    let to_value x = `Boolean x
    let to_query v = to_query to_value v
    let to_header x = Bool.to_string x
    let of_xml xml_arg0 =
      Bool.of_string (string_of_xml ~kind:"a boolean" xml_arg0)
    let of_json = bool_of_json
    let to_json = simple_to_json to_value
  end
module GetHomeRegionResult =
  struct
    type nonrec t =
      {
      homeRegion: HomeRegion.t option
        [@ocaml.doc "The name of the home region of the calling account."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerError of InternalServerError.t 
      | `InvalidInputException of InvalidInputException.t 
      | `ServiceUnavailableException of ServiceUnavailableException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?homeRegion = fun () -> { homeRegion }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_json json)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_json json)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_xml xml)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_xml xml)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerError e ->
          `Assoc
            [("error", (`String "InternalServerError"));
            ("details", (InternalServerError.to_json e))]
      | `InvalidInputException e ->
          `Assoc
            [("error", (`String "InvalidInputException"));
            ("details", (InvalidInputException.to_json e))]
      | `ServiceUnavailableException e ->
          `Assoc
            [("error", (`String "ServiceUnavailableException"));
            ("details", (ServiceUnavailableException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("HomeRegion", (Option.map x.homeRegion ~f:HomeRegion.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let homeRegion =
        (Option.map ~f:HomeRegion.of_xml) (Xml.child xml_arg0 "HomeRegion") in
      make ?homeRegion ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let homeRegion = field_map json__ "HomeRegion" HomeRegion.of_json in
      make ?homeRegion ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns the calling account\226\128\153s home region, if configured. This API is used by other AWS services to determine the regional endpoint for calling AWS Application Discovery Service and Migration Hub. You must call GetHomeRegion at least once before you call any other AWS Application Discovery Service and AWS Migration Hub APIs, to obtain the account's Migration Hub home region."]
module GetHomeRegionRequest =
  struct
    type nonrec t = unit
    let make () = ()
    let of_header_and_body = ((fun (xs, pipe) -> make ())[@warning "-27"])
    let to_value _ = `Structure []
    let to_query v = to_query to_value v
    let of_xml _ = make ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json _ = make ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns the calling account\226\128\153s home region, if configured. This API is used by other AWS services to determine the regional endpoint for calling AWS Application Discovery Service and Migration Hub. You must call GetHomeRegion at least once before you call any other AWS Application Discovery Service and AWS Migration Hub APIs, to obtain the account's Migration Hub home region."]
module DescribeHomeRegionControlsResult =
  struct
    type nonrec t =
      {
      homeRegionControls: HomeRegionControls.t option
        [@ocaml.doc "An array that contains your HomeRegionControl objects."];
      nextToken: Token.t option
        [@ocaml.doc
          "If a NextToken was returned by a previous call, more results are available. To retrieve the next page of results, make the call again using the returned token in NextToken."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerError of InternalServerError.t 
      | `InvalidInputException of InvalidInputException.t 
      | `ServiceUnavailableException of ServiceUnavailableException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?homeRegionControls =
      fun ?nextToken -> fun () -> { homeRegionControls; nextToken }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_json json)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_json json)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_xml xml)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_xml xml)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerError e ->
          `Assoc
            [("error", (`String "InternalServerError"));
            ("details", (InternalServerError.to_json e))]
      | `InvalidInputException e ->
          `Assoc
            [("error", (`String "InvalidInputException"));
            ("details", (InvalidInputException.to_json e))]
      | `ServiceUnavailableException e ->
          `Assoc
            [("error", (`String "ServiceUnavailableException"));
            ("details", (ServiceUnavailableException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("HomeRegionControls",
           (Option.map x.homeRegionControls ~f:HomeRegionControls.to_value));
        ("NextToken", (Option.map x.nextToken ~f:Token.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:Token.of_xml) (Xml.child xml_arg0 "NextToken") in
      let homeRegionControls =
        (Option.map ~f:HomeRegionControls.of_xml)
          (Xml.child xml_arg0 "HomeRegionControls") in
      make ?nextToken ?homeRegionControls ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" Token.of_json in
      let homeRegionControls =
        field_map json__ "HomeRegionControls" HomeRegionControls.of_json in
      make ?nextToken ?homeRegionControls ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This API permits filtering on the ControlId and HomeRegion fields."]
module DescribeHomeRegionControlsRequest =
  struct
    type nonrec t =
      {
      controlId: ControlId.t option
        [@ocaml.doc
          "The ControlID is a unique identifier string of your HomeRegionControl object."];
      homeRegion: HomeRegion.t option
        [@ocaml.doc "The name of the home region you'd like to view."];
      target: Target.t option
        [@ocaml.doc
          "The target parameter specifies the identifier to which the home region is applied, which is always of type ACCOUNT. It applies the home region to the current ACCOUNT."];
      maxResults: DescribeHomeRegionControlsMaxResults.t option
        [@ocaml.doc
          "The maximum number of filtering results to display per page."];
      nextToken: Token.t option
        [@ocaml.doc
          "If a NextToken was returned by a previous call, more results are available. To retrieve the next page of results, make the call again using the returned token in NextToken."]}
    let make ?controlId =
      fun ?homeRegion ->
        fun ?target ->
          fun ?maxResults ->
            fun ?nextToken ->
              fun () ->
                { controlId; homeRegion; target; maxResults; nextToken }
    let to_value x =
      structure_to_value
        [("ControlId", (Option.map x.controlId ~f:ControlId.to_value));
        ("HomeRegion", (Option.map x.homeRegion ~f:HomeRegion.to_value));
        ("Target", (Option.map x.target ~f:Target.to_value));
        ("MaxResults",
          (Option.map x.maxResults
             ~f:DescribeHomeRegionControlsMaxResults.to_value));
        ("NextToken", (Option.map x.nextToken ~f:Token.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:Token.of_xml) (Xml.child xml_arg0 "NextToken") in
      let maxResults =
        (Option.map ~f:DescribeHomeRegionControlsMaxResults.of_xml)
          (Xml.child xml_arg0 "MaxResults") in
      let target =
        (Option.map ~f:Target.of_xml) (Xml.child xml_arg0 "Target") in
      let homeRegion =
        (Option.map ~f:HomeRegion.of_xml) (Xml.child xml_arg0 "HomeRegion") in
      let controlId =
        (Option.map ~f:ControlId.of_xml) (Xml.child xml_arg0 "ControlId") in
      make ?nextToken ?maxResults ?target ?homeRegion ?controlId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" Token.of_json in
      let maxResults =
        field_map json__ "MaxResults"
          DescribeHomeRegionControlsMaxResults.of_json in
      let target = field_map json__ "Target" Target.of_json in
      let homeRegion = field_map json__ "HomeRegion" HomeRegion.of_json in
      let controlId = field_map json__ "ControlId" ControlId.of_json in
      make ?nextToken ?maxResults ?target ?homeRegion ?controlId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This API permits filtering on the ControlId and HomeRegion fields."]
module DeleteHomeRegionControlResult =
  struct
    type nonrec t = unit
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerError of InternalServerError.t 
      | `InvalidInputException of InvalidInputException.t 
      | `ServiceUnavailableException of ServiceUnavailableException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make () = ()
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_json json)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_json json)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_xml xml)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_xml xml)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerError e ->
          `Assoc
            [("error", (`String "InternalServerError"));
            ("details", (InternalServerError.to_json e))]
      | `InvalidInputException e ->
          `Assoc
            [("error", (`String "InvalidInputException"));
            ("details", (InvalidInputException.to_json e))]
      | `ServiceUnavailableException e ->
          `Assoc
            [("error", (`String "ServiceUnavailableException"));
            ("details", (ServiceUnavailableException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let of_header_and_body = ((fun (xs, pipe) -> make ())[@warning "-27"])
    let to_value _ = `Structure []
    let to_query v = to_query to_value v
    let of_xml _ = make ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json _ = make ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This operation deletes the home region configuration for the calling account. The operation does not delete discovery or migration tracking data in the home region."]
module DeleteHomeRegionControlRequest =
  struct
    type nonrec t =
      {
      controlId: ControlId.t
        [@ocaml.doc
          "A unique identifier that's generated for each home region control. It's always a string that begins with \"hrc-\" followed by 12 lowercase letters and numbers."]}
    let context_ = "DeleteHomeRegionControlRequest"
    let make ~controlId = fun () -> { controlId }
    let to_value x =
      structure_to_value
        [("ControlId", (Some (ControlId.to_value x.controlId)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let controlId =
        ControlId.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ControlId") in
      make ~controlId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let controlId = field_map_exn json__ "ControlId" ControlId.of_json in
      make ~controlId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This operation deletes the home region configuration for the calling account. The operation does not delete discovery or migration tracking data in the home region."]
module CreateHomeRegionControlResult =
  struct
    type nonrec t =
      {
      homeRegionControl: HomeRegionControl.t option
        [@ocaml.doc
          "This object is the HomeRegionControl object that's returned by a successful call to CreateHomeRegionControl."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `DryRunOperation of DryRunOperation.t 
      | `InternalServerError of InternalServerError.t 
      | `InvalidInputException of InvalidInputException.t 
      | `ServiceUnavailableException of ServiceUnavailableException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?homeRegionControl = fun () -> { homeRegionControl }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "DryRunOperation" -> `DryRunOperation (DryRunOperation.of_json json)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_json json)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_json json)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "DryRunOperation" -> `DryRunOperation (DryRunOperation.of_xml xml)
      | "InternalServerError" ->
          `InternalServerError (InternalServerError.of_xml xml)
      | "InvalidInputException" ->
          `InvalidInputException (InvalidInputException.of_xml xml)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `DryRunOperation e ->
          `Assoc
            [("error", (`String "DryRunOperation"));
            ("details", (DryRunOperation.to_json e))]
      | `InternalServerError e ->
          `Assoc
            [("error", (`String "InternalServerError"));
            ("details", (InternalServerError.to_json e))]
      | `InvalidInputException e ->
          `Assoc
            [("error", (`String "InvalidInputException"));
            ("details", (InvalidInputException.to_json e))]
      | `ServiceUnavailableException e ->
          `Assoc
            [("error", (`String "ServiceUnavailableException"));
            ("details", (ServiceUnavailableException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("HomeRegionControl",
           (Option.map x.homeRegionControl ~f:HomeRegionControl.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let homeRegionControl =
        (Option.map ~f:HomeRegionControl.of_xml)
          (Xml.child xml_arg0 "HomeRegionControl") in
      make ?homeRegionControl ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let homeRegionControl =
        field_map json__ "HomeRegionControl" HomeRegionControl.of_json in
      make ?homeRegionControl ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This API sets up the home region for the calling account only."]
module CreateHomeRegionControlRequest =
  struct
    type nonrec t =
      {
      homeRegion: HomeRegion.t
        [@ocaml.doc "The name of the home region of the calling account."];
      target: Target.t
        [@ocaml.doc
          "The account for which this command sets up a home region control. The Target is always of type ACCOUNT."];
      dryRun: DryRun.t option
        [@ocaml.doc
          "Optional Boolean flag to indicate whether any effect should take place. It tests whether the caller has permission to make the call."]}
    let context_ = "CreateHomeRegionControlRequest"
    let make ?dryRun =
      fun ~homeRegion ->
        fun ~target -> fun () -> { dryRun; homeRegion; target }
    let to_value x =
      structure_to_value
        [("HomeRegion", (Some (HomeRegion.to_value x.homeRegion)));
        ("Target", (Some (Target.to_value x.target)));
        ("DryRun", (Option.map x.dryRun ~f:DryRun.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dryRun =
        (Option.map ~f:DryRun.of_xml) (Xml.child xml_arg0 "DryRun") in
      let target =
        Target.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Target") in
      let homeRegion =
        HomeRegion.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "HomeRegion") in
      make ?dryRun ~target ~homeRegion ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dryRun = field_map json__ "DryRun" DryRun.of_json in
      let target = field_map_exn json__ "Target" Target.of_json in
      let homeRegion = field_map_exn json__ "HomeRegion" HomeRegion.of_json in
      make ?dryRun ~target ~homeRegion ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This API sets up the home region for the calling account only."]