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
(* 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.appconfigdata
let apiVersion = "2021-11-11"
let endpointPrefix = "appconfigdata"
let serviceFullName = "AWS AppConfig Data"
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 InvalidParameterProblem =
  struct
    type nonrec t =
      | Corrupted 
      | Expired 
      | PollIntervalNotSatisfied 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Corrupted -> "Corrupted"
      | Expired -> "Expired"
      | PollIntervalNotSatisfied -> "PollIntervalNotSatisfied"
      | Non_static_id s -> s
    let of_string =
      function
      | "Corrupted" -> Corrupted
      | "Expired" -> Expired
      | "PollIntervalNotSatisfied" -> PollIntervalNotSatisfied
      | 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 InvalidParameterProblem" xml_arg0)
    let of_json j =
      of_string (string_of_json ~kind:"InvalidParameterProblem" j)
    let to_json = simple_to_json to_value
  end
module InvalidParameterDetail =
  struct
    type nonrec t =
      {
      problem: InvalidParameterProblem.t option
        [@ocaml.doc "The reason the parameter is invalid."]}
    let make ?problem = fun () -> { problem }
    let to_value x =
      structure_to_value
        [("Problem",
           (Option.map x.problem ~f:InvalidParameterProblem.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let problem =
        (Option.map ~f:InvalidParameterProblem.of_xml)
          (Xml.child xml_arg0 "Problem") in
      make ?problem ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let problem =
        field_map json__ "Problem" InvalidParameterProblem.of_json in
      make ?problem ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Information about an invalid parameter."]
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 InvalidParameterMap =
  struct
    type nonrec t = (String_.t * InvalidParameterDetail.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 String InvalidParameterDetail"))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.to_value x) |>
                    (fun x ->
                       (InvalidParameterDetail.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:String_.of_string
        ~of_json:InvalidParameterDetail.of_json j
    let to_json v = composed_to_json to_value v
  end
module BadRequestDetails =
  struct
    type nonrec t =
      {
      invalidParameters: InvalidParameterMap.t option
        [@ocaml.doc
          "One or more specified parameters are not valid for the call."]}
    let make ?invalidParameters = fun () -> { invalidParameters }
    let to_value x =
      structure_to_value
        [("InvalidParameters",
           (Option.map x.invalidParameters ~f:InvalidParameterMap.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let invalidParameters =
        (Option.map ~f:InvalidParameterMap.of_xml)
          (Xml.child xml_arg0 "InvalidParameters") in
      make ?invalidParameters ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let invalidParameters =
        field_map json__ "InvalidParameters" InvalidParameterMap.of_json in
      make ?invalidParameters ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Detailed information about the input that failed to satisfy the constraints specified by a call."]
module BadRequestReason =
  struct
    type nonrec t =
      | InvalidParameters 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | InvalidParameters -> "InvalidParameters"
      | Non_static_id s -> s
    let of_string =
      function
      | "InvalidParameters" -> InvalidParameters
      | 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 BadRequestReason" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"BadRequestReason" j)
    let to_json = simple_to_json to_value
  end
module ResourceType =
  struct
    type nonrec t =
      | Application 
      | ConfigurationProfile 
      | Deployment 
      | Environment 
      | Configuration 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Application -> "Application"
      | ConfigurationProfile -> "ConfigurationProfile"
      | Deployment -> "Deployment"
      | Environment -> "Environment"
      | Configuration -> "Configuration"
      | Non_static_id s -> s
    let of_string =
      function
      | "Application" -> Application
      | "ConfigurationProfile" -> ConfigurationProfile
      | "Deployment" -> Deployment
      | "Environment" -> Environment
      | "Configuration" -> Configuration
      | 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 ResourceType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"ResourceType" j)
    let to_json = simple_to_json to_value
  end
module StringMap =
  struct
    type nonrec t = (String_.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 ->
                            ((String_.of_string chopped),
                              (String_.of_string v))))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (String_.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:String_.of_string
        ~of_json:String_.of_json j
    let to_json v = composed_to_json to_value v
  end
module BadRequestException =
  struct
    type nonrec t =
      {
      message: String_.t option ;
      reason: BadRequestReason.t option
        [@ocaml.doc "Code indicating the reason the request was invalid."];
      details: BadRequestDetails.t option
        [@ocaml.doc "Details describing why the request was invalid."]}
    let make ?message =
      fun ?reason -> fun ?details -> fun () -> { message; reason; details }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:String_.to_value));
        ("Reason", (Option.map x.reason ~f:BadRequestReason.to_value));
        ("Details", (Option.map x.details ~f:BadRequestDetails.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let details =
        (Option.map ~f:BadRequestDetails.of_xml)
          (Xml.child xml_arg0 "Details") in
      let reason =
        (Option.map ~f:BadRequestReason.of_xml) (Xml.child xml_arg0 "Reason") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      make ?details ?reason ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let details = field_map json__ "Details" BadRequestDetails.of_json in
      let reason = field_map json__ "Reason" BadRequestReason.of_json in
      let message = field_map json__ "Message" String_.of_json in
      make ?details ?reason ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The input fails to satisfy the constraints specified by the service."]
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 "There was an internal failure in the service."]
module ResourceNotFoundException =
  struct
    type nonrec t =
      {
      message: String_.t option ;
      resourceType: ResourceType.t option
        [@ocaml.doc "The type of resource that was not found."];
      referencedBy: StringMap.t option
        [@ocaml.doc
          "A map indicating which parameters in the request reference the resource that was not found."]}
    let make ?message =
      fun ?resourceType ->
        fun ?referencedBy ->
          fun () -> { message; resourceType; referencedBy }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:String_.to_value));
        ("ResourceType",
          (Option.map x.resourceType ~f:ResourceType.to_value));
        ("ReferencedBy", (Option.map x.referencedBy ~f:StringMap.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let referencedBy =
        (Option.map ~f:StringMap.of_xml) (Xml.child xml_arg0 "ReferencedBy") in
      let resourceType =
        (Option.map ~f:ResourceType.of_xml)
          (Xml.child xml_arg0 "ResourceType") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Message") in
      make ?referencedBy ?resourceType ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let referencedBy = field_map json__ "ReferencedBy" StringMap.of_json in
      let resourceType = field_map json__ "ResourceType" ResourceType.of_json in
      let message = field_map json__ "Message" String_.of_json in
      make ?referencedBy ?resourceType ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The requested resource could not be found."]
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 Token =
  struct
    type nonrec t = string
    let context_ = "Token"
    let make i =
      let open Result in
        ok_or_failwith (check_pattern i ~pattern:"\\S{1,8192}"); i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"Token" j
    let to_json = simple_to_json to_value
  end
module Identifier =
  struct
    type nonrec t = string
    let context_ = "Identifier"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:128) >>=
             (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:"Identifier" j
    let to_json = simple_to_json to_value
  end
module OptionalPollSeconds =
  struct
    type nonrec t = int
    let make i =
      let open Result in
        ok_or_failwith
          ((check_int_max i ~max:86400) >>=
             (fun () -> check_int_min i ~min:15));
        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 OptionalPollSeconds" 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 Integer =
  struct
    type nonrec t = int
    let make i = i
    let of_string = Int.of_string
    let to_value x = `Integer x
    let to_query v = to_query to_value v
    let to_header x = Int.to_string x
    let of_xml xml_arg0 =
      Int.of_string (string_of_xml ~kind:"an integer for Integer" 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 SensitiveBlob =
  struct
    type nonrec t = string
    let make i = i
    let of_string x = x
    let to_value x = `Blob x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml xml_arg0 = string_of_xml ~kind:"a blob" xml_arg0
    let of_json j = string_of_json ~kind:"a blob" j
    let to_json = simple_to_json to_value
  end
module StartConfigurationSessionResponse =
  struct
    type nonrec t =
      {
      initialConfigurationToken: Token.t option
        [@ocaml.doc
          "Token encapsulating state about the configuration session. Provide this token to the GetLatestConfiguration API to retrieve configuration data. This token should only be used once in your first call to GetLatestConfiguration. You must use the new token in the GetLatestConfiguration response (NextPollConfigurationToken) in each subsequent call to GetLatestConfiguration. The InitialConfigurationToken and NextPollConfigurationToken should only be used once. To support long poll use cases, the tokens are valid for up to 24 hours. If a GetLatestConfiguration call uses an expired token, the system returns BadRequestException."]}
    type nonrec error =
      [ `BadRequestException of BadRequestException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?initialConfigurationToken =
      fun () -> { initialConfigurationToken }
    let error_of_json name json =
      match name with
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `BadRequestException e ->
          `Assoc
            [("error", (`String "BadRequestException"));
            ("details", (BadRequestException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let to_value x =
      structure_to_value
        [("InitialConfigurationToken",
           (Option.map x.initialConfigurationToken ~f:Token.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let initialConfigurationToken =
        (Option.map ~f:Token.of_xml)
          (Xml.child xml_arg0 "InitialConfigurationToken") in
      make ?initialConfigurationToken ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let initialConfigurationToken =
        field_map json__ "InitialConfigurationToken" Token.of_json in
      make ?initialConfigurationToken ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Starts a configuration session used to retrieve a deployed configuration. For more information about this API action and to view example CLI commands that show how to use it with the GetLatestConfiguration API action, see Retrieving the configuration in the AppConfig User Guide."]
module StartConfigurationSessionRequest =
  struct
    type nonrec t =
      {
      applicationIdentifier: Identifier.t
        [@ocaml.doc "The application ID or the application name."];
      environmentIdentifier: Identifier.t
        [@ocaml.doc "The environment ID or the environment name."];
      configurationProfileIdentifier: Identifier.t
        [@ocaml.doc
          "The configuration profile ID or the configuration profile name."];
      requiredMinimumPollIntervalInSeconds: OptionalPollSeconds.t option
        [@ocaml.doc
          "Sets a constraint on a session. If you specify a value of, for example, 60 seconds, then the client that established the session can't call GetLatestConfiguration more frequently than every 60 seconds."]}
    let context_ = "StartConfigurationSessionRequest"
    let make ?requiredMinimumPollIntervalInSeconds =
      fun ~applicationIdentifier ->
        fun ~environmentIdentifier ->
          fun ~configurationProfileIdentifier ->
            fun () ->
              {
                requiredMinimumPollIntervalInSeconds;
                applicationIdentifier;
                environmentIdentifier;
                configurationProfileIdentifier
              }
    let to_value x =
      structure_to_value
        [("ApplicationIdentifier",
           (Some (Identifier.to_value x.applicationIdentifier)));
        ("EnvironmentIdentifier",
          (Some (Identifier.to_value x.environmentIdentifier)));
        ("ConfigurationProfileIdentifier",
          (Some (Identifier.to_value x.configurationProfileIdentifier)));
        ("RequiredMinimumPollIntervalInSeconds",
          (Option.map x.requiredMinimumPollIntervalInSeconds
             ~f:OptionalPollSeconds.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let requiredMinimumPollIntervalInSeconds =
        (Option.map ~f:OptionalPollSeconds.of_xml)
          (Xml.child xml_arg0 "RequiredMinimumPollIntervalInSeconds") in
      let configurationProfileIdentifier =
        Identifier.of_xml
          (Xml.child_exn ~context:context_ xml_arg0
             "ConfigurationProfileIdentifier") in
      let environmentIdentifier =
        Identifier.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "EnvironmentIdentifier") in
      let applicationIdentifier =
        Identifier.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "ApplicationIdentifier") in
      make ?requiredMinimumPollIntervalInSeconds
        ~configurationProfileIdentifier ~environmentIdentifier
        ~applicationIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let requiredMinimumPollIntervalInSeconds =
        field_map json__ "RequiredMinimumPollIntervalInSeconds"
          OptionalPollSeconds.of_json in
      let configurationProfileIdentifier =
        field_map_exn json__ "ConfigurationProfileIdentifier"
          Identifier.of_json in
      let environmentIdentifier =
        field_map_exn json__ "EnvironmentIdentifier" Identifier.of_json in
      let applicationIdentifier =
        field_map_exn json__ "ApplicationIdentifier" Identifier.of_json in
      make ?requiredMinimumPollIntervalInSeconds
        ~configurationProfileIdentifier ~environmentIdentifier
        ~applicationIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Starts a configuration session used to retrieve a deployed configuration. For more information about this API action and to view example CLI commands that show how to use it with the GetLatestConfiguration API action, see Retrieving the configuration in the AppConfig User Guide."]
module GetLatestConfigurationResponse =
  struct
    type nonrec t =
      {
      nextPollConfigurationToken: Token.t option
        [@ocaml.doc
          "The latest token describing the current state of the configuration session. This must be provided to the next call to GetLatestConfiguration. This token should only be used once. To support long poll use cases, the token is valid for up to 24 hours. If a GetLatestConfiguration call uses an expired token, the system returns BadRequestException."];
      nextPollIntervalInSeconds: Integer.t option
        [@ocaml.doc
          "The amount of time the client should wait before polling for configuration updates again. Use RequiredMinimumPollIntervalInSeconds to set the desired poll interval."];
      contentType: String_.t option
        [@ocaml.doc
          "A standard MIME type describing the format of the configuration content."];
      configuration: SensitiveBlob.t option
        [@ocaml.doc
          "The data of the configuration. This may be empty if the client already has the latest version of configuration."];
      versionLabel: String_.t option
        [@ocaml.doc
          "The user-defined label for the AppConfig hosted configuration version. This attribute doesn't apply if the configuration is not from an AppConfig hosted configuration version. If the client already has the latest version of the configuration data, this value is empty."]}
    type nonrec error =
      [ `BadRequestException of BadRequestException.t 
      | `InternalServerException of InternalServerException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?nextPollConfigurationToken =
      fun ?nextPollIntervalInSeconds ->
        fun ?contentType ->
          fun ?configuration ->
            fun ?versionLabel ->
              fun () ->
                {
                  nextPollConfigurationToken;
                  nextPollIntervalInSeconds;
                  contentType;
                  configuration;
                  versionLabel
                }
    let error_of_json name json =
      match name with
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ThrottlingException" ->
          `ThrottlingException (ThrottlingException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `BadRequestException e ->
          `Assoc
            [("error", (`String "BadRequestException"));
            ("details", (BadRequestException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ThrottlingException e ->
          `Assoc
            [("error", (`String "ThrottlingException"));
            ("details", (ThrottlingException.to_json e))]
      | `Unknown_operation_error (code, msg) ->
          `Assoc (("error", (`String code)) ::
            ((match msg with
              | None -> []
              | Some m -> [("message", (`String m))])))
    let of_header_and_body =
      ((fun (xs, pipe) ->
          make
            ?nextPollConfigurationToken:(Option.map
                                           ((List.Assoc.find
                                               ~equal:String.Caseless.equal)
                                              xs
                                              "Next-Poll-Configuration-Token")
                                           ~f:Token.of_string)
            ?nextPollIntervalInSeconds:(Option.map
                                          ((List.Assoc.find
                                              ~equal:String.Caseless.equal)
                                             xs
                                             "Next-Poll-Interval-In-Seconds")
                                          ~f:Integer.of_string)
            ?contentType:(Option.map
                            ((List.Assoc.find ~equal:String.Caseless.equal)
                               xs "Content-Type") ~f:String_.of_string)
            ?configuration:(Some pipe)
            ?versionLabel:(Option.map
                             ((List.Assoc.find ~equal:String.Caseless.equal)
                                xs "Version-Label") ~f:String_.of_string) ())
      [@warning "-27"])
    let to_value x =
      structure_to_value
        [("Next-Poll-Configuration-Token",
           (Option.map x.nextPollConfigurationToken ~f:Token.to_value));
        ("Next-Poll-Interval-In-Seconds",
          (Option.map x.nextPollIntervalInSeconds ~f:Integer.to_value));
        ("Content-Type", (Option.map x.contentType ~f:String_.to_value));
        ("Configuration",
          (Option.map x.configuration ~f:SensitiveBlob.to_value));
        ("Version-Label", (Option.map x.versionLabel ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let versionLabel =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Version-Label") in
      let configuration =
        (Option.map ~f:SensitiveBlob.of_xml)
          (Xml.child xml_arg0 "Configuration") in
      let contentType =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "Content-Type") in
      let nextPollIntervalInSeconds =
        (Option.map ~f:Integer.of_xml)
          (Xml.child xml_arg0 "Next-Poll-Interval-In-Seconds") in
      let nextPollConfigurationToken =
        (Option.map ~f:Token.of_xml)
          (Xml.child xml_arg0 "Next-Poll-Configuration-Token") in
      make ?versionLabel ?configuration ?contentType
        ?nextPollIntervalInSeconds ?nextPollConfigurationToken ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let versionLabel = field_map json__ "VersionLabel" String_.of_json in
      let configuration =
        field_map json__ "Configuration" SensitiveBlob.of_json in
      let contentType = field_map json__ "ContentType" String_.of_json in
      let nextPollIntervalInSeconds =
        field_map json__ "NextPollIntervalInSeconds" Integer.of_json in
      let nextPollConfigurationToken =
        field_map json__ "NextPollConfigurationToken" Token.of_json in
      make ?versionLabel ?configuration ?contentType
        ?nextPollIntervalInSeconds ?nextPollConfigurationToken ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Retrieves the latest deployed configuration. This API may return empty configuration data if the client already has the latest version. For more information about this API action and to view example CLI commands that show how to use it with the StartConfigurationSession API action, see Retrieving the configuration in the AppConfig User Guide. Note the following important information. Each configuration token is only valid for one call to GetLatestConfiguration. The GetLatestConfiguration response includes a NextPollConfigurationToken that should always replace the token used for the just-completed call in preparation for the next one. GetLatestConfiguration is a priced call. For more information, see Pricing."]
module GetLatestConfigurationRequest =
  struct
    type nonrec t =
      {
      configurationToken: Token.t
        [@ocaml.doc
          "Token describing the current state of the configuration session. To obtain a token, first call the StartConfigurationSession API. Note that every call to GetLatestConfiguration will return a new ConfigurationToken (NextPollConfigurationToken in the response) and must be provided to subsequent GetLatestConfiguration API calls. This token should only be used once. To support long poll use cases, the token is valid for up to 24 hours. If a GetLatestConfiguration call uses an expired token, the system returns BadRequestException."]}
    let context_ = "GetLatestConfigurationRequest"
    let make ~configurationToken = fun () -> { configurationToken }
    let to_value x =
      structure_to_value
        [("configuration_token",
           (Some (Token.to_value x.configurationToken)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let configurationToken =
        Token.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "configuration_token") in
      make ~configurationToken ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let configurationToken =
        field_map_exn json__ "ConfigurationToken" Token.of_json in
      make ~configurationToken ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Retrieves the latest deployed configuration. This API may return empty configuration data if the client already has the latest version. For more information about this API action and to view example CLI commands that show how to use it with the StartConfigurationSession API action, see Retrieving the configuration in the AppConfig User Guide. Note the following important information. Each configuration token is only valid for one call to GetLatestConfiguration. The GetLatestConfiguration response includes a NextPollConfigurationToken that should always replace the token used for the just-completed call in preparation for the next one. GetLatestConfiguration is a priced call. For more information, see Pricing."]