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
(* 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.cloudtrail_data
let apiVersion = "2021-08-11"
let endpointPrefix = "cloudtrail-data"
let serviceFullName = "AWS CloudTrail Data Service"
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 Uuid =
  struct
    type nonrec t = string
    let context_ = "Uuid"
    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:"Uuid" j
    let to_json = simple_to_json to_value
  end
module ErrorCode =
  struct
    type nonrec t = string
    let context_ = "ErrorCode"
    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:"ErrorCode" j
    let to_json = simple_to_json to_value
  end
module ErrorMessage =
  struct
    type nonrec t = string
    let context_ = "ErrorMessage"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:1024) >>=
             (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:"ErrorMessage" 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 AuditEventResultEntry =
  struct
    type nonrec t =
      {
      eventID: Uuid.t option
        [@ocaml.doc "The event ID assigned by CloudTrail."];
      id: Uuid.t option
        [@ocaml.doc "The original event ID from the source event."]}
    let make ?eventID = fun ?id -> fun () -> { eventID; id }
    let to_value x =
      structure_to_value
        [("eventID", (Option.map x.eventID ~f:Uuid.to_value));
        ("id", (Option.map x.id ~f:Uuid.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let id = (Option.map ~f:Uuid.of_xml) (Xml.child xml_arg0 "id") in
      let eventID =
        (Option.map ~f:Uuid.of_xml) (Xml.child xml_arg0 "eventID") in
      make ?id ?eventID ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let id = field_map json__ "id" Uuid.of_json in
      let eventID = field_map json__ "eventID" Uuid.of_json in
      make ?id ?eventID ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "A response that includes successful and failed event results."]
module ResultErrorEntry =
  struct
    type nonrec t =
      {
      errorCode: ErrorCode.t option
        [@ocaml.doc
          "The error code for events that could not be ingested by CloudTrail. Possible error codes include: FieldTooLong, FieldNotFound, InvalidChecksum, InvalidData, InvalidRecipient, InvalidEventSource, AccountNotSubscribed, Throttling, and InternalFailure."];
      errorMessage: ErrorMessage.t option
        [@ocaml.doc
          "The message that describes the error for events that could not be ingested by CloudTrail."];
      id: Uuid.t option
        [@ocaml.doc
          "The original event ID from the source event that could not be ingested by CloudTrail."]}
    let make ?errorCode =
      fun ?errorMessage ->
        fun ?id -> fun () -> { errorCode; errorMessage; id }
    let to_value x =
      structure_to_value
        [("errorCode", (Option.map x.errorCode ~f:ErrorCode.to_value));
        ("errorMessage",
          (Option.map x.errorMessage ~f:ErrorMessage.to_value));
        ("id", (Option.map x.id ~f:Uuid.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let id = (Option.map ~f:Uuid.of_xml) (Xml.child xml_arg0 "id") in
      let errorMessage =
        (Option.map ~f:ErrorMessage.of_xml)
          (Xml.child xml_arg0 "errorMessage") in
      let errorCode =
        (Option.map ~f:ErrorCode.of_xml) (Xml.child xml_arg0 "errorCode") in
      make ?id ?errorMessage ?errorCode ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let id = field_map json__ "id" Uuid.of_json in
      let errorMessage = field_map json__ "errorMessage" ErrorMessage.of_json in
      let errorCode = field_map json__ "errorCode" ErrorCode.of_json in
      make ?id ?errorMessage ?errorCode ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Includes the error code and error message for events that could not be ingested by CloudTrail."]
module AuditEvent =
  struct
    type nonrec t =
      {
      eventData: String_.t
        [@ocaml.doc
          "The content of an audit event that comes from the event, such as userIdentity, userAgent, and eventSource."];
      eventDataChecksum: String_.t option
        [@ocaml.doc
          "A checksum is a base64-SHA256 algorithm that helps you verify that CloudTrail receives the event that matches with the checksum. Calculate the checksum by running a command like the following: printf %s $eventdata | openssl dgst -binary -sha256 | base64"];
      id: Uuid.t [@ocaml.doc "The original event ID from the source event."]}
    let context_ = "AuditEvent"
    let make ?eventDataChecksum =
      fun ~eventData ->
        fun ~id -> fun () -> { eventDataChecksum; eventData; id }
    let to_value x =
      structure_to_value
        [("eventData", (Some (String_.to_value x.eventData)));
        ("eventDataChecksum",
          (Option.map x.eventDataChecksum ~f:String_.to_value));
        ("id", (Some (Uuid.to_value x.id)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let id = Uuid.of_xml (Xml.child_exn ~context:context_ xml_arg0 "id") in
      let eventDataChecksum =
        (Option.map ~f:String_.of_xml)
          (Xml.child xml_arg0 "eventDataChecksum") in
      let eventData =
        String_.of_xml (Xml.child_exn ~context:context_ xml_arg0 "eventData") in
      make ~id ?eventDataChecksum ~eventData ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let id = field_map_exn json__ "id" Uuid.of_json in
      let eventDataChecksum =
        field_map json__ "eventDataChecksum" String_.of_json in
      let eventData = field_map_exn json__ "eventData" String_.of_json in
      make ~id ?eventDataChecksum ~eventData ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "An event from a source outside of Amazon Web Services that you want CloudTrail to log."]
module AuditEventResultEntries =
  struct
    type nonrec t = AuditEventResultEntry.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:100) >>=
             (fun () -> check_list_min i ~min:0));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:AuditEventResultEntry.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:AuditEventResultEntry.of_xml)
    let of_json j =
      list_of_json ~kind:"AuditEventResultEntries"
        ~of_json:AuditEventResultEntry.of_json j
    let to_json v = composed_to_json to_value v
  end
module ChannelInsufficientPermission =
  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 caller's account ID must be the same as the channel owner's account ID."]
module ChannelNotFound =
  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 channel could not be found."]
module ChannelUnsupportedSchema =
  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 schema type of the event is not supported."]
module DuplicatedAuditEventId =
  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
       "Two or more entries in the request have the same event ID."]
module InvalidChannelARN =
  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 specified channel ARN is not a valid channel ARN."]
module ResultErrorEntries =
  struct
    type nonrec t = ResultErrorEntry.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:100) >>=
             (fun () -> check_list_min i ~min:0));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:ResultErrorEntry.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:ResultErrorEntry.of_xml)
    let of_json j =
      list_of_json ~kind:"ResultErrorEntries"
        ~of_json:ResultErrorEntry.of_json j
    let to_json v = composed_to_json to_value v
  end
module UnsupportedOperationException =
  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 operation requested is not supported in this region or account."]
module AuditEvents =
  struct
    type nonrec t = AuditEvent.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:100) >>=
             (fun () -> check_list_min i ~min:1));
        i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:AuditEvent.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:AuditEvent.of_xml)
    let of_json j =
      list_of_json ~kind:"AuditEvents" ~of_json:AuditEvent.of_json j
    let to_json v = composed_to_json to_value v
  end
module ChannelArn =
  struct
    type nonrec t = string
    let context_ = "ChannelArn"
    let make i =
      let open Result in
        ok_or_failwith (check_pattern i ~pattern:"^arn:.*$"); 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:"ChannelArn" j
    let to_json = simple_to_json to_value
  end
module ExternalId =
  struct
    type nonrec t = string
    let context_ = "ExternalId"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:2) >>=
             (fun () ->
                (check_string_max i ~max:1224) >>=
                  (fun () -> check_pattern i ~pattern:"^[\\w+=,.@:\\/-]*$")));
        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:"ExternalId" j
    let to_json = simple_to_json to_value
  end
module PutAuditEventsResponse =
  struct
    type nonrec t =
      {
      failed: ResultErrorEntries.t option
        [@ocaml.doc
          "Lists events in the provided event payload that could not be ingested into CloudTrail, and includes the error code and error message returned for events that could not be ingested."];
      successful: AuditEventResultEntries.t option
        [@ocaml.doc
          "Lists events in the provided event payload that were successfully ingested into CloudTrail."]}
    type nonrec error =
      [ `ChannelInsufficientPermission of ChannelInsufficientPermission.t 
      | `ChannelNotFound of ChannelNotFound.t 
      | `ChannelUnsupportedSchema of ChannelUnsupportedSchema.t 
      | `DuplicatedAuditEventId of DuplicatedAuditEventId.t 
      | `InvalidChannelARN of InvalidChannelARN.t 
      | `UnsupportedOperationException of UnsupportedOperationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?failed = fun ?successful -> fun () -> { failed; successful }
    let error_of_json name json =
      match name with
      | "ChannelInsufficientPermission" ->
          `ChannelInsufficientPermission
            (ChannelInsufficientPermission.of_json json)
      | "ChannelNotFound" -> `ChannelNotFound (ChannelNotFound.of_json json)
      | "ChannelUnsupportedSchema" ->
          `ChannelUnsupportedSchema (ChannelUnsupportedSchema.of_json json)
      | "DuplicatedAuditEventId" ->
          `DuplicatedAuditEventId (DuplicatedAuditEventId.of_json json)
      | "InvalidChannelARN" ->
          `InvalidChannelARN (InvalidChannelARN.of_json json)
      | "UnsupportedOperationException" ->
          `UnsupportedOperationException
            (UnsupportedOperationException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "ChannelInsufficientPermission" ->
          `ChannelInsufficientPermission
            (ChannelInsufficientPermission.of_xml xml)
      | "ChannelNotFound" -> `ChannelNotFound (ChannelNotFound.of_xml xml)
      | "ChannelUnsupportedSchema" ->
          `ChannelUnsupportedSchema (ChannelUnsupportedSchema.of_xml xml)
      | "DuplicatedAuditEventId" ->
          `DuplicatedAuditEventId (DuplicatedAuditEventId.of_xml xml)
      | "InvalidChannelARN" ->
          `InvalidChannelARN (InvalidChannelARN.of_xml xml)
      | "UnsupportedOperationException" ->
          `UnsupportedOperationException
            (UnsupportedOperationException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `ChannelInsufficientPermission e ->
          `Assoc
            [("error", (`String "ChannelInsufficientPermission"));
            ("details", (ChannelInsufficientPermission.to_json e))]
      | `ChannelNotFound e ->
          `Assoc
            [("error", (`String "ChannelNotFound"));
            ("details", (ChannelNotFound.to_json e))]
      | `ChannelUnsupportedSchema e ->
          `Assoc
            [("error", (`String "ChannelUnsupportedSchema"));
            ("details", (ChannelUnsupportedSchema.to_json e))]
      | `DuplicatedAuditEventId e ->
          `Assoc
            [("error", (`String "DuplicatedAuditEventId"));
            ("details", (DuplicatedAuditEventId.to_json e))]
      | `InvalidChannelARN e ->
          `Assoc
            [("error", (`String "InvalidChannelARN"));
            ("details", (InvalidChannelARN.to_json e))]
      | `UnsupportedOperationException e ->
          `Assoc
            [("error", (`String "UnsupportedOperationException"));
            ("details", (UnsupportedOperationException.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
        [("failed", (Option.map x.failed ~f:ResultErrorEntries.to_value));
        ("successful",
          (Option.map x.successful ~f:AuditEventResultEntries.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let successful =
        (Option.map ~f:AuditEventResultEntries.of_xml)
          (Xml.child xml_arg0 "successful") in
      let failed =
        (Option.map ~f:ResultErrorEntries.of_xml)
          (Xml.child xml_arg0 "failed") in
      make ?successful ?failed ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let successful =
        field_map json__ "successful" AuditEventResultEntries.of_json in
      let failed = field_map json__ "failed" ResultErrorEntries.of_json in
      make ?successful ?failed ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Ingests your application events into CloudTrail Lake. A required parameter, auditEvents, accepts the JSON records (also called payload) of events that you want CloudTrail to ingest. You can add up to 100 of these events (or up to 1 MB) per PutAuditEvents request."]
module PutAuditEventsRequest =
  struct
    type nonrec t =
      {
      auditEvents: AuditEvents.t
        [@ocaml.doc
          "The JSON payload of events that you want to ingest. You can also point to the JSON event payload in a file."];
      channelArn: ChannelArn.t
        [@ocaml.doc "The ARN or ID (the ARN suffix) of a channel."];
      externalId: ExternalId.t option
        [@ocaml.doc
          "A unique identifier that is conditionally required when the channel's resource policy includes an external ID. This value can be any string, such as a passphrase or account number."]}
    let context_ = "PutAuditEventsRequest"
    let make ?externalId =
      fun ~auditEvents ->
        fun ~channelArn -> fun () -> { externalId; auditEvents; channelArn }
    let to_value x =
      structure_to_value
        [("auditEvents", (Some (AuditEvents.to_value x.auditEvents)));
        ("channelArn", (Some (ChannelArn.to_value x.channelArn)));
        ("externalId", (Option.map x.externalId ~f:ExternalId.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let externalId =
        (Option.map ~f:ExternalId.of_xml) (Xml.child xml_arg0 "externalId") in
      let channelArn =
        ChannelArn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "channelArn") in
      let auditEvents =
        AuditEvents.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "auditEvents") in
      make ?externalId ~channelArn ~auditEvents ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let externalId = field_map json__ "externalId" ExternalId.of_json in
      let channelArn = field_map_exn json__ "channelArn" ChannelArn.of_json in
      let auditEvents =
        field_map_exn json__ "auditEvents" AuditEvents.of_json in
      make ?externalId ~channelArn ~auditEvents ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Ingests your application events into CloudTrail Lake. A required parameter, auditEvents, accepts the JSON records (also called payload) of events that you want CloudTrail to ingest. You can add up to 100 of these events (or up to 1 MB) per PutAuditEvents request."]