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
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
(* 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.meteringmarketplace
let apiVersion = "2016-01-14"
let endpointPrefix = "metering.marketplace"
let serviceFullName = "AWSMarketplace Metering"
let signatureVersion = "v4"
let protocol = "json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let targetPrefix = "AWSMPMeteringService"
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 TagKey =
  struct
    type nonrec t = string
    let context_ = "TagKey"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:100) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-zA-Z0-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:"TagKey" j
    let to_json = simple_to_json to_value
  end
module TagValue =
  struct
    type nonrec t = string
    let context_ = "TagValue"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:256) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-zA-Z0-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:"TagValue" j
    let to_json = simple_to_json to_value
  end
module Tag =
  struct
    type nonrec t =
      {
      key: TagKey.t
        [@ocaml.doc
          "One part of a key-value pair that makes up a tag. A key is a label that acts like a category for the specific tag values."];
      value: TagValue.t
        [@ocaml.doc
          "One part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null."]}
    let context_ = "Tag"
    let make ~key = fun ~value -> fun () -> { key; value }
    let to_value x =
      structure_to_value
        [("Key", (Some (TagKey.to_value x.key)));
        ("Value", (Some (TagValue.to_value x.value)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let value =
        TagValue.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Value") in
      let key =
        TagKey.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Key") in
      make ~value ~key ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let value = field_map_exn json__ "Value" TagValue.of_json in
      let key = field_map_exn json__ "Key" TagKey.of_json in
      make ~value ~key ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Metadata assigned to an allocation. Each tag is made up of a key and a value."]
module AllocatedUsageQuantity =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:2147483647) >>=
             (fun () -> check_int_min i ~min:0));
        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 AllocatedUsageQuantity" 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 TagList =
  struct
    type nonrec t = Tag.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:5) >>= (fun () -> check_list_min i ~min:1));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:Tag.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:Tag.of_xml)
    let of_json j = list_of_json ~kind:"TagList" ~of_json:Tag.of_json j
    let to_json v = composed_to_json to_value v
  end
module UsageAllocation =
  struct
    type nonrec t =
      {
      allocatedUsageQuantity: AllocatedUsageQuantity.t
        [@ocaml.doc "The total quantity allocated to this bucket of usage."];
      tags: TagList.t option
        [@ocaml.doc
          "The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out."]}
    let context_ = "UsageAllocation"
    let make ?tags =
      fun ~allocatedUsageQuantity ->
        fun () -> { tags; allocatedUsageQuantity }
    let to_value x =
      structure_to_value
        [("AllocatedUsageQuantity",
           (Some (AllocatedUsageQuantity.to_value x.allocatedUsageQuantity)));
        ("Tags", (Option.map x.tags ~f:TagList.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let tags = (Option.map ~f:TagList.of_xml) (Xml.child xml_arg0 "Tags") in
      let allocatedUsageQuantity =
        AllocatedUsageQuantity.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "AllocatedUsageQuantity") in
      make ?tags ~allocatedUsageQuantity ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let tags = field_map json__ "Tags" TagList.of_json in
      let allocatedUsageQuantity =
        field_map_exn json__ "AllocatedUsageQuantity"
          AllocatedUsageQuantity.of_json in
      make ?tags ~allocatedUsageQuantity ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Usage allocations allow you to split usage into buckets by tags. Each UsageAllocation indicates the usage quantity for a specific set of tags."]
module CustomerAWSAccountId =
  struct
    type nonrec t = string
    let context_ = "CustomerAWSAccountId"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:255) >>=
                  (fun () -> check_pattern i ~pattern:"^[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:"CustomerAWSAccountId" j
    let to_json = simple_to_json to_value
  end
module CustomerIdentifier =
  struct
    type nonrec t = string
    let context_ = "CustomerIdentifier"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:0) >>=
             (fun () ->
                (check_string_max i ~max:255) >>=
                  (fun () -> check_pattern i ~pattern:"[\\s\\S]*")));
        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:"CustomerIdentifier" j
    let to_json = simple_to_json to_value
  end
module LicenseArn =
  struct
    type nonrec t = string
    let context_ = "LicenseArn"
    let make i =
      let open Result in
        ok_or_failwith
          (check_pattern i
             ~pattern:"^arn:aws[a-zA-Z-]*:[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:[A-Za-z0-9_/.-]{0,63}:[A-Za-z0-9_/.-]{0,63}:[A-Za-z0-9][A-Za-z0-9:_/+=,@.-]{0,1023}$");
        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:"LicenseArn" j
    let to_json = simple_to_json to_value
  end
module Timestamp =
  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 UsageAllocations =
  struct
    type nonrec t = UsageAllocation.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:2500) >>=
             (fun () -> check_list_min i ~min:1));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:UsageAllocation.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:UsageAllocation.of_xml)
    let of_json j =
      list_of_json ~kind:"UsageAllocations" ~of_json:UsageAllocation.of_json
        j
    let to_json v = composed_to_json to_value v
  end
module UsageDimension =
  struct
    type nonrec t = string
    let context_ = "UsageDimension"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:255) >>=
                  (fun () -> check_pattern i ~pattern:"[\\s\\S]+")));
        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:"UsageDimension" j
    let to_json = simple_to_json to_value
  end
module UsageQuantity =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:2147483647) >>=
             (fun () -> check_int_min i ~min:0));
        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 UsageQuantity" 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 String_ =
  struct
    type nonrec t = string
    let context_ = "String"
    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:"String" j
    let to_json = simple_to_json to_value
  end
module UsageRecord =
  struct
    type nonrec t =
      {
      timestamp: Timestamp.t
        [@ocaml.doc
          "Timestamp, in UTC, for which the usage is being reported. Your application can meter usage for up to six hours in the past. Make sure the timestamp value is not before the start of the software usage."];
      customerIdentifier: CustomerIdentifier.t option
        [@ocaml.doc
          "The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application."];
      dimension: UsageDimension.t
        [@ocaml.doc
          "During the process of registering a product on Amazon Web Services Marketplace, dimensions are specified. These represent different units of value in your application."];
      quantity: UsageQuantity.t option
        [@ocaml.doc
          "The quantity of usage consumed by the customer for the given dimension and time. Defaults to 0 if not specified."];
      usageAllocations: UsageAllocations.t option
        [@ocaml.doc
          "The set of UsageAllocations to submit. The sum of all UsageAllocation quantities must equal the Quantity of the UsageRecord."];
      customerAWSAccountId: CustomerAWSAccountId.t option
        [@ocaml.doc
          "The CustomerAWSAccountId parameter specifies the AWS account ID of the buyer. For existing integrations, to access your CustomerIdentifier to CustomerAWSAccountId mapping, see Account Feeds."];
      licenseArn: LicenseArn.t option
        [@ocaml.doc
          "The LicenseArn is a unique identifier for a specific granted license. These are used for software purchased through Amazon Web Services Marketplace. To access your CustomerAWSAccountId and LicenseArn mapping, visit Agreements Feeds."]}
    let context_ = "UsageRecord"
    let make ?customerIdentifier =
      fun ?quantity ->
        fun ?usageAllocations ->
          fun ?customerAWSAccountId ->
            fun ?licenseArn ->
              fun ~timestamp ->
                fun ~dimension ->
                  fun () ->
                    {
                      customerIdentifier;
                      quantity;
                      usageAllocations;
                      customerAWSAccountId;
                      licenseArn;
                      timestamp;
                      dimension
                    }
    let to_value x =
      structure_to_value
        [("Timestamp", (Some (Timestamp.to_value x.timestamp)));
        ("CustomerIdentifier",
          (Option.map x.customerIdentifier ~f:CustomerIdentifier.to_value));
        ("Dimension", (Some (UsageDimension.to_value x.dimension)));
        ("Quantity", (Option.map x.quantity ~f:UsageQuantity.to_value));
        ("UsageAllocations",
          (Option.map x.usageAllocations ~f:UsageAllocations.to_value));
        ("CustomerAWSAccountId",
          (Option.map x.customerAWSAccountId ~f:CustomerAWSAccountId.to_value));
        ("LicenseArn", (Option.map x.licenseArn ~f:LicenseArn.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let licenseArn =
        (Option.map ~f:LicenseArn.of_xml) (Xml.child xml_arg0 "LicenseArn") in
      let customerAWSAccountId =
        (Option.map ~f:CustomerAWSAccountId.of_xml)
          (Xml.child xml_arg0 "CustomerAWSAccountId") in
      let usageAllocations =
        (Option.map ~f:UsageAllocations.of_xml)
          (Xml.child xml_arg0 "UsageAllocations") in
      let quantity =
        (Option.map ~f:UsageQuantity.of_xml) (Xml.child xml_arg0 "Quantity") in
      let dimension =
        UsageDimension.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Dimension") in
      let customerIdentifier =
        (Option.map ~f:CustomerIdentifier.of_xml)
          (Xml.child xml_arg0 "CustomerIdentifier") in
      let timestamp =
        Timestamp.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Timestamp") in
      make ?licenseArn ?customerAWSAccountId ?usageAllocations ?quantity
        ~dimension ?customerIdentifier ~timestamp ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let licenseArn = field_map json__ "LicenseArn" LicenseArn.of_json in
      let customerAWSAccountId =
        field_map json__ "CustomerAWSAccountId" CustomerAWSAccountId.of_json in
      let usageAllocations =
        field_map json__ "UsageAllocations" UsageAllocations.of_json in
      let quantity = field_map json__ "Quantity" UsageQuantity.of_json in
      let dimension = field_map_exn json__ "Dimension" UsageDimension.of_json in
      let customerIdentifier =
        field_map json__ "CustomerIdentifier" CustomerIdentifier.of_json in
      let timestamp = field_map_exn json__ "Timestamp" Timestamp.of_json in
      make ?licenseArn ?customerAWSAccountId ?usageAllocations ?quantity
        ~dimension ?customerIdentifier ~timestamp ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A UsageRecord indicates a quantity of usage for a given product, customer, dimension and time. Multiple requests with the same UsageRecords as input will be de-duplicated to prevent double charges."]
module UsageRecordResultStatus =
  struct
    type nonrec t =
      | Success 
      | CustomerNotSubscribed 
      | DuplicateRecord 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Success -> "Success"
      | CustomerNotSubscribed -> "CustomerNotSubscribed"
      | DuplicateRecord -> "DuplicateRecord"
      | Non_static_id s -> s
    let of_string =
      function
      | "Success" -> Success
      | "CustomerNotSubscribed" -> CustomerNotSubscribed
      | "DuplicateRecord" -> DuplicateRecord
      | 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 UsageRecordResultStatus" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"UsageRecordResultStatus" j)
    let to_json = simple_to_json to_value
  end
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 UsageRecordResult =
  struct
    type nonrec t =
      {
      usageRecord: UsageRecord.t option
        [@ocaml.doc
          "The UsageRecord that was part of the BatchMeterUsage request."];
      meteringRecordId: String_.t option
        [@ocaml.doc
          "The MeteringRecordId is a unique identifier for this metering event."];
      status: UsageRecordResultStatus.t option
        [@ocaml.doc
          "The UsageRecordResult Status indicates the status of an individual UsageRecord processed by BatchMeterUsage. Success- The UsageRecord was accepted and honored by BatchMeterUsage. CustomerNotSubscribed- The CustomerIdentifier specified is not able to use your product. The UsageRecord was not honored. There are three causes for this result: The customer identifier is invalid. The customer identifier provided in the metering record does not have an active agreement or subscription with this product. Future UsageRecords for this customer will fail until the customer subscribes to your product. The customer's Amazon Web Services account was suspended. DuplicateRecord- Indicates that the UsageRecord was invalid and not honored. A previously metered UsageRecord had the same customer, dimension, and time, but a different quantity."]}
    let make ?usageRecord =
      fun ?meteringRecordId ->
        fun ?status -> fun () -> { usageRecord; meteringRecordId; status }
    let to_value x =
      structure_to_value
        [("UsageRecord", (Option.map x.usageRecord ~f:UsageRecord.to_value));
        ("MeteringRecordId",
          (Option.map x.meteringRecordId ~f:String_.to_value));
        ("Status", (Option.map x.status ~f:UsageRecordResultStatus.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let status =
        (Option.map ~f:UsageRecordResultStatus.of_xml)
          (Xml.child xml_arg0 "Status") in
      let meteringRecordId =
        (Option.map ~f:String_.of_xml)
          (Xml.child xml_arg0 "MeteringRecordId") in
      let usageRecord =
        (Option.map ~f:UsageRecord.of_xml) (Xml.child xml_arg0 "UsageRecord") in
      make ?status ?meteringRecordId ?usageRecord ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let status = field_map json__ "Status" UsageRecordResultStatus.of_json in
      let meteringRecordId =
        field_map json__ "MeteringRecordId" String_.of_json in
      let usageRecord = field_map json__ "UsageRecord" UsageRecord.of_json in
      make ?status ?meteringRecordId ?usageRecord ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A UsageRecordResult indicates the status of a given UsageRecord processed by BatchMeterUsage."]
module DisabledApiException =
  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 "The API is disabled in the Region."]
module ExpiredTokenException =
  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
       "The submitted registration token has expired. This can happen if the buyer's browser takes too long to redirect to your page, the buyer has resubmitted the registration token, or your application has held on to the registration token for too long. Your SaaS registration website should redeem this token as soon as it is submitted by the buyer's browser."]
module InternalServiceErrorException =
  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
       "An internal error has occurred. Retry your request. If the problem persists, post a message with details on the Amazon Web Services forums."]
module InvalidTokenException =
  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 "Registration token is invalid."]
module ProductCode =
  struct
    type nonrec t = string
    let context_ = "ProductCode"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:0) >>=
             (fun () ->
                (check_string_max i ~max:255) >>=
                  (fun () -> check_pattern i ~pattern:"^[-a-zA-Z0-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:"ProductCode" j
    let to_json = simple_to_json to_value
  end
module ThrottlingException =
  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 "The calls to the API are throttled."]
module NonEmptyString =
  struct
    type nonrec t = string
    let context_ = "NonEmptyString"
    let make i =
      let open Result in
        ok_or_failwith (check_pattern i ~pattern:"[\\s\\S]+"); 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:"NonEmptyString" j
    let to_json = simple_to_json to_value
  end
module CustomerNotEntitledException =
  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 thrown when the customer does not have a valid subscription for the product."]
module InvalidProductCodeException =
  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
       "The product code passed does not match the product code used for publishing the product."]
module InvalidPublicKeyVersionException =
  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 "Public Key version is invalid."]
module InvalidRegionException =
  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
       "RegisterUsage must be called in the same Amazon Web Services Region the ECS task was launched in. This prevents a container from hardcoding a Region (e.g. withRegion(\226\128\156us-east-1\226\128\157) when calling RegisterUsage."]
module PlatformNotSupportedException =
  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
       "Amazon Web Services Marketplace does not support metering usage from the underlying platform. Currently, Amazon ECS, Amazon EKS, and Fargate are supported."]
module Nonce =
  struct
    type nonrec t = string
    let context_ = "Nonce"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:255) >>=
             (fun () -> check_pattern i ~pattern:"[\\s\\S]*"));
        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:"Nonce" j
    let to_json = simple_to_json to_value
  end
module VersionInteger =
  struct
    type nonrec t = int
    let make i =
      let open Result in ok_or_failwith (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 VersionInteger" 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 DuplicateRequestException =
  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
       "A metering record has already been emitted by the same EC2 instance, ECS task, or EKS pod for the given \\{usageDimension, timestamp\\} with a different usageQuantity."]
module IdempotencyConflictException =
  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 "The ClientToken is being used for multiple requests."]
module InvalidEndpointRegionException =
  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
       "The endpoint being called is in a Amazon Web Services Region different from your EC2 instance, ECS task, or EKS pod. The Region of the Metering Service endpoint and the Amazon Web Services Region of the resource must match."]
module InvalidTagException =
  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
       "The tag is invalid, or the number of tags is greater than 5."]
module InvalidUsageAllocationsException =
  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
       "Sum of allocated usage quantities is not equal to the usage quantity."]
module InvalidUsageDimensionException =
  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
       "The usage dimension does not match one of the UsageDimensions associated with products."]
module TimestampOutOfBoundsException =
  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
       "The timestamp value passed in the UsageRecord is out of allowed range. For BatchMeterUsage, if any of the records are outside of the allowed range, the entire batch is not processed. You must remove invalid records and try again."]
module Boolean =
  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 ClientToken =
  struct
    type nonrec t = string
    let context_ = "ClientToken"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:64) >>=
             (fun () -> check_string_min i ~min:1));
        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:"ClientToken" j
    let to_json = simple_to_json to_value
  end
module InvalidCustomerIdentifierException =
  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 have metered usage for a CustomerIdentifier that does not exist."]
module InvalidLicenseException =
  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
       "Ensure the LicenseArn is valid, matches the customer, and usage is within the license activation period."]
module UsageRecordList =
  struct
    type nonrec t = UsageRecord.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:25) >>= (fun () -> check_list_min i ~min:0));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:UsageRecord.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:UsageRecord.of_xml)
    let of_json j =
      list_of_json ~kind:"UsageRecordList" ~of_json:UsageRecord.of_json j
    let to_json v = composed_to_json to_value v
  end
module UsageRecordResultList =
  struct
    type nonrec t = UsageRecordResult.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:UsageRecordResult.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:UsageRecordResult.of_xml)
    let of_json j =
      list_of_json ~kind:"UsageRecordResultList"
        ~of_json:UsageRecordResult.of_json j
    let to_json v = composed_to_json to_value v
  end
module ResolveCustomerResult =
  struct
    type nonrec t =
      {
      customerIdentifier: CustomerIdentifier.t option
        [@ocaml.doc
          "The CustomerIdentifier is used to identify an individual customer in your application."];
      productCode: ProductCode.t option
        [@ocaml.doc
          "The product code is returned to confirm that the buyer is registering for your product. Subsequent BatchMeterUsage calls should be made using this product code."];
      customerAWSAccountId: CustomerAWSAccountId.t option
        [@ocaml.doc
          "The CustomerAWSAccountId provides the Amazon Web Services account ID associated with the CustomerIdentifier for the individual customer. Calls to BatchMeterUsage require CustomerAWSAccountId for each UsageRecord."];
      licenseArn: LicenseArn.t option
        [@ocaml.doc
          "The LicenseArn is a unique identifier for a specific granted license. These are typically used for software purchased through Amazon Web Services Marketplace. Calls to BatchMeterUsage require LicenseArn for each UsageRecord. Once you receive the CustomerAWSAccountId and LicenseArn in the response, store that for future purposes/API calls/integrations."]}
    type nonrec error =
      [ `DisabledApiException of DisabledApiException.t 
      | `ExpiredTokenException of ExpiredTokenException.t 
      | `InternalServiceErrorException of InternalServiceErrorException.t 
      | `InvalidTokenException of InvalidTokenException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?customerIdentifier =
      fun ?productCode ->
        fun ?customerAWSAccountId ->
          fun ?licenseArn ->
            fun () ->
              {
                customerIdentifier;
                productCode;
                customerAWSAccountId;
                licenseArn
              }
    let error_of_json name json =
      match name with
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_json json)
      | "ExpiredTokenException" ->
          `ExpiredTokenException (ExpiredTokenException.of_json json)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_json json)
      | "InvalidTokenException" ->
          `InvalidTokenException (InvalidTokenException.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
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_xml xml)
      | "ExpiredTokenException" ->
          `ExpiredTokenException (ExpiredTokenException.of_xml xml)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_xml xml)
      | "InvalidTokenException" ->
          `InvalidTokenException (InvalidTokenException.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
      | `DisabledApiException e ->
          `Assoc
            [("error", (`String "DisabledApiException"));
            ("details", (DisabledApiException.to_json e))]
      | `ExpiredTokenException e ->
          `Assoc
            [("error", (`String "ExpiredTokenException"));
            ("details", (ExpiredTokenException.to_json e))]
      | `InternalServiceErrorException e ->
          `Assoc
            [("error", (`String "InternalServiceErrorException"));
            ("details", (InternalServiceErrorException.to_json e))]
      | `InvalidTokenException e ->
          `Assoc
            [("error", (`String "InvalidTokenException"));
            ("details", (InvalidTokenException.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
        [("CustomerIdentifier",
           (Option.map x.customerIdentifier ~f:CustomerIdentifier.to_value));
        ("ProductCode", (Option.map x.productCode ~f:ProductCode.to_value));
        ("CustomerAWSAccountId",
          (Option.map x.customerAWSAccountId ~f:CustomerAWSAccountId.to_value));
        ("LicenseArn", (Option.map x.licenseArn ~f:LicenseArn.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let licenseArn =
        (Option.map ~f:LicenseArn.of_xml) (Xml.child xml_arg0 "LicenseArn") in
      let customerAWSAccountId =
        (Option.map ~f:CustomerAWSAccountId.of_xml)
          (Xml.child xml_arg0 "CustomerAWSAccountId") in
      let productCode =
        (Option.map ~f:ProductCode.of_xml) (Xml.child xml_arg0 "ProductCode") in
      let customerIdentifier =
        (Option.map ~f:CustomerIdentifier.of_xml)
          (Xml.child xml_arg0 "CustomerIdentifier") in
      make ?licenseArn ?customerAWSAccountId ?productCode ?customerIdentifier
        ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let licenseArn = field_map json__ "LicenseArn" LicenseArn.of_json in
      let customerAWSAccountId =
        field_map json__ "CustomerAWSAccountId" CustomerAWSAccountId.of_json in
      let productCode = field_map json__ "ProductCode" ProductCode.of_json in
      let customerIdentifier =
        field_map json__ "CustomerIdentifier" CustomerIdentifier.of_json in
      make ?licenseArn ?customerAWSAccountId ?productCode ?customerIdentifier
        ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The result of the ResolveCustomer operation. Contains the CustomerIdentifier along with the CustomerAWSAccountId, ProductCode, and LicenseArn."]
module ResolveCustomerRequest =
  struct
    type nonrec t =
      {
      registrationToken: NonEmptyString.t
        [@ocaml.doc
          "When a buyer visits your website during the registration process, the buyer submits a registration token through the browser. The registration token is resolved to obtain a CustomerIdentifier along with the CustomerAWSAccountId, ProductCode, and LicenseArn."]}
    let context_ = "ResolveCustomerRequest"
    let make ~registrationToken = fun () -> { registrationToken }
    let to_value x =
      structure_to_value
        [("RegistrationToken",
           (Some (NonEmptyString.to_value x.registrationToken)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let registrationToken =
        NonEmptyString.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "RegistrationToken") in
      make ~registrationToken ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let registrationToken =
        field_map_exn json__ "RegistrationToken" NonEmptyString.of_json in
      make ~registrationToken ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Contains input to the ResolveCustomer operation."]
module RegisterUsageResult =
  struct
    type nonrec t =
      {
      publicKeyRotationTimestamp: Timestamp.t option
        [@ocaml.doc
          "(Optional) Only included when public key version has expired"];
      signature: NonEmptyString.t option [@ocaml.doc "JWT Token"]}
    type nonrec error =
      [ `CustomerNotEntitledException of CustomerNotEntitledException.t 
      | `DisabledApiException of DisabledApiException.t 
      | `InternalServiceErrorException of InternalServiceErrorException.t 
      | `InvalidProductCodeException of InvalidProductCodeException.t 
      | `InvalidPublicKeyVersionException of
          InvalidPublicKeyVersionException.t 
      | `InvalidRegionException of InvalidRegionException.t 
      | `PlatformNotSupportedException of PlatformNotSupportedException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?publicKeyRotationTimestamp =
      fun ?signature -> fun () -> { publicKeyRotationTimestamp; signature }
    let error_of_json name json =
      match name with
      | "CustomerNotEntitledException" ->
          `CustomerNotEntitledException
            (CustomerNotEntitledException.of_json json)
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_json json)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_json json)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_json json)
      | "InvalidPublicKeyVersionException" ->
          `InvalidPublicKeyVersionException
            (InvalidPublicKeyVersionException.of_json json)
      | "InvalidRegionException" ->
          `InvalidRegionException (InvalidRegionException.of_json json)
      | "PlatformNotSupportedException" ->
          `PlatformNotSupportedException
            (PlatformNotSupportedException.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
      | "CustomerNotEntitledException" ->
          `CustomerNotEntitledException
            (CustomerNotEntitledException.of_xml xml)
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_xml xml)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_xml xml)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_xml xml)
      | "InvalidPublicKeyVersionException" ->
          `InvalidPublicKeyVersionException
            (InvalidPublicKeyVersionException.of_xml xml)
      | "InvalidRegionException" ->
          `InvalidRegionException (InvalidRegionException.of_xml xml)
      | "PlatformNotSupportedException" ->
          `PlatformNotSupportedException
            (PlatformNotSupportedException.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
      | `CustomerNotEntitledException e ->
          `Assoc
            [("error", (`String "CustomerNotEntitledException"));
            ("details", (CustomerNotEntitledException.to_json e))]
      | `DisabledApiException e ->
          `Assoc
            [("error", (`String "DisabledApiException"));
            ("details", (DisabledApiException.to_json e))]
      | `InternalServiceErrorException e ->
          `Assoc
            [("error", (`String "InternalServiceErrorException"));
            ("details", (InternalServiceErrorException.to_json e))]
      | `InvalidProductCodeException e ->
          `Assoc
            [("error", (`String "InvalidProductCodeException"));
            ("details", (InvalidProductCodeException.to_json e))]
      | `InvalidPublicKeyVersionException e ->
          `Assoc
            [("error", (`String "InvalidPublicKeyVersionException"));
            ("details", (InvalidPublicKeyVersionException.to_json e))]
      | `InvalidRegionException e ->
          `Assoc
            [("error", (`String "InvalidRegionException"));
            ("details", (InvalidRegionException.to_json e))]
      | `PlatformNotSupportedException e ->
          `Assoc
            [("error", (`String "PlatformNotSupportedException"));
            ("details", (PlatformNotSupportedException.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
        [("PublicKeyRotationTimestamp",
           (Option.map x.publicKeyRotationTimestamp ~f:Timestamp.to_value));
        ("Signature", (Option.map x.signature ~f:NonEmptyString.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let signature =
        (Option.map ~f:NonEmptyString.of_xml)
          (Xml.child xml_arg0 "Signature") in
      let publicKeyRotationTimestamp =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "PublicKeyRotationTimestamp") in
      make ?signature ?publicKeyRotationTimestamp ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let signature = field_map json__ "Signature" NonEmptyString.of_json in
      let publicKeyRotationTimestamp =
        field_map json__ "PublicKeyRotationTimestamp" Timestamp.of_json in
      make ?signature ?publicKeyRotationTimestamp ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Paid container software products sold through Amazon Web Services Marketplace must integrate with the Amazon Web Services Marketplace Metering Service and call the RegisterUsage operation for software entitlement and metering. Free and BYOL products for Amazon ECS or Amazon EKS aren't required to call RegisterUsage, but you may choose to do so if you would like to receive usage data in your seller reports. The sections below explain the behavior of RegisterUsage. RegisterUsage performs two primary functions: metering and entitlement. Entitlement: RegisterUsage allows you to verify that the customer running your paid software is subscribed to your product on Amazon Web Services Marketplace, enabling you to guard against unauthorized use. Your container image that integrates with RegisterUsage is only required to guard against unauthorized use at container startup, as such a CustomerNotSubscribedException or PlatformNotSupportedException will only be thrown on the initial call to RegisterUsage. Subsequent calls from the same Amazon ECS task instance (e.g. task-id) or Amazon EKS pod will not throw a CustomerNotSubscribedException, even if the customer unsubscribes while the Amazon ECS task or Amazon EKS pod is still running. Metering: RegisterUsage meters software use per ECS task, per hour, or per pod for Amazon EKS with usage prorated to the second. A minimum of 1 minute of usage applies to tasks that are short lived. For example, if a customer has a 10 node Amazon ECS or Amazon EKS cluster and a service configured as a Daemon Set, then Amazon ECS or Amazon EKS will launch a task on all 10 cluster nodes and the customer will be charged for 10 tasks. Software metering is handled by the Amazon Web Services Marketplace metering control plane\226\128\148your software is not required to perform metering-specific actions other than to call RegisterUsage to commence metering. The Amazon Web Services Marketplace metering control plane will also bill customers for running ECS tasks and Amazon EKS pods, regardless of the customer's subscription state, which removes the need for your software to run entitlement checks at runtime. For containers, RegisterUsage should be called immediately at launch. If you don\226\128\153t register the container within the first 6 hours of the launch, Amazon Web Services Marketplace Metering Service doesn\226\128\153t provide any metering guarantees for previous months. Metering will continue, however, for the current month forward until the container ends. RegisterUsage is for metering paid hourly container products. For Amazon Web Services Regions that support RegisterUsage, see RegisterUsage Region support."]
module RegisterUsageRequest =
  struct
    type nonrec t =
      {
      productCode: ProductCode.t
        [@ocaml.doc
          "Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product."];
      publicKeyVersion: VersionInteger.t
        [@ocaml.doc
          "Public Key Version provided by Amazon Web Services Marketplace"];
      nonce: Nonce.t option
        [@ocaml.doc
          "(Optional) To scope down the registration to a specific running software instance and guard against replay attacks."]}
    let context_ = "RegisterUsageRequest"
    let make ?nonce =
      fun ~productCode ->
        fun ~publicKeyVersion ->
          fun () -> { nonce; productCode; publicKeyVersion }
    let to_value x =
      structure_to_value
        [("ProductCode", (Some (ProductCode.to_value x.productCode)));
        ("PublicKeyVersion",
          (Some (VersionInteger.to_value x.publicKeyVersion)));
        ("Nonce", (Option.map x.nonce ~f:Nonce.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nonce = (Option.map ~f:Nonce.of_xml) (Xml.child xml_arg0 "Nonce") in
      let publicKeyVersion =
        VersionInteger.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "PublicKeyVersion") in
      let productCode =
        ProductCode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ProductCode") in
      make ?nonce ~publicKeyVersion ~productCode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nonce = field_map json__ "Nonce" Nonce.of_json in
      let publicKeyVersion =
        field_map_exn json__ "PublicKeyVersion" VersionInteger.of_json in
      let productCode =
        field_map_exn json__ "ProductCode" ProductCode.of_json in
      make ?nonce ~publicKeyVersion ~productCode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Paid container software products sold through Amazon Web Services Marketplace must integrate with the Amazon Web Services Marketplace Metering Service and call the RegisterUsage operation for software entitlement and metering. Free and BYOL products for Amazon ECS or Amazon EKS aren't required to call RegisterUsage, but you may choose to do so if you would like to receive usage data in your seller reports. The sections below explain the behavior of RegisterUsage. RegisterUsage performs two primary functions: metering and entitlement. Entitlement: RegisterUsage allows you to verify that the customer running your paid software is subscribed to your product on Amazon Web Services Marketplace, enabling you to guard against unauthorized use. Your container image that integrates with RegisterUsage is only required to guard against unauthorized use at container startup, as such a CustomerNotSubscribedException or PlatformNotSupportedException will only be thrown on the initial call to RegisterUsage. Subsequent calls from the same Amazon ECS task instance (e.g. task-id) or Amazon EKS pod will not throw a CustomerNotSubscribedException, even if the customer unsubscribes while the Amazon ECS task or Amazon EKS pod is still running. Metering: RegisterUsage meters software use per ECS task, per hour, or per pod for Amazon EKS with usage prorated to the second. A minimum of 1 minute of usage applies to tasks that are short lived. For example, if a customer has a 10 node Amazon ECS or Amazon EKS cluster and a service configured as a Daemon Set, then Amazon ECS or Amazon EKS will launch a task on all 10 cluster nodes and the customer will be charged for 10 tasks. Software metering is handled by the Amazon Web Services Marketplace metering control plane\226\128\148your software is not required to perform metering-specific actions other than to call RegisterUsage to commence metering. The Amazon Web Services Marketplace metering control plane will also bill customers for running ECS tasks and Amazon EKS pods, regardless of the customer's subscription state, which removes the need for your software to run entitlement checks at runtime. For containers, RegisterUsage should be called immediately at launch. If you don\226\128\153t register the container within the first 6 hours of the launch, Amazon Web Services Marketplace Metering Service doesn\226\128\153t provide any metering guarantees for previous months. Metering will continue, however, for the current month forward until the container ends. RegisterUsage is for metering paid hourly container products. For Amazon Web Services Regions that support RegisterUsage, see RegisterUsage Region support."]
module MeterUsageResult =
  struct
    type nonrec t =
      {
      meteringRecordId: String_.t option [@ocaml.doc "Metering record id."]}
    type nonrec error =
      [ `CustomerNotEntitledException of CustomerNotEntitledException.t 
      | `DuplicateRequestException of DuplicateRequestException.t 
      | `IdempotencyConflictException of IdempotencyConflictException.t 
      | `InternalServiceErrorException of InternalServiceErrorException.t 
      | `InvalidEndpointRegionException of InvalidEndpointRegionException.t 
      | `InvalidProductCodeException of InvalidProductCodeException.t 
      | `InvalidTagException of InvalidTagException.t 
      | `InvalidUsageAllocationsException of
          InvalidUsageAllocationsException.t 
      | `InvalidUsageDimensionException of InvalidUsageDimensionException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `TimestampOutOfBoundsException of TimestampOutOfBoundsException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?meteringRecordId = fun () -> { meteringRecordId }
    let error_of_json name json =
      match name with
      | "CustomerNotEntitledException" ->
          `CustomerNotEntitledException
            (CustomerNotEntitledException.of_json json)
      | "DuplicateRequestException" ->
          `DuplicateRequestException (DuplicateRequestException.of_json json)
      | "IdempotencyConflictException" ->
          `IdempotencyConflictException
            (IdempotencyConflictException.of_json json)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_json json)
      | "InvalidEndpointRegionException" ->
          `InvalidEndpointRegionException
            (InvalidEndpointRegionException.of_json json)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_json json)
      | "InvalidTagException" ->
          `InvalidTagException (InvalidTagException.of_json json)
      | "InvalidUsageAllocationsException" ->
          `InvalidUsageAllocationsException
            (InvalidUsageAllocationsException.of_json json)
      | "InvalidUsageDimensionException" ->
          `InvalidUsageDimensionException
            (InvalidUsageDimensionException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "TimestampOutOfBoundsException" ->
          `TimestampOutOfBoundsException
            (TimestampOutOfBoundsException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "CustomerNotEntitledException" ->
          `CustomerNotEntitledException
            (CustomerNotEntitledException.of_xml xml)
      | "DuplicateRequestException" ->
          `DuplicateRequestException (DuplicateRequestException.of_xml xml)
      | "IdempotencyConflictException" ->
          `IdempotencyConflictException
            (IdempotencyConflictException.of_xml xml)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_xml xml)
      | "InvalidEndpointRegionException" ->
          `InvalidEndpointRegionException
            (InvalidEndpointRegionException.of_xml xml)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_xml xml)
      | "InvalidTagException" ->
          `InvalidTagException (InvalidTagException.of_xml xml)
      | "InvalidUsageAllocationsException" ->
          `InvalidUsageAllocationsException
            (InvalidUsageAllocationsException.of_xml xml)
      | "InvalidUsageDimensionException" ->
          `InvalidUsageDimensionException
            (InvalidUsageDimensionException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "TimestampOutOfBoundsException" ->
          `TimestampOutOfBoundsException
            (TimestampOutOfBoundsException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `CustomerNotEntitledException e ->
          `Assoc
            [("error", (`String "CustomerNotEntitledException"));
            ("details", (CustomerNotEntitledException.to_json e))]
      | `DuplicateRequestException e ->
          `Assoc
            [("error", (`String "DuplicateRequestException"));
            ("details", (DuplicateRequestException.to_json e))]
      | `IdempotencyConflictException e ->
          `Assoc
            [("error", (`String "IdempotencyConflictException"));
            ("details", (IdempotencyConflictException.to_json e))]
      | `InternalServiceErrorException e ->
          `Assoc
            [("error", (`String "InternalServiceErrorException"));
            ("details", (InternalServiceErrorException.to_json e))]
      | `InvalidEndpointRegionException e ->
          `Assoc
            [("error", (`String "InvalidEndpointRegionException"));
            ("details", (InvalidEndpointRegionException.to_json e))]
      | `InvalidProductCodeException e ->
          `Assoc
            [("error", (`String "InvalidProductCodeException"));
            ("details", (InvalidProductCodeException.to_json e))]
      | `InvalidTagException e ->
          `Assoc
            [("error", (`String "InvalidTagException"));
            ("details", (InvalidTagException.to_json e))]
      | `InvalidUsageAllocationsException e ->
          `Assoc
            [("error", (`String "InvalidUsageAllocationsException"));
            ("details", (InvalidUsageAllocationsException.to_json e))]
      | `InvalidUsageDimensionException e ->
          `Assoc
            [("error", (`String "InvalidUsageDimensionException"));
            ("details", (InvalidUsageDimensionException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `TimestampOutOfBoundsException e ->
          `Assoc
            [("error", (`String "TimestampOutOfBoundsException"));
            ("details", (TimestampOutOfBoundsException.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
        [("MeteringRecordId",
           (Option.map x.meteringRecordId ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let meteringRecordId =
        (Option.map ~f:String_.of_xml)
          (Xml.child xml_arg0 "MeteringRecordId") in
      make ?meteringRecordId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let meteringRecordId =
        field_map json__ "MeteringRecordId" String_.of_json in
      make ?meteringRecordId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "As a seller, your software hosted in the buyer's Amazon Web Services account uses this API action to emit metering records directly to Amazon Web Services Marketplace. You must use the following buyer Amazon Web Services account credentials to sign the API request. For Amazon EC2 deployments, your software must use the IAM role for Amazon EC2 to sign the API call for MeterUsage API operation. For Amazon EKS deployments, your software must use IAM roles for service accounts (IRSA) to sign the API call for the MeterUsage API operation. Using EKS Pod Identity, the node role, or long-term access keys is not supported. For Amazon ECS deployments, your software must use Amazon ECS task IAM role to sign the API call for the MeterUsage API operation. Using the node role or long-term access keys are not supported. For Amazon Bedrock AgentCore Runtime deployments, your software must use the AgentCore Runtime execution role to sign the API call for the MeterUsage API operation. Long-term access keys are not supported. The handling of MeterUsage requests varies between Amazon Bedrock AgentCore Runtime and non-Amazon Bedrock AgentCore deployments. For non-Amazon Bedrock AgentCore Runtime deployments, you can only report usage once per hour for each dimension. For AMI-based products, this is per dimension and per EC2 instance. For container products, this is per dimension and per ECS task or EKS pod. You can't modify values after they're recorded. If you report usage before a current hour ends, you will be unable to report additional usage until the next hour begins. The Timestamp request parameter is rounded down to the hour and used to enforce this once-per-hour rule for idempotency. For requests that are identical after the Timestamp is rounded down, the API is idempotent and returns the metering record ID. For Amazon Bedrock AgentCore Runtime deployments, you can report usage multiple times per hour for the same dimension. You do not need to aggregate metering records by the hour. You must include an idempotency token in the ClientToken request parameter. If using an Amazon SDK or the Amazon Web Services CLI, you must use the latest version which automatically includes an idempotency token in the ClientToken request parameter so that the request is processed successfully. The Timestamp request parameter is not rounded down to the hour and is not used for duplicate validation. Requests with duplicate Timestamps are aggregated as long as the ClientToken is unique. If you submit records more than six hours after events occur, the records won't be accepted. The timestamp in your request determines when an event is recorded. You can optionally include multiple usage allocations, to provide customers with usage data split into buckets by tags that you define or allow the customer to define. For Amazon Web Services Regions that support MeterUsage, see MeterUsage Region support for Amazon EC2 and MeterUsage Region support for Amazon ECS and Amazon EKS."]
module MeterUsageRequest =
  struct
    type nonrec t =
      {
      productCode: ProductCode.t
        [@ocaml.doc
          "Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product."];
      timestamp: Timestamp.t
        [@ocaml.doc
          "Timestamp, in UTC, for which the usage is being reported. Your application can meter usage for up to six hours in the past. Make sure the timestamp value is not before the start of the software usage."];
      usageDimension: UsageDimension.t
        [@ocaml.doc
          "It will be one of the fcp dimension name provided during the publishing of the product."];
      usageQuantity: UsageQuantity.t option
        [@ocaml.doc
          "Consumption value for the hour. Defaults to 0 if not specified."];
      dryRun: Boolean.t option
        [@ocaml.doc
          "Checks whether you have the permissions required for the action, but does not make the request. If you have the permissions, the request returns DryRunOperation; otherwise, it returns UnauthorizedException. Defaults to false if not specified."];
      usageAllocations: UsageAllocations.t option
        [@ocaml.doc
          "The set of UsageAllocations to submit. The sum of all UsageAllocation quantities must equal the UsageQuantity of the MeterUsage request, and each UsageAllocation must have a unique set of tags (include no tags)."];
      clientToken: ClientToken.t option
        [@ocaml.doc
          "Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value. If you don't provide this value, then Amazon Web Services generates a random one for you. If you retry the operation with the same ClientToken, but with different parameters, the retry fails with an IdempotencyConflictException error."]}
    let context_ = "MeterUsageRequest"
    let make ?usageQuantity =
      fun ?dryRun ->
        fun ?usageAllocations ->
          fun ?clientToken ->
            fun ~productCode ->
              fun ~timestamp ->
                fun ~usageDimension ->
                  fun () ->
                    {
                      usageQuantity;
                      dryRun;
                      usageAllocations;
                      clientToken;
                      productCode;
                      timestamp;
                      usageDimension
                    }
    let to_value x =
      structure_to_value
        [("ProductCode", (Some (ProductCode.to_value x.productCode)));
        ("Timestamp", (Some (Timestamp.to_value x.timestamp)));
        ("UsageDimension", (Some (UsageDimension.to_value x.usageDimension)));
        ("UsageQuantity",
          (Option.map x.usageQuantity ~f:UsageQuantity.to_value));
        ("DryRun", (Option.map x.dryRun ~f:Boolean.to_value));
        ("UsageAllocations",
          (Option.map x.usageAllocations ~f:UsageAllocations.to_value));
        ("ClientToken", (Option.map x.clientToken ~f:ClientToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let clientToken =
        (Option.map ~f:ClientToken.of_xml) (Xml.child xml_arg0 "ClientToken") in
      let usageAllocations =
        (Option.map ~f:UsageAllocations.of_xml)
          (Xml.child xml_arg0 "UsageAllocations") in
      let dryRun =
        (Option.map ~f:Boolean.of_xml) (Xml.child xml_arg0 "DryRun") in
      let usageQuantity =
        (Option.map ~f:UsageQuantity.of_xml)
          (Xml.child xml_arg0 "UsageQuantity") in
      let usageDimension =
        UsageDimension.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UsageDimension") in
      let timestamp =
        Timestamp.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Timestamp") in
      let productCode =
        ProductCode.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ProductCode") in
      make ?clientToken ?usageAllocations ?dryRun ?usageQuantity
        ~usageDimension ~timestamp ~productCode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let clientToken = field_map json__ "ClientToken" ClientToken.of_json in
      let usageAllocations =
        field_map json__ "UsageAllocations" UsageAllocations.of_json in
      let dryRun = field_map json__ "DryRun" Boolean.of_json in
      let usageQuantity =
        field_map json__ "UsageQuantity" UsageQuantity.of_json in
      let usageDimension =
        field_map_exn json__ "UsageDimension" UsageDimension.of_json in
      let timestamp = field_map_exn json__ "Timestamp" Timestamp.of_json in
      let productCode =
        field_map_exn json__ "ProductCode" ProductCode.of_json in
      make ?clientToken ?usageAllocations ?dryRun ?usageQuantity
        ~usageDimension ~timestamp ~productCode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "As a seller, your software hosted in the buyer's Amazon Web Services account uses this API action to emit metering records directly to Amazon Web Services Marketplace. You must use the following buyer Amazon Web Services account credentials to sign the API request. For Amazon EC2 deployments, your software must use the IAM role for Amazon EC2 to sign the API call for MeterUsage API operation. For Amazon EKS deployments, your software must use IAM roles for service accounts (IRSA) to sign the API call for the MeterUsage API operation. Using EKS Pod Identity, the node role, or long-term access keys is not supported. For Amazon ECS deployments, your software must use Amazon ECS task IAM role to sign the API call for the MeterUsage API operation. Using the node role or long-term access keys are not supported. For Amazon Bedrock AgentCore Runtime deployments, your software must use the AgentCore Runtime execution role to sign the API call for the MeterUsage API operation. Long-term access keys are not supported. The handling of MeterUsage requests varies between Amazon Bedrock AgentCore Runtime and non-Amazon Bedrock AgentCore deployments. For non-Amazon Bedrock AgentCore Runtime deployments, you can only report usage once per hour for each dimension. For AMI-based products, this is per dimension and per EC2 instance. For container products, this is per dimension and per ECS task or EKS pod. You can't modify values after they're recorded. If you report usage before a current hour ends, you will be unable to report additional usage until the next hour begins. The Timestamp request parameter is rounded down to the hour and used to enforce this once-per-hour rule for idempotency. For requests that are identical after the Timestamp is rounded down, the API is idempotent and returns the metering record ID. For Amazon Bedrock AgentCore Runtime deployments, you can report usage multiple times per hour for the same dimension. You do not need to aggregate metering records by the hour. You must include an idempotency token in the ClientToken request parameter. If using an Amazon SDK or the Amazon Web Services CLI, you must use the latest version which automatically includes an idempotency token in the ClientToken request parameter so that the request is processed successfully. The Timestamp request parameter is not rounded down to the hour and is not used for duplicate validation. Requests with duplicate Timestamps are aggregated as long as the ClientToken is unique. If you submit records more than six hours after events occur, the records won't be accepted. The timestamp in your request determines when an event is recorded. You can optionally include multiple usage allocations, to provide customers with usage data split into buckets by tags that you define or allow the customer to define. For Amazon Web Services Regions that support MeterUsage, see MeterUsage Region support for Amazon EC2 and MeterUsage Region support for Amazon ECS and Amazon EKS."]
module BatchMeterUsageResult =
  struct
    type nonrec t =
      {
      results: UsageRecordResultList.t option
        [@ocaml.doc
          "Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by Amazon Web Services Marketplace Metering Service or were invalid. Invalid records should be fixed before being resubmitted."];
      unprocessedRecords: UsageRecordList.t option
        [@ocaml.doc
          "Contains all UsageRecords that were not processed by BatchMeterUsage. This is a list of UsageRecords. You can retry the failed request by making another BatchMeterUsage call with this list as input in the BatchMeterUsageRequest."]}
    type nonrec error =
      [ `DisabledApiException of DisabledApiException.t 
      | `InternalServiceErrorException of InternalServiceErrorException.t 
      | `InvalidCustomerIdentifierException of
          InvalidCustomerIdentifierException.t 
      | `InvalidLicenseException of InvalidLicenseException.t 
      | `InvalidProductCodeException of InvalidProductCodeException.t 
      | `InvalidTagException of InvalidTagException.t 
      | `InvalidUsageAllocationsException of
          InvalidUsageAllocationsException.t 
      | `InvalidUsageDimensionException of InvalidUsageDimensionException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `TimestampOutOfBoundsException of TimestampOutOfBoundsException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?results =
      fun ?unprocessedRecords -> fun () -> { results; unprocessedRecords }
    let error_of_json name json =
      match name with
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_json json)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_json json)
      | "InvalidCustomerIdentifierException" ->
          `InvalidCustomerIdentifierException
            (InvalidCustomerIdentifierException.of_json json)
      | "InvalidLicenseException" ->
          `InvalidLicenseException (InvalidLicenseException.of_json json)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_json json)
      | "InvalidTagException" ->
          `InvalidTagException (InvalidTagException.of_json json)
      | "InvalidUsageAllocationsException" ->
          `InvalidUsageAllocationsException
            (InvalidUsageAllocationsException.of_json json)
      | "InvalidUsageDimensionException" ->
          `InvalidUsageDimensionException
            (InvalidUsageDimensionException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "TimestampOutOfBoundsException" ->
          `TimestampOutOfBoundsException
            (TimestampOutOfBoundsException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "DisabledApiException" ->
          `DisabledApiException (DisabledApiException.of_xml xml)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_xml xml)
      | "InvalidCustomerIdentifierException" ->
          `InvalidCustomerIdentifierException
            (InvalidCustomerIdentifierException.of_xml xml)
      | "InvalidLicenseException" ->
          `InvalidLicenseException (InvalidLicenseException.of_xml xml)
      | "InvalidProductCodeException" ->
          `InvalidProductCodeException
            (InvalidProductCodeException.of_xml xml)
      | "InvalidTagException" ->
          `InvalidTagException (InvalidTagException.of_xml xml)
      | "InvalidUsageAllocationsException" ->
          `InvalidUsageAllocationsException
            (InvalidUsageAllocationsException.of_xml xml)
      | "InvalidUsageDimensionException" ->
          `InvalidUsageDimensionException
            (InvalidUsageDimensionException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "TimestampOutOfBoundsException" ->
          `TimestampOutOfBoundsException
            (TimestampOutOfBoundsException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `DisabledApiException e ->
          `Assoc
            [("error", (`String "DisabledApiException"));
            ("details", (DisabledApiException.to_json e))]
      | `InternalServiceErrorException e ->
          `Assoc
            [("error", (`String "InternalServiceErrorException"));
            ("details", (InternalServiceErrorException.to_json e))]
      | `InvalidCustomerIdentifierException e ->
          `Assoc
            [("error", (`String "InvalidCustomerIdentifierException"));
            ("details", (InvalidCustomerIdentifierException.to_json e))]
      | `InvalidLicenseException e ->
          `Assoc
            [("error", (`String "InvalidLicenseException"));
            ("details", (InvalidLicenseException.to_json e))]
      | `InvalidProductCodeException e ->
          `Assoc
            [("error", (`String "InvalidProductCodeException"));
            ("details", (InvalidProductCodeException.to_json e))]
      | `InvalidTagException e ->
          `Assoc
            [("error", (`String "InvalidTagException"));
            ("details", (InvalidTagException.to_json e))]
      | `InvalidUsageAllocationsException e ->
          `Assoc
            [("error", (`String "InvalidUsageAllocationsException"));
            ("details", (InvalidUsageAllocationsException.to_json e))]
      | `InvalidUsageDimensionException e ->
          `Assoc
            [("error", (`String "InvalidUsageDimensionException"));
            ("details", (InvalidUsageDimensionException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `TimestampOutOfBoundsException e ->
          `Assoc
            [("error", (`String "TimestampOutOfBoundsException"));
            ("details", (TimestampOutOfBoundsException.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
        [("Results",
           (Option.map x.results ~f:UsageRecordResultList.to_value));
        ("UnprocessedRecords",
          (Option.map x.unprocessedRecords ~f:UsageRecordList.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let unprocessedRecords =
        (Option.map ~f:UsageRecordList.of_xml)
          (Xml.child xml_arg0 "UnprocessedRecords") in
      let results =
        (Option.map ~f:UsageRecordResultList.of_xml)
          (Xml.child xml_arg0 "Results") in
      make ?unprocessedRecords ?results ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let unprocessedRecords =
        field_map json__ "UnprocessedRecords" UsageRecordList.of_json in
      let results = field_map json__ "Results" UsageRecordResultList.of_json in
      make ?unprocessedRecords ?results ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Contains the UsageRecords processed by BatchMeterUsage and any records that have failed due to transient error."]
module BatchMeterUsageRequest =
  struct
    type nonrec t =
      {
      usageRecords: UsageRecordList.t
        [@ocaml.doc
          "The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time."];
      productCode: ProductCode.t option
        [@ocaml.doc
          "Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product."]}
    let context_ = "BatchMeterUsageRequest"
    let make ?productCode =
      fun ~usageRecords -> fun () -> { productCode; usageRecords }
    let to_value x =
      structure_to_value
        [("UsageRecords", (Some (UsageRecordList.to_value x.usageRecords)));
        ("ProductCode", (Option.map x.productCode ~f:ProductCode.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let productCode =
        (Option.map ~f:ProductCode.of_xml) (Xml.child xml_arg0 "ProductCode") in
      let usageRecords =
        UsageRecordList.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "UsageRecords") in
      make ?productCode ~usageRecords ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let productCode = field_map json__ "ProductCode" ProductCode.of_json in
      let usageRecords =
        field_map_exn json__ "UsageRecords" UsageRecordList.of_json in
      make ?productCode ~usageRecords ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A BatchMeterUsageRequest contains UsageRecords, which indicate quantities of usage within your application."]