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
(* 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.kinesis_video_media
let apiVersion = "2017-09-30"
let endpointPrefix = "kinesisvideo"
let serviceFullName = "Amazon Kinesis Video Streams Media"
let signatureVersion = "v4"
let protocol = "rest_json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let serviceAbbreviation = "Kinesis Video Media"
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 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 ContinuationToken =
  struct
    type nonrec t = string
    let context_ = "ContinuationToken"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:128) >>=
                  (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:"ContinuationToken" j
    let to_json = simple_to_json to_value
  end
module FragmentNumberString =
  struct
    type nonrec t = string
    let context_ = "FragmentNumberString"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:128) >>=
                  (fun () -> check_pattern i ~pattern:"^[0-9]+$")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"FragmentNumberString" j
    let to_json = simple_to_json to_value
  end
module StartSelectorType =
  struct
    type nonrec t =
      | FRAGMENT_NUMBER 
      | SERVER_TIMESTAMP 
      | PRODUCER_TIMESTAMP 
      | NOW 
      | EARLIEST 
      | CONTINUATION_TOKEN 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | FRAGMENT_NUMBER -> "FRAGMENT_NUMBER"
      | SERVER_TIMESTAMP -> "SERVER_TIMESTAMP"
      | PRODUCER_TIMESTAMP -> "PRODUCER_TIMESTAMP"
      | NOW -> "NOW"
      | EARLIEST -> "EARLIEST"
      | CONTINUATION_TOKEN -> "CONTINUATION_TOKEN"
      | Non_static_id s -> s
    let of_string =
      function
      | "FRAGMENT_NUMBER" -> FRAGMENT_NUMBER
      | "SERVER_TIMESTAMP" -> SERVER_TIMESTAMP
      | "PRODUCER_TIMESTAMP" -> PRODUCER_TIMESTAMP
      | "NOW" -> NOW
      | "EARLIEST" -> EARLIEST
      | "CONTINUATION_TOKEN" -> CONTINUATION_TOKEN
      | 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 StartSelectorType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"StartSelectorType" 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 ClientLimitExceededException =
  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
       "Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later."]
module ConnectionLimitExceededException =
  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
       "Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client connections."]
module ContentType =
  struct
    type nonrec t = string
    let context_ = "ContentType"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:128) >>=
                  (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:"ContentType" j
    let to_json = simple_to_json to_value
  end
module InvalidArgumentException =
  struct
    type nonrec t = {
      message: ErrorMessage.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("Message", (Option.map x.message ~f:ErrorMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ErrorMessage.of_xml) (Xml.child xml_arg0 "Message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "Message" ErrorMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The value for this input parameter is invalid."]
module InvalidEndpointException =
  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
       "Status Code: 400, Caller used wrong endpoint to write data to a stream. On receiving such an exception, the user must call GetDataEndpoint with AccessMode set to \"READ\" and use the endpoint Kinesis Video returns in the next GetMedia call."]
module NotAuthorizedException =
  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
       "Status Code: 403, The caller is not authorized to perform an operation on the given stream, or the token has expired."]
module Payload =
  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 ResourceNotFoundException =
  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
       "Status Code: 404, The stream with the given name does not exist."]
module ResourceARN =
  struct
    type nonrec t = string
    let context_ = "ResourceARN"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:1024) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"arn:aws:kinesisvideo:[a-z0-9-]+:[0-9]+:[a-z]+/[a-zA-Z0-9_.-]+/[0-9]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"ResourceARN" j
    let to_json = simple_to_json to_value
  end
module StartSelector =
  struct
    type nonrec t =
      {
      startSelectorType: StartSelectorType.t
        [@ocaml.doc
          "Identifies the fragment on the Kinesis video stream where you want to start getting the data from. NOW - Start with the latest chunk on the stream. EARLIEST - Start with earliest available chunk on the stream. FRAGMENT_NUMBER - Start with the chunk after a specific fragment. You must also specify the AfterFragmentNumber parameter. PRODUCER_TIMESTAMP or SERVER_TIMESTAMP - Start with the chunk containing a fragment with the specified producer or server timestamp. You specify the timestamp by adding StartTimestamp. CONTINUATION_TOKEN - Read using the specified continuation token. If you choose the NOW, EARLIEST, or CONTINUATION_TOKEN as the startSelectorType, you don't provide any additional information in the startSelector."];
      afterFragmentNumber: FragmentNumberString.t option
        [@ocaml.doc
          "Specifies the fragment number from where you want the GetMedia API to start returning the fragments."];
      startTimestamp: Timestamp.t option
        [@ocaml.doc
          "A timestamp value. This value is required if you choose the PRODUCER_TIMESTAMP or the SERVER_TIMESTAMP as the startSelectorType. The GetMedia API then starts with the chunk containing the fragment that has the specified timestamp."];
      continuationToken: ContinuationToken.t option
        [@ocaml.doc
          "Continuation token that Kinesis Video Streams returned in the previous GetMedia response. The GetMedia API then starts with the chunk identified by the continuation token."]}
    let context_ = "StartSelector"
    let make ?afterFragmentNumber =
      fun ?startTimestamp ->
        fun ?continuationToken ->
          fun ~startSelectorType ->
            fun () ->
              {
                afterFragmentNumber;
                startTimestamp;
                continuationToken;
                startSelectorType
              }
    let to_value x =
      structure_to_value
        [("StartSelectorType",
           (Some (StartSelectorType.to_value x.startSelectorType)));
        ("AfterFragmentNumber",
          (Option.map x.afterFragmentNumber ~f:FragmentNumberString.to_value));
        ("StartTimestamp",
          (Option.map x.startTimestamp ~f:Timestamp.to_value));
        ("ContinuationToken",
          (Option.map x.continuationToken ~f:ContinuationToken.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let continuationToken =
        (Option.map ~f:ContinuationToken.of_xml)
          (Xml.child xml_arg0 "ContinuationToken") in
      let startTimestamp =
        (Option.map ~f:Timestamp.of_xml)
          (Xml.child xml_arg0 "StartTimestamp") in
      let afterFragmentNumber =
        (Option.map ~f:FragmentNumberString.of_xml)
          (Xml.child xml_arg0 "AfterFragmentNumber") in
      let startSelectorType =
        StartSelectorType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "StartSelectorType") in
      make ?continuationToken ?startTimestamp ?afterFragmentNumber
        ~startSelectorType ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let continuationToken =
        field_map json__ "ContinuationToken" ContinuationToken.of_json in
      let startTimestamp =
        field_map json__ "StartTimestamp" Timestamp.of_json in
      let afterFragmentNumber =
        field_map json__ "AfterFragmentNumber" FragmentNumberString.of_json in
      let startSelectorType =
        field_map_exn json__ "StartSelectorType" StartSelectorType.of_json in
      make ?continuationToken ?startTimestamp ?afterFragmentNumber
        ~startSelectorType ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Identifies the chunk on the Kinesis video stream where you want the GetMedia API to start returning media data. You have the following options to identify the starting chunk: Choose the latest (or oldest) chunk. Identify a specific chunk. You can identify a specific chunk either by providing a fragment number or timestamp (server or producer). Each chunk's metadata includes a continuation token as a Matroska (MKV) tag (AWS_KINESISVIDEO_CONTINUATION_TOKEN). If your previous GetMedia request terminated, you can use this tag value in your next GetMedia request. The API then starts returning chunks starting where the last API ended."]
module StreamName =
  struct
    type nonrec t = string
    let context_ = "StreamName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:256) >>=
                  (fun () -> check_pattern i ~pattern:"[a-zA-Z0-9_.-]+")));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"StreamName" j
    let to_json = simple_to_json to_value
  end
module GetMediaOutput =
  struct
    type nonrec t =
      {
      contentType: ContentType.t option
        [@ocaml.doc "The content type of the requested media."];
      payload: Payload.t option
        [@ocaml.doc
          "The payload Kinesis Video Streams returns is a sequence of chunks from the specified stream. For information about the chunks, see . The chunks that Kinesis Video Streams returns in the GetMedia call also include the following additional Matroska (MKV) tags: AWS_KINESISVIDEO_CONTINUATION_TOKEN (UTF-8 string) - In the event your GetMedia call terminates, you can use this continuation token in your next request to get the next chunk where the last request terminated. AWS_KINESISVIDEO_MILLIS_BEHIND_NOW (UTF-8 string) - Client applications can use this tag value to determine how far behind the chunk returned in the response is from the latest chunk on the stream. AWS_KINESISVIDEO_FRAGMENT_NUMBER - Fragment number returned in the chunk. AWS_KINESISVIDEO_SERVER_TIMESTAMP - Server timestamp of the fragment. AWS_KINESISVIDEO_PRODUCER_TIMESTAMP - Producer timestamp of the fragment. The following tags will be present if an error occurs: AWS_KINESISVIDEO_ERROR_CODE - String description of an error that caused GetMedia to stop. AWS_KINESISVIDEO_ERROR_ID: Integer code of the error. The error codes are as follows: 3002 - Error writing to the stream 4000 - Requested fragment is not found 4500 - Access denied for the stream's KMS key 4501 - Stream's KMS key is disabled 4502 - Validation error on the stream's KMS key 4503 - KMS key specified in the stream is unavailable 4504 - Invalid usage of the KMS key specified in the stream 4505 - Invalid state of the KMS key specified in the stream 4506 - Unable to find the KMS key specified in the stream 5000 - Internal error"]}
    type nonrec error =
      [ `ClientLimitExceededException of ClientLimitExceededException.t 
      | `ConnectionLimitExceededException of
          ConnectionLimitExceededException.t 
      | `InvalidArgumentException of InvalidArgumentException.t 
      | `InvalidEndpointException of InvalidEndpointException.t 
      | `NotAuthorizedException of NotAuthorizedException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?contentType =
      fun ?payload -> fun () -> { contentType; payload }
    let error_of_json name json =
      match name with
      | "ClientLimitExceededException" ->
          `ClientLimitExceededException
            (ClientLimitExceededException.of_json json)
      | "ConnectionLimitExceededException" ->
          `ConnectionLimitExceededException
            (ConnectionLimitExceededException.of_json json)
      | "InvalidArgumentException" ->
          `InvalidArgumentException (InvalidArgumentException.of_json json)
      | "InvalidEndpointException" ->
          `InvalidEndpointException (InvalidEndpointException.of_json json)
      | "NotAuthorizedException" ->
          `NotAuthorizedException (NotAuthorizedException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "ClientLimitExceededException" ->
          `ClientLimitExceededException
            (ClientLimitExceededException.of_xml xml)
      | "ConnectionLimitExceededException" ->
          `ConnectionLimitExceededException
            (ConnectionLimitExceededException.of_xml xml)
      | "InvalidArgumentException" ->
          `InvalidArgumentException (InvalidArgumentException.of_xml xml)
      | "InvalidEndpointException" ->
          `InvalidEndpointException (InvalidEndpointException.of_xml xml)
      | "NotAuthorizedException" ->
          `NotAuthorizedException (NotAuthorizedException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `ClientLimitExceededException e ->
          `Assoc
            [("error", (`String "ClientLimitExceededException"));
            ("details", (ClientLimitExceededException.to_json e))]
      | `ConnectionLimitExceededException e ->
          `Assoc
            [("error", (`String "ConnectionLimitExceededException"));
            ("details", (ConnectionLimitExceededException.to_json e))]
      | `InvalidArgumentException e ->
          `Assoc
            [("error", (`String "InvalidArgumentException"));
            ("details", (InvalidArgumentException.to_json e))]
      | `InvalidEndpointException e ->
          `Assoc
            [("error", (`String "InvalidEndpointException"));
            ("details", (InvalidEndpointException.to_json e))]
      | `NotAuthorizedException e ->
          `Assoc
            [("error", (`String "NotAuthorizedException"));
            ("details", (NotAuthorizedException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.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
            ?contentType:(Option.map
                            ((List.Assoc.find ~equal:String.Caseless.equal)
                               xs "Content-Type") ~f:ContentType.of_string)
            ?payload:(Some pipe) ())
      [@warning "-27"])
    let to_value x =
      structure_to_value
        [("Content-Type", (Option.map x.contentType ~f:ContentType.to_value));
        ("Payload", (Option.map x.payload ~f:Payload.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let payload =
        (Option.map ~f:Payload.of_xml) (Xml.child xml_arg0 "Payload") in
      let contentType =
        (Option.map ~f:ContentType.of_xml)
          (Xml.child xml_arg0 "Content-Type") in
      make ?payload ?contentType ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let payload = field_map json__ "Payload" Payload.of_json in
      let contentType = field_map json__ "ContentType" ContentType.of_json in
      make ?payload ?contentType ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Use this API to retrieve media content from a Kinesis video stream. In the request, you identify the stream name or stream Amazon Resource Name (ARN), and the starting chunk. Kinesis Video Streams then returns a stream of chunks in order by fragment number. You must first call the GetDataEndpoint API to get an endpoint. Then send the GetMedia requests to this endpoint using the --endpoint-url parameter. When you put media data (fragments) on a stream, Kinesis Video Streams stores each incoming fragment and related metadata in what is called a \"chunk.\" For more information, see PutMedia. The GetMedia API returns a stream of these chunks starting from the chunk that you specify in the request. The following limits apply when using the GetMedia API: A client can call GetMedia up to five times per second per stream. Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second (or 200 megabits per second) during a GetMedia session. If an error is thrown after invoking a Kinesis Video Streams media API, in addition to the HTTP status code and the response body, it includes the following pieces of information: x-amz-ErrorType HTTP header \226\128\147 contains a more specific error type in addition to what the HTTP status code provides. x-amz-RequestId HTTP header \226\128\147 if you want to report an issue to AWS, the support team can better diagnose the problem if given the Request Id. Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again. For more information, see the Errors section at the bottom of this topic, as well as Common Errors."]
module GetMediaInput =
  struct
    type nonrec t =
      {
      streamName: StreamName.t option
        [@ocaml.doc
          "The Kinesis video stream name from where you want to get the media content. If you don't specify the streamName, you must specify the streamARN."];
      streamARN: ResourceARN.t option
        [@ocaml.doc
          "The ARN of the stream from where you want to get the media content. If you don't specify the streamARN, you must specify the streamName."];
      startSelector: StartSelector.t
        [@ocaml.doc
          "Identifies the starting chunk to get from the specified stream."]}
    let context_ = "GetMediaInput"
    let make ?streamName =
      fun ?streamARN ->
        fun ~startSelector ->
          fun () -> { streamName; streamARN; startSelector }
    let to_value x =
      structure_to_value
        [("StreamName", (Option.map x.streamName ~f:StreamName.to_value));
        ("StreamARN", (Option.map x.streamARN ~f:ResourceARN.to_value));
        ("StartSelector", (Some (StartSelector.to_value x.startSelector)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let startSelector =
        StartSelector.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "StartSelector") in
      let streamARN =
        (Option.map ~f:ResourceARN.of_xml) (Xml.child xml_arg0 "StreamARN") in
      let streamName =
        (Option.map ~f:StreamName.of_xml) (Xml.child xml_arg0 "StreamName") in
      make ~startSelector ?streamARN ?streamName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let startSelector =
        field_map_exn json__ "StartSelector" StartSelector.of_json in
      let streamARN = field_map json__ "StreamARN" ResourceARN.of_json in
      let streamName = field_map json__ "StreamName" StreamName.of_json in
      make ~startSelector ?streamARN ?streamName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Use this API to retrieve media content from a Kinesis video stream. In the request, you identify the stream name or stream Amazon Resource Name (ARN), and the starting chunk. Kinesis Video Streams then returns a stream of chunks in order by fragment number. You must first call the GetDataEndpoint API to get an endpoint. Then send the GetMedia requests to this endpoint using the --endpoint-url parameter. When you put media data (fragments) on a stream, Kinesis Video Streams stores each incoming fragment and related metadata in what is called a \"chunk.\" For more information, see PutMedia. The GetMedia API returns a stream of these chunks starting from the chunk that you specify in the request. The following limits apply when using the GetMedia API: A client can call GetMedia up to five times per second per stream. Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second (or 200 megabits per second) during a GetMedia session. If an error is thrown after invoking a Kinesis Video Streams media API, in addition to the HTTP status code and the response body, it includes the following pieces of information: x-amz-ErrorType HTTP header \226\128\147 contains a more specific error type in addition to what the HTTP status code provides. x-amz-RequestId HTTP header \226\128\147 if you want to report an issue to AWS, the support team can better diagnose the problem if given the Request Id. Both the HTTP status code and the ErrorType header can be utilized to make programmatic decisions about whether errors are retry-able and under what conditions, as well as provide information on what actions the client programmer might need to take in order to successfully try again. For more information, see the Errors section at the bottom of this topic, as well as Common Errors."]