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
(* 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.sagemaker_edge
let apiVersion = "2020-09-23"
let endpointPrefix = "edge.sagemaker"
let serviceFullName = "Amazon Sagemaker Edge Manager"
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 ChecksumString =
  struct
    type nonrec t = string
    let context_ = "ChecksumString"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:63) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-z0-9](-*[a-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:"ChecksumString" j
    let to_json = simple_to_json to_value
  end
module ChecksumType =
  struct
    type nonrec t =
      | SHA1 
      | Non_static_id of string 
    let make i = i
    let to_string = function | SHA1 -> "SHA1" | Non_static_id s -> s
    let of_string = function | "SHA1" -> SHA1 | 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 ChecksumType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"ChecksumType" j)
    let to_json = simple_to_json to_value
  end
module Dimension =
  struct
    type nonrec t = string
    let context_ = "Dimension"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:1000) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"^[a-zA-Z0-9](-*[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:"Dimension" j
    let to_json = simple_to_json to_value
  end
module Metric =
  struct
    type nonrec t = string
    let context_ = "Metric"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:100) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-zA-Z0-9](-*[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:"Metric" 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 Value =
  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 Checksum =
  struct
    type nonrec t =
      {
      type_: ChecksumType.t option [@ocaml.doc "The type of the checksum."];
      sum: ChecksumString.t option [@ocaml.doc "The checksum of the model."]}
    let make ?type_ = fun ?sum -> fun () -> { type_; sum }
    let to_value x =
      structure_to_value
        [("Type", (Option.map x.type_ ~f:ChecksumType.to_value));
        ("Sum", (Option.map x.sum ~f:ChecksumString.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let sum =
        (Option.map ~f:ChecksumString.of_xml) (Xml.child xml_arg0 "Sum") in
      let type_ =
        (Option.map ~f:ChecksumType.of_xml) (Xml.child xml_arg0 "Type") in
      make ?sum ?type_ ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let sum = field_map json__ "Sum" ChecksumString.of_json in
      let type_ = field_map json__ "Type" ChecksumType.of_json in
      make ?sum ?type_ ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about the checksum of a model deployed on a device."]
module EntityName =
  struct
    type nonrec t = string
    let context_ = "EntityName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:63) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-zA-Z0-9](-*[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:"EntityName" j
    let to_json = simple_to_json to_value
  end
module ModelState =
  struct
    type nonrec t =
      | DEPLOY 
      | UNDEPLOY 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | DEPLOY -> "DEPLOY"
      | UNDEPLOY -> "UNDEPLOY"
      | Non_static_id s -> s
    let of_string =
      function
      | "DEPLOY" -> DEPLOY
      | "UNDEPLOY" -> UNDEPLOY
      | 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 ModelState" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"ModelState" j)
    let to_json = simple_to_json to_value
  end
module S3Uri =
  struct
    type nonrec t = string
    let context_ = "S3Uri"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:1024) >>=
             (fun () -> check_pattern i ~pattern:"^s3://([^/]+)/?(.*)$"));
        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:"S3Uri" j
    let to_json = simple_to_json to_value
  end
module DeploymentStatus =
  struct
    type nonrec t =
      | SUCCESS 
      | FAIL 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function | SUCCESS -> "SUCCESS" | FAIL -> "FAIL" | Non_static_id s -> s
    let of_string =
      function | "SUCCESS" -> SUCCESS | "FAIL" -> FAIL | 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 DeploymentStatus" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DeploymentStatus" j)
    let to_json = simple_to_json to_value
  end
module ModelName =
  struct
    type nonrec t = string
    let context_ = "ModelName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:4) >>=
             (fun () ->
                (check_string_max i ~max:255) >>=
                  (fun () ->
                     check_pattern i ~pattern:"^[a-zA-Z0-9](-*[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:"ModelName" 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 Version =
  struct
    type nonrec t = string
    let context_ = "Version"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:64) >>=
                  (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:"Version" j
    let to_json = simple_to_json to_value
  end
module EdgeMetric =
  struct
    type nonrec t =
      {
      dimension: Dimension.t option
        [@ocaml.doc "The dimension of metrics published."];
      metricName: Metric.t option
        [@ocaml.doc "Returns the name of the metric."];
      value: Value.t option [@ocaml.doc "Returns the value of the metric."];
      timestamp: Timestamp.t option
        [@ocaml.doc "Timestamp of when the metric was requested."]}
    let make ?dimension =
      fun ?metricName ->
        fun ?value ->
          fun ?timestamp ->
            fun () -> { dimension; metricName; value; timestamp }
    let to_value x =
      structure_to_value
        [("Dimension", (Option.map x.dimension ~f:Dimension.to_value));
        ("MetricName", (Option.map x.metricName ~f:Metric.to_value));
        ("Value", (Option.map x.value ~f:Value.to_value));
        ("Timestamp", (Option.map x.timestamp ~f:Timestamp.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let timestamp =
        (Option.map ~f:Timestamp.of_xml) (Xml.child xml_arg0 "Timestamp") in
      let value = (Option.map ~f:Value.of_xml) (Xml.child xml_arg0 "Value") in
      let metricName =
        (Option.map ~f:Metric.of_xml) (Xml.child xml_arg0 "MetricName") in
      let dimension =
        (Option.map ~f:Dimension.of_xml) (Xml.child xml_arg0 "Dimension") in
      make ?timestamp ?value ?metricName ?dimension ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let timestamp = field_map json__ "Timestamp" Timestamp.of_json in
      let value = field_map json__ "Value" Value.of_json in
      let metricName = field_map json__ "MetricName" Metric.of_json in
      let dimension = field_map json__ "Dimension" Dimension.of_json in
      make ?timestamp ?value ?metricName ?dimension ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Information required for edge device metrics."]
module Definition =
  struct
    type nonrec t =
      {
      modelHandle: EntityName.t option
        [@ocaml.doc "The unique model handle."];
      s3Url: S3Uri.t option
        [@ocaml.doc "The absolute S3 location of the model."];
      checksum: Checksum.t option
        [@ocaml.doc "The checksum information of the model."];
      state: ModelState.t option
        [@ocaml.doc "The desired state of the model."]}
    let make ?modelHandle =
      fun ?s3Url ->
        fun ?checksum ->
          fun ?state -> fun () -> { modelHandle; s3Url; checksum; state }
    let to_value x =
      structure_to_value
        [("ModelHandle", (Option.map x.modelHandle ~f:EntityName.to_value));
        ("S3Url", (Option.map x.s3Url ~f:S3Uri.to_value));
        ("Checksum", (Option.map x.checksum ~f:Checksum.to_value));
        ("State", (Option.map x.state ~f:ModelState.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let state =
        (Option.map ~f:ModelState.of_xml) (Xml.child xml_arg0 "State") in
      let checksum =
        (Option.map ~f:Checksum.of_xml) (Xml.child xml_arg0 "Checksum") in
      let s3Url = (Option.map ~f:S3Uri.of_xml) (Xml.child xml_arg0 "S3Url") in
      let modelHandle =
        (Option.map ~f:EntityName.of_xml) (Xml.child xml_arg0 "ModelHandle") in
      make ?state ?checksum ?s3Url ?modelHandle ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let state = field_map json__ "State" ModelState.of_json in
      let checksum = field_map json__ "Checksum" Checksum.of_json in
      let s3Url = field_map json__ "S3Url" S3Uri.of_json in
      let modelHandle = field_map json__ "ModelHandle" EntityName.of_json in
      make ?state ?checksum ?s3Url ?modelHandle ()
    let to_json v = composed_to_json to_value v
  end
module DeploymentModel =
  struct
    type nonrec t =
      {
      modelHandle: EntityName.t option
        [@ocaml.doc "The unique handle of the model."];
      modelName: ModelName.t option [@ocaml.doc "The name of the model."];
      modelVersion: Version.t option [@ocaml.doc "The version of the model."];
      desiredState: ModelState.t option
        [@ocaml.doc "The desired state of the model."];
      state: ModelState.t option
        [@ocaml.doc "Returns the current state of the model."];
      status: DeploymentStatus.t option
        [@ocaml.doc "Returns the deployment status of the model."];
      statusReason: String_.t option
        [@ocaml.doc
          "Returns the error message for the deployment status result."];
      rollbackFailureReason: String_.t option
        [@ocaml.doc "Returns the error message if there is a rollback."]}
    let make ?modelHandle =
      fun ?modelName ->
        fun ?modelVersion ->
          fun ?desiredState ->
            fun ?state ->
              fun ?status ->
                fun ?statusReason ->
                  fun ?rollbackFailureReason ->
                    fun () ->
                      {
                        modelHandle;
                        modelName;
                        modelVersion;
                        desiredState;
                        state;
                        status;
                        statusReason;
                        rollbackFailureReason
                      }
    let to_value x =
      structure_to_value
        [("ModelHandle", (Option.map x.modelHandle ~f:EntityName.to_value));
        ("ModelName", (Option.map x.modelName ~f:ModelName.to_value));
        ("ModelVersion", (Option.map x.modelVersion ~f:Version.to_value));
        ("DesiredState", (Option.map x.desiredState ~f:ModelState.to_value));
        ("State", (Option.map x.state ~f:ModelState.to_value));
        ("Status", (Option.map x.status ~f:DeploymentStatus.to_value));
        ("StatusReason", (Option.map x.statusReason ~f:String_.to_value));
        ("RollbackFailureReason",
          (Option.map x.rollbackFailureReason ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let rollbackFailureReason =
        (Option.map ~f:String_.of_xml)
          (Xml.child xml_arg0 "RollbackFailureReason") in
      let statusReason =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "StatusReason") in
      let status =
        (Option.map ~f:DeploymentStatus.of_xml) (Xml.child xml_arg0 "Status") in
      let state =
        (Option.map ~f:ModelState.of_xml) (Xml.child xml_arg0 "State") in
      let desiredState =
        (Option.map ~f:ModelState.of_xml) (Xml.child xml_arg0 "DesiredState") in
      let modelVersion =
        (Option.map ~f:Version.of_xml) (Xml.child xml_arg0 "ModelVersion") in
      let modelName =
        (Option.map ~f:ModelName.of_xml) (Xml.child xml_arg0 "ModelName") in
      let modelHandle =
        (Option.map ~f:EntityName.of_xml) (Xml.child xml_arg0 "ModelHandle") in
      make ?rollbackFailureReason ?statusReason ?status ?state ?desiredState
        ?modelVersion ?modelName ?modelHandle ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let rollbackFailureReason =
        field_map json__ "RollbackFailureReason" String_.of_json in
      let statusReason = field_map json__ "StatusReason" String_.of_json in
      let status = field_map json__ "Status" DeploymentStatus.of_json in
      let state = field_map json__ "State" ModelState.of_json in
      let desiredState = field_map json__ "DesiredState" ModelState.of_json in
      let modelVersion = field_map json__ "ModelVersion" Version.of_json in
      let modelName = field_map json__ "ModelName" ModelName.of_json in
      let modelHandle = field_map json__ "ModelHandle" EntityName.of_json in
      make ?rollbackFailureReason ?statusReason ?status ?state ?desiredState
        ?modelVersion ?modelName ?modelHandle ()
    let to_json v = composed_to_json to_value v
  end
module EdgeMetrics =
  struct
    type nonrec t = EdgeMetric.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:EdgeMetric.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:EdgeMetric.of_xml)
    let of_json j =
      list_of_json ~kind:"EdgeMetrics" ~of_json:EdgeMetric.of_json j
    let to_json v = composed_to_json to_value v
  end
module Definitions =
  struct
    type nonrec t = Definition.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:Definition.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:Definition.of_xml)
    let of_json j =
      list_of_json ~kind:"Definitions" ~of_json:Definition.of_json j
    let to_json v = composed_to_json to_value v
  end
module DeploymentType =
  struct
    type nonrec t =
      | Model 
      | Non_static_id of string 
    let make i = i
    let to_string = function | Model -> "Model" | Non_static_id s -> s
    let of_string = function | "Model" -> Model | 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 DeploymentType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DeploymentType" j)
    let to_json = simple_to_json to_value
  end
module FailureHandlingPolicy =
  struct
    type nonrec t =
      | ROLLBACK_ON_FAILURE 
      | DO_NOTHING 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | ROLLBACK_ON_FAILURE -> "ROLLBACK_ON_FAILURE"
      | DO_NOTHING -> "DO_NOTHING"
      | Non_static_id s -> s
    let of_string =
      function
      | "ROLLBACK_ON_FAILURE" -> ROLLBACK_ON_FAILURE
      | "DO_NOTHING" -> DO_NOTHING
      | 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 FailureHandlingPolicy" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"FailureHandlingPolicy" j)
    let to_json = simple_to_json to_value
  end
module DeploymentModels =
  struct
    type nonrec t = DeploymentModel.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:DeploymentModel.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:DeploymentModel.of_xml)
    let of_json j =
      list_of_json ~kind:"DeploymentModels" ~of_json:DeploymentModel.of_json
        j
    let to_json v = composed_to_json to_value v
  end
module Model =
  struct
    type nonrec t =
      {
      modelName: ModelName.t option [@ocaml.doc "The name of the model."];
      modelVersion: Version.t option [@ocaml.doc "The version of the model."];
      latestSampleTime: Timestamp.t option
        [@ocaml.doc "The timestamp of the last data sample taken."];
      latestInference: Timestamp.t option
        [@ocaml.doc "The timestamp of the last inference that was made."];
      modelMetrics: EdgeMetrics.t option
        [@ocaml.doc "Information required for model metrics."]}
    let make ?modelName =
      fun ?modelVersion ->
        fun ?latestSampleTime ->
          fun ?latestInference ->
            fun ?modelMetrics ->
              fun () ->
                {
                  modelName;
                  modelVersion;
                  latestSampleTime;
                  latestInference;
                  modelMetrics
                }
    let to_value x =
      structure_to_value
        [("ModelName", (Option.map x.modelName ~f:ModelName.to_value));
        ("ModelVersion", (Option.map x.modelVersion ~f:Version.to_value));
        ("LatestSampleTime",
          (Option.map x.latestSampleTime ~f:Timestamp.to_value));
        ("LatestInference",
          (Option.map x.latestInference ~f:Timestamp.to_value));
        ("ModelMetrics", (Option.map x.modelMetrics ~f:EdgeMetrics.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let modelMetrics =
        (Option.map ~f:EdgeMetrics.of_xml)
          (Xml.child xml_arg0 "ModelMetrics") in
      let latestInference =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "LatestInference") in
      let latestSampleTime =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "LatestSampleTime") in
      let modelVersion =
        (Option.map ~f:Version.of_xml) (Xml.child xml_arg0 "ModelVersion") in
      let modelName =
        (Option.map ~f:ModelName.of_xml) (Xml.child xml_arg0 "ModelName") in
      make ?modelMetrics ?latestInference ?latestSampleTime ?modelVersion
        ?modelName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let modelMetrics = field_map json__ "ModelMetrics" EdgeMetrics.of_json in
      let latestInference =
        field_map json__ "LatestInference" Timestamp.of_json in
      let latestSampleTime =
        field_map json__ "LatestSampleTime" Timestamp.of_json in
      let modelVersion = field_map json__ "ModelVersion" Version.of_json in
      let modelName = field_map json__ "ModelName" ModelName.of_json in
      make ?modelMetrics ?latestInference ?latestSampleTime ?modelVersion
        ?modelName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about a model deployed on an edge device that is registered with SageMaker Edge Manager."]
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 EdgeDeployment =
  struct
    type nonrec t =
      {
      deploymentName: EntityName.t option
        [@ocaml.doc "The name and unique ID of the deployment."];
      type_: DeploymentType.t option
        [@ocaml.doc "The type of the deployment."];
      failureHandlingPolicy: FailureHandlingPolicy.t option
        [@ocaml.doc
          "Determines whether to rollback to previous configuration if deployment fails."];
      definitions: Definitions.t option
        [@ocaml.doc "Returns a list of Definition objects."]}
    let make ?deploymentName =
      fun ?type_ ->
        fun ?failureHandlingPolicy ->
          fun ?definitions ->
            fun () ->
              { deploymentName; type_; failureHandlingPolicy; definitions }
    let to_value x =
      structure_to_value
        [("DeploymentName",
           (Option.map x.deploymentName ~f:EntityName.to_value));
        ("Type", (Option.map x.type_ ~f:DeploymentType.to_value));
        ("FailureHandlingPolicy",
          (Option.map x.failureHandlingPolicy
             ~f:FailureHandlingPolicy.to_value));
        ("Definitions", (Option.map x.definitions ~f:Definitions.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let definitions =
        (Option.map ~f:Definitions.of_xml) (Xml.child xml_arg0 "Definitions") in
      let failureHandlingPolicy =
        (Option.map ~f:FailureHandlingPolicy.of_xml)
          (Xml.child xml_arg0 "FailureHandlingPolicy") in
      let type_ =
        (Option.map ~f:DeploymentType.of_xml) (Xml.child xml_arg0 "Type") in
      let deploymentName =
        (Option.map ~f:EntityName.of_xml)
          (Xml.child xml_arg0 "DeploymentName") in
      make ?definitions ?failureHandlingPolicy ?type_ ?deploymentName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let definitions = field_map json__ "Definitions" Definitions.of_json in
      let failureHandlingPolicy =
        field_map json__ "FailureHandlingPolicy"
          FailureHandlingPolicy.of_json in
      let type_ = field_map json__ "Type" DeploymentType.of_json in
      let deploymentName =
        field_map json__ "DeploymentName" EntityName.of_json in
      make ?definitions ?failureHandlingPolicy ?type_ ?deploymentName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about a deployment on an edge device that is registered with SageMaker Edge Manager."]
module DeploymentResult =
  struct
    type nonrec t =
      {
      deploymentName: EntityName.t option
        [@ocaml.doc "The name and unique ID of the deployment."];
      deploymentStatus: EntityName.t option
        [@ocaml.doc "Returns the bucket error code."];
      deploymentStatusMessage: String_.t option
        [@ocaml.doc "Returns the detailed error message."];
      deploymentStartTime: Timestamp.t option
        [@ocaml.doc
          "The timestamp of when the deployment was started on the agent."];
      deploymentEndTime: Timestamp.t option
        [@ocaml.doc
          "The timestamp of when the deployment was ended, and the agent got the deployment results."];
      deploymentModels: DeploymentModels.t option
        [@ocaml.doc "Returns a list of models deployed on the agent."]}
    let make ?deploymentName =
      fun ?deploymentStatus ->
        fun ?deploymentStatusMessage ->
          fun ?deploymentStartTime ->
            fun ?deploymentEndTime ->
              fun ?deploymentModels ->
                fun () ->
                  {
                    deploymentName;
                    deploymentStatus;
                    deploymentStatusMessage;
                    deploymentStartTime;
                    deploymentEndTime;
                    deploymentModels
                  }
    let to_value x =
      structure_to_value
        [("DeploymentName",
           (Option.map x.deploymentName ~f:EntityName.to_value));
        ("DeploymentStatus",
          (Option.map x.deploymentStatus ~f:EntityName.to_value));
        ("DeploymentStatusMessage",
          (Option.map x.deploymentStatusMessage ~f:String_.to_value));
        ("DeploymentStartTime",
          (Option.map x.deploymentStartTime ~f:Timestamp.to_value));
        ("DeploymentEndTime",
          (Option.map x.deploymentEndTime ~f:Timestamp.to_value));
        ("DeploymentModels",
          (Option.map x.deploymentModels ~f:DeploymentModels.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deploymentModels =
        (Option.map ~f:DeploymentModels.of_xml)
          (Xml.child xml_arg0 "DeploymentModels") in
      let deploymentEndTime =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "DeploymentEndTime") in
      let deploymentStartTime =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "DeploymentStartTime") in
      let deploymentStatusMessage =
        (Option.map ~f:String_.of_xml)
          (Xml.child xml_arg0 "DeploymentStatusMessage") in
      let deploymentStatus =
        (Option.map ~f:EntityName.of_xml)
          (Xml.child xml_arg0 "DeploymentStatus") in
      let deploymentName =
        (Option.map ~f:EntityName.of_xml)
          (Xml.child xml_arg0 "DeploymentName") in
      make ?deploymentModels ?deploymentEndTime ?deploymentStartTime
        ?deploymentStatusMessage ?deploymentStatus ?deploymentName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deploymentModels =
        field_map json__ "DeploymentModels" DeploymentModels.of_json in
      let deploymentEndTime =
        field_map json__ "DeploymentEndTime" Timestamp.of_json in
      let deploymentStartTime =
        field_map json__ "DeploymentStartTime" Timestamp.of_json in
      let deploymentStatusMessage =
        field_map json__ "DeploymentStatusMessage" String_.of_json in
      let deploymentStatus =
        field_map json__ "DeploymentStatus" EntityName.of_json in
      let deploymentName =
        field_map json__ "DeploymentName" EntityName.of_json in
      make ?deploymentModels ?deploymentEndTime ?deploymentStartTime
        ?deploymentStatusMessage ?deploymentStatus ?deploymentName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Information about the result of a deployment on an edge device that is registered with SageMaker Edge Manager."]
module DeviceFleetName =
  struct
    type nonrec t = string
    let context_ = "DeviceFleetName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:63) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"^[a-zA-Z0-9](-*_*[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:"DeviceFleetName" j
    let to_json = simple_to_json to_value
  end
module DeviceName =
  struct
    type nonrec t = string
    let context_ = "DeviceName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:63) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"^[a-zA-Z0-9](-*_*[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:"DeviceName" j
    let to_json = simple_to_json to_value
  end
module Models =
  struct
    type nonrec t = Model.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:Model.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:Model.of_xml)
    let of_json j = list_of_json ~kind:"Models" ~of_json:Model.of_json j
    let to_json v = composed_to_json to_value v
  end
module CacheTTLSeconds =
  struct
    type nonrec t = string
    let context_ = "CacheTTLSeconds"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:1000) >>=
             (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:"CacheTTLSeconds" j
    let to_json = simple_to_json to_value
  end
module DeviceRegistration =
  struct
    type nonrec t = string
    let context_ = "DeviceRegistration"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:1000) >>=
             (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:"DeviceRegistration" j
    let to_json = simple_to_json to_value
  end
module InternalServiceException =
  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 failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support."]
module EdgeDeployments =
  struct
    type nonrec t = EdgeDeployment.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:EdgeDeployment.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:EdgeDeployment.of_xml)
    let of_json j =
      list_of_json ~kind:"EdgeDeployments" ~of_json:EdgeDeployment.of_json j
    let to_json v = composed_to_json to_value v
  end
module SendHeartbeatRequest =
  struct
    type nonrec t =
      {
      agentMetrics: EdgeMetrics.t option
        [@ocaml.doc
          "For internal use. Returns a list of SageMaker Edge Manager agent operating metrics."];
      models: Models.t option
        [@ocaml.doc "Returns a list of models deployed on the the device."];
      agentVersion: Version.t
        [@ocaml.doc "Returns the version of the agent."];
      deviceName: DeviceName.t [@ocaml.doc "The unique name of the device."];
      deviceFleetName: DeviceFleetName.t
        [@ocaml.doc "The name of the fleet that the device belongs to."];
      deploymentResult: DeploymentResult.t option
        [@ocaml.doc "Returns the result of a deployment on the device."]}
    let context_ = "SendHeartbeatRequest"
    let make ?agentMetrics =
      fun ?models ->
        fun ?deploymentResult ->
          fun ~agentVersion ->
            fun ~deviceName ->
              fun ~deviceFleetName ->
                fun () ->
                  {
                    agentMetrics;
                    models;
                    deploymentResult;
                    agentVersion;
                    deviceName;
                    deviceFleetName
                  }
    let to_value x =
      structure_to_value
        [("AgentMetrics",
           (Option.map x.agentMetrics ~f:EdgeMetrics.to_value));
        ("Models", (Option.map x.models ~f:Models.to_value));
        ("AgentVersion", (Some (Version.to_value x.agentVersion)));
        ("DeviceName", (Some (DeviceName.to_value x.deviceName)));
        ("DeviceFleetName",
          (Some (DeviceFleetName.to_value x.deviceFleetName)));
        ("DeploymentResult",
          (Option.map x.deploymentResult ~f:DeploymentResult.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deploymentResult =
        (Option.map ~f:DeploymentResult.of_xml)
          (Xml.child xml_arg0 "DeploymentResult") in
      let deviceFleetName =
        DeviceFleetName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceFleetName") in
      let deviceName =
        DeviceName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceName") in
      let agentVersion =
        Version.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "AgentVersion") in
      let models =
        (Option.map ~f:Models.of_xml) (Xml.child xml_arg0 "Models") in
      let agentMetrics =
        (Option.map ~f:EdgeMetrics.of_xml)
          (Xml.child xml_arg0 "AgentMetrics") in
      make ?deploymentResult ~deviceFleetName ~deviceName ~agentVersion
        ?models ?agentMetrics ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deploymentResult =
        field_map json__ "DeploymentResult" DeploymentResult.of_json in
      let deviceFleetName =
        field_map_exn json__ "DeviceFleetName" DeviceFleetName.of_json in
      let deviceName = field_map_exn json__ "DeviceName" DeviceName.of_json in
      let agentVersion = field_map_exn json__ "AgentVersion" Version.of_json in
      let models = field_map json__ "Models" Models.of_json in
      let agentMetrics = field_map json__ "AgentMetrics" EdgeMetrics.of_json in
      make ?deploymentResult ~deviceFleetName ~deviceName ~agentVersion
        ?models ?agentMetrics ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Use to get the current status of devices registered on SageMaker Edge Manager."]
module GetDeviceRegistrationResult =
  struct
    type nonrec t =
      {
      deviceRegistration: DeviceRegistration.t option
        [@ocaml.doc
          "Describes if the device is currently registered with SageMaker Edge Manager."];
      cacheTTL: CacheTTLSeconds.t option
        [@ocaml.doc
          "The amount of time, in seconds, that the registration status is stored on the device\226\128\153s cache before it is refreshed."]}
    type nonrec error =
      [ `InternalServiceException of InternalServiceException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?deviceRegistration =
      fun ?cacheTTL -> fun () -> { deviceRegistration; cacheTTL }
    let error_of_json name json =
      match name with
      | "InternalServiceException" ->
          `InternalServiceException (InternalServiceException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "InternalServiceException" ->
          `InternalServiceException (InternalServiceException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `InternalServiceException e ->
          `Assoc
            [("error", (`String "InternalServiceException"));
            ("details", (InternalServiceException.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
        [("DeviceRegistration",
           (Option.map x.deviceRegistration ~f:DeviceRegistration.to_value));
        ("CacheTTL", (Option.map x.cacheTTL ~f:CacheTTLSeconds.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let cacheTTL =
        (Option.map ~f:CacheTTLSeconds.of_xml)
          (Xml.child xml_arg0 "CacheTTL") in
      let deviceRegistration =
        (Option.map ~f:DeviceRegistration.of_xml)
          (Xml.child xml_arg0 "DeviceRegistration") in
      make ?cacheTTL ?deviceRegistration ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let cacheTTL = field_map json__ "CacheTTL" CacheTTLSeconds.of_json in
      let deviceRegistration =
        field_map json__ "DeviceRegistration" DeviceRegistration.of_json in
      make ?cacheTTL ?deviceRegistration ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Use to check if a device is registered with SageMaker Edge Manager."]
module GetDeviceRegistrationRequest =
  struct
    type nonrec t =
      {
      deviceName: DeviceName.t
        [@ocaml.doc
          "The unique name of the device you want to get the registration status from."];
      deviceFleetName: DeviceFleetName.t
        [@ocaml.doc "The name of the fleet that the device belongs to."]}
    let context_ = "GetDeviceRegistrationRequest"
    let make ~deviceName =
      fun ~deviceFleetName -> fun () -> { deviceName; deviceFleetName }
    let to_value x =
      structure_to_value
        [("DeviceName", (Some (DeviceName.to_value x.deviceName)));
        ("DeviceFleetName",
          (Some (DeviceFleetName.to_value x.deviceFleetName)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deviceFleetName =
        DeviceFleetName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceFleetName") in
      let deviceName =
        DeviceName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceName") in
      make ~deviceFleetName ~deviceName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deviceFleetName =
        field_map_exn json__ "DeviceFleetName" DeviceFleetName.of_json in
      let deviceName = field_map_exn json__ "DeviceName" DeviceName.of_json in
      make ~deviceFleetName ~deviceName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Use to check if a device is registered with SageMaker Edge Manager."]
module GetDeploymentsResult =
  struct
    type nonrec t =
      {
      deployments: EdgeDeployments.t option
        [@ocaml.doc
          "Returns a list of the configurations of the active deployments on the device."]}
    type nonrec error =
      [ `InternalServiceException of InternalServiceException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?deployments = fun () -> { deployments }
    let error_of_json name json =
      match name with
      | "InternalServiceException" ->
          `InternalServiceException (InternalServiceException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "InternalServiceException" ->
          `InternalServiceException (InternalServiceException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `InternalServiceException e ->
          `Assoc
            [("error", (`String "InternalServiceException"));
            ("details", (InternalServiceException.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
        [("Deployments",
           (Option.map x.deployments ~f:EdgeDeployments.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deployments =
        (Option.map ~f:EdgeDeployments.of_xml)
          (Xml.child xml_arg0 "Deployments") in
      make ?deployments ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deployments =
        field_map json__ "Deployments" EdgeDeployments.of_json in
      make ?deployments ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Use to get the active deployments from a device."]
module GetDeploymentsRequest =
  struct
    type nonrec t =
      {
      deviceName: DeviceName.t
        [@ocaml.doc
          "The unique name of the device you want to get the configuration of active deployments from."];
      deviceFleetName: DeviceFleetName.t
        [@ocaml.doc "The name of the fleet that the device belongs to."]}
    let context_ = "GetDeploymentsRequest"
    let make ~deviceName =
      fun ~deviceFleetName -> fun () -> { deviceName; deviceFleetName }
    let to_value x =
      structure_to_value
        [("DeviceName", (Some (DeviceName.to_value x.deviceName)));
        ("DeviceFleetName",
          (Some (DeviceFleetName.to_value x.deviceFleetName)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let deviceFleetName =
        DeviceFleetName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceFleetName") in
      let deviceName =
        DeviceName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "DeviceName") in
      make ~deviceFleetName ~deviceName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let deviceFleetName =
        field_map_exn json__ "DeviceFleetName" DeviceFleetName.of_json in
      let deviceName = field_map_exn json__ "DeviceName" DeviceName.of_json in
      make ~deviceFleetName ~deviceName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Use to get the active deployments from a device."]