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
(* 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.sustainability
let apiVersion = "2018-05-10"
let endpointPrefix = "sustainability"
let serviceFullName = "AWS Sustainability"
let signatureVersion = "v4"
let protocol = "rest_json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
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 Double =
  struct
    type nonrec t = float
    let make i = i
    let of_string = Float.of_string
    let to_value x = `Double x
    let to_query v = to_query to_value v
    let to_header x = Stdlib.Float.to_string x
    let of_xml xml_arg0 =
      Float.of_string (string_of_xml ~kind:"a double" xml_arg0)
    let of_json j = float_of_json ~kind:"a double" j
    let to_json = simple_to_json to_value
  end
module EmissionsUnit =
  struct
    type nonrec t =
      | MTCO2e 
      | Non_static_id of string 
    let make i = i
    let to_string = function | MTCO2e -> "MTCO2e" | Non_static_id s -> s
    let of_string = function | "MTCO2e" -> MTCO2e | 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 EmissionsUnit" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"EmissionsUnit" j)
    let to_json = simple_to_json to_value
  end
module Dimension =
  struct
    type nonrec t =
      | USAGE_ACCOUNT_ID 
      | REGION 
      | SERVICE 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | USAGE_ACCOUNT_ID -> "USAGE_ACCOUNT_ID"
      | REGION -> "REGION"
      | SERVICE -> "SERVICE"
      | Non_static_id s -> s
    let of_string =
      function
      | "USAGE_ACCOUNT_ID" -> USAGE_ACCOUNT_ID
      | "REGION" -> REGION
      | "SERVICE" -> SERVICE
      | 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 Dimension" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"Dimension" 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 Emissions =
  struct
    type nonrec t =
      {
      value: Double.t option
        [@ocaml.doc "The numeric value of the emissions quantity."];
      unit: EmissionsUnit.t option
        [@ocaml.doc "The unit of measurement for the emissions value."]}
    let make ?value = fun ?unit -> fun () -> { value; unit }
    let to_value x =
      structure_to_value
        [("Value", (Option.map x.value ~f:Double.to_value));
        ("Unit", (Option.map x.unit ~f:EmissionsUnit.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let unit =
        (Option.map ~f:EmissionsUnit.of_xml) (Xml.child xml_arg0 "Unit") in
      let value = (Option.map ~f:Double.of_xml) (Xml.child xml_arg0 "Value") in
      make ?unit ?value ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let unit = field_map json__ "Unit" EmissionsUnit.of_json in
      let value = field_map json__ "Value" Double.of_json in
      make ?unit ?value ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Represents a carbon emissions quantity with its value and unit of measurement."]
module EmissionsType =
  struct
    type nonrec t =
      | TOTAL_LBM_CARBON_EMISSIONS 
      | TOTAL_MBM_CARBON_EMISSIONS 
      | TOTAL_SCOPE_1_CARBON_EMISSIONS 
      | TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS 
      | TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS 
      | TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS 
      | TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | TOTAL_LBM_CARBON_EMISSIONS -> "TOTAL_LBM_CARBON_EMISSIONS"
      | TOTAL_MBM_CARBON_EMISSIONS -> "TOTAL_MBM_CARBON_EMISSIONS"
      | TOTAL_SCOPE_1_CARBON_EMISSIONS -> "TOTAL_SCOPE_1_CARBON_EMISSIONS"
      | TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS ->
          "TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS"
      | TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS ->
          "TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS"
      | TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS ->
          "TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS"
      | TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS ->
          "TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS"
      | Non_static_id s -> s
    let of_string =
      function
      | "TOTAL_LBM_CARBON_EMISSIONS" -> TOTAL_LBM_CARBON_EMISSIONS
      | "TOTAL_MBM_CARBON_EMISSIONS" -> TOTAL_MBM_CARBON_EMISSIONS
      | "TOTAL_SCOPE_1_CARBON_EMISSIONS" -> TOTAL_SCOPE_1_CARBON_EMISSIONS
      | "TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS" ->
          TOTAL_SCOPE_2_LBM_CARBON_EMISSIONS
      | "TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS" ->
          TOTAL_SCOPE_2_MBM_CARBON_EMISSIONS
      | "TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS" ->
          TOTAL_SCOPE_3_LBM_CARBON_EMISSIONS
      | "TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS" ->
          TOTAL_SCOPE_3_MBM_CARBON_EMISSIONS
      | 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 EmissionsType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"EmissionsType" 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 DimensionsMap =
  struct
    type nonrec t = (Dimension.t * String_.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            ((Dimension.of_string chopped),
                              (String_.of_string v))))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (Dimension.to_value x) |>
                    (fun x -> (String_.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:Dimension.of_string
        ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module EmissionsMap =
  struct
    type nonrec t = (EmissionsType.t * Emissions.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            let (_ : string) = v in
                            let (_ : string) = chopped in
                            failwith
                              "no of_header for complex types EmissionsType Emissions"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (EmissionsType.to_value x) |>
                    (fun x -> (Emissions.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:EmissionsType.of_string
        ~of_json:Emissions.of_json j
    let to_json v = composed_to_json to_value v
  end
module ModelVersion =
  struct
    type nonrec t = string
    let context_ = "ModelVersion"
    let make i =
      let open Result in
        ok_or_failwith
          (check_pattern i
             ~pattern:"v(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?");
        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:"ModelVersion" j
    let to_json = simple_to_json to_value
  end
module TimePeriod =
  struct
    type nonrec t =
      {
      start: Timestamp.t
        [@ocaml.doc
          "The start (inclusive) of the time period. ISO-8601 formatted timestamp, for example: YYYY-MM-DDThh:mm:ss.sssZ"];
      end_: Timestamp.t
        [@ocaml.doc
          "The end (exclusive) of the time period. ISO-8601 formatted timestamp, for example: YYYY-MM-DDThh:mm:ss.sssZ"]}
    let context_ = "TimePeriod"
    let make ~start = fun ~end_ -> fun () -> { start; end_ }
    let to_value x =
      structure_to_value
        [("Start", (Some (Timestamp.to_value x.start)));
        ("End", (Some (Timestamp.to_value x.end_)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let end_ =
        Timestamp.of_xml (Xml.child_exn ~context:context_ xml_arg0 "End") in
      let start =
        Timestamp.of_xml (Xml.child_exn ~context:context_ xml_arg0 "Start") in
      make ~end_ ~start ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let end_ = field_map_exn json__ "End" Timestamp.of_json in
      let start = field_map_exn json__ "Start" Timestamp.of_json in
      make ~end_ ~start ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Represents a duration of time defined by start and end timestamps."]
module DimensionValueList =
  struct
    type nonrec t = String_.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:String_.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:String_.of_xml)
    let of_json j =
      list_of_json ~kind:"DimensionValueList" ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module EstimatedCarbonEmissions =
  struct
    type nonrec t =
      {
      timePeriod: TimePeriod.t option
        [@ocaml.doc "The reporting period for emission values."];
      dimensionsValues: DimensionsMap.t option
        [@ocaml.doc "The dimensions used to group emissions values."];
      modelVersion: ModelVersion.t option
        [@ocaml.doc
          "The semantic version-formatted string that indicates the methodology version used to calculate the emission values. The AWS Sustainability service reflects the most recent model version for every month. You will not see two entries for the same month with different ModelVersion values. To track the evolution of the methodology and compare emission values from previous versions, we recommend creating a Data Export."];
      emissionsValues: EmissionsMap.t option
        [@ocaml.doc
          "The emissions values for the requested emissions types."]}
    let make ?timePeriod =
      fun ?dimensionsValues ->
        fun ?modelVersion ->
          fun ?emissionsValues ->
            fun () ->
              { timePeriod; dimensionsValues; modelVersion; emissionsValues }
    let to_value x =
      structure_to_value
        [("TimePeriod", (Option.map x.timePeriod ~f:TimePeriod.to_value));
        ("DimensionsValues",
          (Option.map x.dimensionsValues ~f:DimensionsMap.to_value));
        ("ModelVersion",
          (Option.map x.modelVersion ~f:ModelVersion.to_value));
        ("EmissionsValues",
          (Option.map x.emissionsValues ~f:EmissionsMap.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let emissionsValues =
        (Option.map ~f:EmissionsMap.of_xml)
          (Xml.child xml_arg0 "EmissionsValues") in
      let modelVersion =
        (Option.map ~f:ModelVersion.of_xml)
          (Xml.child xml_arg0 "ModelVersion") in
      let dimensionsValues =
        (Option.map ~f:DimensionsMap.of_xml)
          (Xml.child xml_arg0 "DimensionsValues") in
      let timePeriod =
        (Option.map ~f:TimePeriod.of_xml) (Xml.child xml_arg0 "TimePeriod") in
      make ?emissionsValues ?modelVersion ?dimensionsValues ?timePeriod ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let emissionsValues =
        field_map json__ "EmissionsValues" EmissionsMap.of_json in
      let modelVersion = field_map json__ "ModelVersion" ModelVersion.of_json in
      let dimensionsValues =
        field_map json__ "DimensionsValues" DimensionsMap.of_json in
      let timePeriod = field_map json__ "TimePeriod" TimePeriod.of_json in
      make ?emissionsValues ?modelVersion ?dimensionsValues ?timePeriod ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Contains estimated carbon emissions data for a specific time period and dimension grouping."]
module DimensionListMap =
  struct
    type nonrec t = (Dimension.t * DimensionValueList.t) list
    let make i = i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            let (_ : string) = v in
                            let (_ : string) = chopped in
                            failwith
                              "no of_header for complex types Dimension DimensionValueList"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (Dimension.to_value x) |>
                    (fun x ->
                       (DimensionValueList.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:Dimension.of_string
        ~of_json:DimensionValueList.of_json j
    let to_json v = composed_to_json to_value v
  end
module Month =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:12) >>= (fun () -> check_int_min i ~min:1));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string (string_of_xml ~kind:"an integer for Month" 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 DimensionEntry =
  struct
    type nonrec t =
      {
      dimension: Dimension.t option
        [@ocaml.doc "The dimension type that categorizes this entry."];
      value: String_.t option
        [@ocaml.doc
          "The value for the specified dimension. Valid values vary based on the dimension type (e.g., us-east-1 for the REGION dimension, AmazonEC2 for the SERVICE dimension)."]}
    let make ?dimension = fun ?value -> fun () -> { dimension; value }
    let to_value x =
      structure_to_value
        [("Dimension", (Option.map x.dimension ~f:Dimension.to_value));
        ("Value", (Option.map x.value ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let value = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Value") in
      let dimension =
        (Option.map ~f:Dimension.of_xml) (Xml.child xml_arg0 "Dimension") in
      make ?value ?dimension ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let value = field_map json__ "Value" String_.of_json in
      let dimension = field_map json__ "Dimension" Dimension.of_json in
      make ?value ?dimension ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Represents a dimension and its corresponding value."]
module AccessDeniedException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.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" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "You do not have sufficient access to perform this action."]
module EstimatedCarbonEmissionsList =
  struct
    type nonrec t = EstimatedCarbonEmissions.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:EstimatedCarbonEmissions.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:EstimatedCarbonEmissions.of_xml)
    let of_json j =
      list_of_json ~kind:"EstimatedCarbonEmissionsList"
        ~of_json:EstimatedCarbonEmissions.of_json j
    let to_json v = composed_to_json to_value v
  end
module InternalServerException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.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" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The request processing has failed because of an unknown error, exception, or failure."]
module NextToken =
  struct
    type nonrec t = string
    let context_ = "NextToken"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:2000) >>=
             (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:"NextToken" j
    let to_json = simple_to_json to_value
  end
module ThrottlingException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.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" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to request throttling."]
module ValidationException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.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" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The input fails to satisfy the constraints specified by an Amazon Web Services service."]
module DimensionList =
  struct
    type nonrec t = Dimension.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:Dimension.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:Dimension.of_xml)
    let of_json j =
      list_of_json ~kind:"DimensionList" ~of_json:Dimension.of_json j
    let to_json v = composed_to_json to_value v
  end
module EmissionsTypeList =
  struct
    type nonrec t = EmissionsType.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:EmissionsType.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:EmissionsType.of_xml)
    let of_json j =
      list_of_json ~kind:"EmissionsTypeList" ~of_json:EmissionsType.of_json j
    let to_json v = composed_to_json to_value v
  end
module FilterExpression =
  struct
    type nonrec t =
      {
      dimensions: DimensionListMap.t option
        [@ocaml.doc "Filters emission values by specific dimension values."]}
    let make ?dimensions = fun () -> { dimensions }
    let to_value x =
      structure_to_value
        [("Dimensions",
           (Option.map x.dimensions ~f:DimensionListMap.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dimensions =
        (Option.map ~f:DimensionListMap.of_xml)
          (Xml.child xml_arg0 "Dimensions") in
      make ?dimensions ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dimensions = field_map json__ "Dimensions" DimensionListMap.of_json in
      make ?dimensions ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Filters emission values by specific dimension values."]
module GranularityConfiguration =
  struct
    type nonrec t =
      {
      fiscalYearStartMonth: Month.t option
        [@ocaml.doc
          "The month (1-12) when the fiscal year begins. Used for YEARLY_FISCAL and QUARTERLY_FISCAL granularity. Defaults to 1 (January)."]}
    let make ?fiscalYearStartMonth = fun () -> { fiscalYearStartMonth }
    let to_value x =
      structure_to_value
        [("FiscalYearStartMonth",
           (Option.map x.fiscalYearStartMonth ~f:Month.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let fiscalYearStartMonth =
        (Option.map ~f:Month.of_xml)
          (Xml.child xml_arg0 "FiscalYearStartMonth") in
      make ?fiscalYearStartMonth ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let fiscalYearStartMonth =
        field_map json__ "FiscalYearStartMonth" Month.of_json in
      make ?fiscalYearStartMonth ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Contains configuration for the fiscal year granularities (e.g., YEARLY_FISCAL, QUARTERLY_FISCAL."]
module MaxResults =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:5000) >>= (fun () -> check_int_min i ~min:1));
        i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string
        (string_of_xml ~kind:"an integer for MaxResults" 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 TimeGranularity =
  struct
    type nonrec t =
      | YEARLY_CALENDAR 
      | YEARLY_FISCAL 
      | QUARTERLY_CALENDAR 
      | QUARTERLY_FISCAL 
      | MONTHLY 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | YEARLY_CALENDAR -> "YEARLY_CALENDAR"
      | YEARLY_FISCAL -> "YEARLY_FISCAL"
      | QUARTERLY_CALENDAR -> "QUARTERLY_CALENDAR"
      | QUARTERLY_FISCAL -> "QUARTERLY_FISCAL"
      | MONTHLY -> "MONTHLY"
      | Non_static_id s -> s
    let of_string =
      function
      | "YEARLY_CALENDAR" -> YEARLY_CALENDAR
      | "YEARLY_FISCAL" -> YEARLY_FISCAL
      | "QUARTERLY_CALENDAR" -> QUARTERLY_CALENDAR
      | "QUARTERLY_FISCAL" -> QUARTERLY_FISCAL
      | "MONTHLY" -> MONTHLY
      | 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 TimeGranularity" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"TimeGranularity" j)
    let to_json = simple_to_json to_value
  end
module DimensionEntryList =
  struct
    type nonrec t = DimensionEntry.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:DimensionEntry.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:DimensionEntry.of_xml)
    let of_json j =
      list_of_json ~kind:"DimensionEntryList" ~of_json:DimensionEntry.of_json
        j
    let to_json v = composed_to_json to_value v
  end
module GetEstimatedCarbonEmissionsResponse =
  struct
    type nonrec t =
      {
      results: EstimatedCarbonEmissionsList.t option
        [@ocaml.doc "The result of the requested inputs."];
      nextToken: NextToken.t option
        [@ocaml.doc
          "The pagination token indicating there are additional pages available. You can use the token in a following request to fetch the next set of results."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?results = fun ?nextToken -> fun () -> { results; nextToken }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.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:EstimatedCarbonEmissionsList.to_value));
        ("NextToken", (Option.map x.nextToken ~f:NextToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:NextToken.of_xml) (Xml.child xml_arg0 "NextToken") in
      let results =
        (Option.map ~f:EstimatedCarbonEmissionsList.of_xml)
          (Xml.child xml_arg0 "Results") in
      make ?nextToken ?results ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" NextToken.of_json in
      let results =
        field_map json__ "Results" EstimatedCarbonEmissionsList.of_json in
      make ?nextToken ?results ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully."]
module GetEstimatedCarbonEmissionsRequest =
  struct
    type nonrec t =
      {
      timePeriod: TimePeriod.t
        [@ocaml.doc
          "The date range for fetching estimated carbon emissions."];
      groupBy: DimensionList.t option
        [@ocaml.doc
          "The dimensions available for grouping estimated carbon emissions."];
      filterBy: FilterExpression.t option
        [@ocaml.doc "The criteria for filtering estimated carbon emissions."];
      emissionsTypes: EmissionsTypeList.t option
        [@ocaml.doc
          "The emission types to include in the results. If absent, returns TOTAL_LBM_CARBON_EMISSIONS and TOTAL_MBM_CARBON_EMISSIONS emissions types."];
      granularity: TimeGranularity.t option
        [@ocaml.doc
          "The time granularity for the results. If absent, uses MONTHLY time granularity."];
      granularityConfiguration: GranularityConfiguration.t option
        [@ocaml.doc
          "Configuration for fiscal year calculations when using YEARLY_FISCAL or QUARTERLY_FISCAL granularity."];
      maxResults: MaxResults.t option
        [@ocaml.doc
          "The maximum number of results to return in a single call. Default is 40."];
      nextToken: NextToken.t option
        [@ocaml.doc
          "The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page."]}
    let context_ = "GetEstimatedCarbonEmissionsRequest"
    let make ?groupBy =
      fun ?filterBy ->
        fun ?emissionsTypes ->
          fun ?granularity ->
            fun ?granularityConfiguration ->
              fun ?maxResults ->
                fun ?nextToken ->
                  fun ~timePeriod ->
                    fun () ->
                      {
                        groupBy;
                        filterBy;
                        emissionsTypes;
                        granularity;
                        granularityConfiguration;
                        maxResults;
                        nextToken;
                        timePeriod
                      }
    let to_value x =
      structure_to_value
        [("TimePeriod", (Some (TimePeriod.to_value x.timePeriod)));
        ("GroupBy", (Option.map x.groupBy ~f:DimensionList.to_value));
        ("FilterBy", (Option.map x.filterBy ~f:FilterExpression.to_value));
        ("EmissionsTypes",
          (Option.map x.emissionsTypes ~f:EmissionsTypeList.to_value));
        ("Granularity",
          (Option.map x.granularity ~f:TimeGranularity.to_value));
        ("GranularityConfiguration",
          (Option.map x.granularityConfiguration
             ~f:GranularityConfiguration.to_value));
        ("MaxResults", (Option.map x.maxResults ~f:MaxResults.to_value));
        ("NextToken", (Option.map x.nextToken ~f:NextToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:NextToken.of_xml) (Xml.child xml_arg0 "NextToken") in
      let maxResults =
        (Option.map ~f:MaxResults.of_xml) (Xml.child xml_arg0 "MaxResults") in
      let granularityConfiguration =
        (Option.map ~f:GranularityConfiguration.of_xml)
          (Xml.child xml_arg0 "GranularityConfiguration") in
      let granularity =
        (Option.map ~f:TimeGranularity.of_xml)
          (Xml.child xml_arg0 "Granularity") in
      let emissionsTypes =
        (Option.map ~f:EmissionsTypeList.of_xml)
          (Xml.child xml_arg0 "EmissionsTypes") in
      let filterBy =
        (Option.map ~f:FilterExpression.of_xml)
          (Xml.child xml_arg0 "FilterBy") in
      let groupBy =
        (Option.map ~f:DimensionList.of_xml) (Xml.child xml_arg0 "GroupBy") in
      let timePeriod =
        TimePeriod.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "TimePeriod") in
      make ?nextToken ?maxResults ?granularityConfiguration ?granularity
        ?emissionsTypes ?filterBy ?groupBy ~timePeriod ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" NextToken.of_json in
      let maxResults = field_map json__ "MaxResults" MaxResults.of_json in
      let granularityConfiguration =
        field_map json__ "GranularityConfiguration"
          GranularityConfiguration.of_json in
      let granularity =
        field_map json__ "Granularity" TimeGranularity.of_json in
      let emissionsTypes =
        field_map json__ "EmissionsTypes" EmissionsTypeList.of_json in
      let filterBy = field_map json__ "FilterBy" FilterExpression.of_json in
      let groupBy = field_map json__ "GroupBy" DimensionList.of_json in
      let timePeriod = field_map_exn json__ "TimePeriod" TimePeriod.of_json in
      make ?nextToken ?maxResults ?granularityConfiguration ?granularity
        ?emissionsTypes ?filterBy ?groupBy ~timePeriod ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns estimated carbon emission values based on customer grouping and filtering parameters. We recommend using pagination to ensure that the operation returns quickly and successfully."]
module GetEstimatedCarbonEmissionsDimensionValuesResponse =
  struct
    type nonrec t =
      {
      results: DimensionEntryList.t option
        [@ocaml.doc
          "The list of possible dimensions over which the emissions data is aggregated."];
      nextToken: NextToken.t option
        [@ocaml.doc
          "The pagination token indicating there are additional pages available. You can use the token in a following request to fetch the next set of results."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServerException of InternalServerException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?results = fun ?nextToken -> fun () -> { results; nextToken }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.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:DimensionEntryList.to_value));
        ("NextToken", (Option.map x.nextToken ~f:NextToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:NextToken.of_xml) (Xml.child xml_arg0 "NextToken") in
      let results =
        (Option.map ~f:DimensionEntryList.of_xml)
          (Xml.child xml_arg0 "Results") in
      make ?nextToken ?results ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" NextToken.of_json in
      let results = field_map json__ "Results" DimensionEntryList.of_json in
      make ?nextToken ?results ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns the possible dimension values available for a customer's account. We recommend using pagination to ensure that the operation returns quickly and successfully."]
module GetEstimatedCarbonEmissionsDimensionValuesRequest =
  struct
    type nonrec t =
      {
      timePeriod: TimePeriod.t
        [@ocaml.doc "The date range for fetching the dimension values."];
      dimensions: DimensionList.t
        [@ocaml.doc
          "The dimensions available for grouping estimated carbon emissions."];
      maxResults: MaxResults.t option
        [@ocaml.doc
          "The maximum number of results to return in a single call. Default is 40."];
      nextToken: NextToken.t option
        [@ocaml.doc
          "The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page."]}
    let context_ = "GetEstimatedCarbonEmissionsDimensionValuesRequest"
    let make ?maxResults =
      fun ?nextToken ->
        fun ~timePeriod ->
          fun ~dimensions ->
            fun () -> { maxResults; nextToken; timePeriod; dimensions }
    let to_value x =
      structure_to_value
        [("TimePeriod", (Some (TimePeriod.to_value x.timePeriod)));
        ("Dimensions", (Some (DimensionList.to_value x.dimensions)));
        ("MaxResults", (Option.map x.maxResults ~f:MaxResults.to_value));
        ("NextToken", (Option.map x.nextToken ~f:NextToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let nextToken =
        (Option.map ~f:NextToken.of_xml) (Xml.child xml_arg0 "NextToken") in
      let maxResults =
        (Option.map ~f:MaxResults.of_xml) (Xml.child xml_arg0 "MaxResults") in
      let dimensions =
        DimensionList.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "Dimensions") in
      let timePeriod =
        TimePeriod.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "TimePeriod") in
      make ?nextToken ?maxResults ~dimensions ~timePeriod ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let nextToken = field_map json__ "NextToken" NextToken.of_json in
      let maxResults = field_map json__ "MaxResults" MaxResults.of_json in
      let dimensions =
        field_map_exn json__ "Dimensions" DimensionList.of_json in
      let timePeriod = field_map_exn json__ "TimePeriod" TimePeriod.of_json in
      make ?nextToken ?maxResults ~dimensions ~timePeriod ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Returns the possible dimension values available for a customer's account. We recommend using pagination to ensure that the operation returns quickly and successfully."]