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
(* 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.eks_auth
let apiVersion = "2023-11-26"
let endpointPrefix = "eks-auth"
let serviceFullName = "Amazon EKS Auth"
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 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 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 AccessDeniedException =
  struct
    type nonrec t = {
      message: String_.t option }
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let message = field_map json__ "message" String_.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "You don't have permissions to perform the requested operation. The IAM principal making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access management in the IAM User Guide."]
module AssumedRoleUser =
  struct
    type nonrec t =
      {
      arn: String_.t option
        [@ocaml.doc
          "The ARN of the IAM role that the temporary credentials authenticate to."];
      assumeRoleId: String_.t option
        [@ocaml.doc
          "The session name of the temporary session requested to STS. The value is a unique identifier that contains the role ID, a colon (:), and the role session name of the role that is being assumed. The role ID is generated by IAM when the role is created. The role session name part of the value follows this format: eks-clustername-podname-random UUID"]}
    let make ?arn = fun ?assumeRoleId -> fun () -> { arn; assumeRoleId }
    let to_value x =
      structure_to_value
        [("arn", (Option.map x.arn ~f:String_.to_value));
        ("assumeRoleId", (Option.map x.assumeRoleId ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let assumeRoleId =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "assumeRoleId") in
      let arn = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "arn") in
      make ?assumeRoleId ?arn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let assumeRoleId = field_map json__ "assumeRoleId" String_.of_json in
      let arn = field_map json__ "arn" String_.of_json in
      make ?assumeRoleId ?arn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "An object with the permanent IAM role identity and the temporary session name."]
module Credentials =
  struct
    type nonrec t =
      {
      sessionToken: String_.t option
        [@ocaml.doc
          "The token that applications inside the pods must pass to any service API to use the temporary credentials."];
      secretAccessKey: String_.t option
        [@ocaml.doc
          "The secret access key that applications inside the pods use to sign requests."];
      accessKeyId: String_.t option
        [@ocaml.doc
          "The access key ID that identifies the temporary security credentials."];
      expiration: Timestamp.t option
        [@ocaml.doc
          "The Unix epoch timestamp in seconds when the current credentials expire."]}
    let make ?sessionToken =
      fun ?secretAccessKey ->
        fun ?accessKeyId ->
          fun ?expiration ->
            fun () ->
              { sessionToken; secretAccessKey; accessKeyId; expiration }
    let to_value x =
      structure_to_value
        [("sessionToken", (Option.map x.sessionToken ~f:String_.to_value));
        ("secretAccessKey",
          (Option.map x.secretAccessKey ~f:String_.to_value));
        ("accessKeyId", (Option.map x.accessKeyId ~f:String_.to_value));
        ("expiration", (Option.map x.expiration ~f:Timestamp.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let expiration =
        (Option.map ~f:Timestamp.of_xml) (Xml.child xml_arg0 "expiration") in
      let accessKeyId =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "accessKeyId") in
      let secretAccessKey =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "secretAccessKey") in
      let sessionToken =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "sessionToken") in
      make ?expiration ?accessKeyId ?secretAccessKey ?sessionToken ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let expiration = field_map json__ "expiration" Timestamp.of_json in
      let accessKeyId = field_map json__ "accessKeyId" String_.of_json in
      let secretAccessKey =
        field_map json__ "secretAccessKey" String_.of_json in
      let sessionToken = field_map json__ "sessionToken" String_.of_json in
      make ?expiration ?accessKeyId ?secretAccessKey ?sessionToken ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The Amazon Web Services Signature Version 4 type of temporary credentials."]
module ExpiredTokenException =
  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 Kubernetes service account token is expired."]
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 "These errors are usually caused by a server-side issue."]
module InvalidParameterException =
  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 parameter is invalid. Review the available parameters for the API request."]
module InvalidRequestException =
  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
       "This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message."]
module InvalidTokenException =
  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 Kubernetes service account token is invalid."]
module PodIdentityAssociation =
  struct
    type nonrec t =
      {
      associationArn: String_.t option
        [@ocaml.doc
          "The Amazon Resource Name (ARN) of the EKS Pod Identity association."];
      associationId: String_.t option
        [@ocaml.doc "The ID of the association."]}
    let make ?associationArn =
      fun ?associationId -> fun () -> { associationArn; associationId }
    let to_value x =
      structure_to_value
        [("associationArn",
           (Option.map x.associationArn ~f:String_.to_value));
        ("associationId", (Option.map x.associationId ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let associationId =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "associationId") in
      let associationArn =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "associationArn") in
      make ?associationId ?associationArn ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let associationId = field_map json__ "associationId" String_.of_json in
      let associationArn = field_map json__ "associationArn" String_.of_json in
      make ?associationId ?associationArn ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Amazon EKS Pod Identity associations provide the ability to manage credentials for your applications, similar to the way that Amazon EC2 instance profiles provide credentials to Amazon EC2 instances."]
module ResourceNotFoundException =
  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 resource could not be found."]
module ServiceUnavailableException =
  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 service is unavailable. Back off and retry the operation."]
module Subject =
  struct
    type nonrec t =
      {
      namespace: String_.t option
        [@ocaml.doc
          "The name of the Kubernetes namespace inside the cluster to create the association in. The service account and the pods that use the service account must be in this namespace."];
      serviceAccount: String_.t option
        [@ocaml.doc
          "The name of the Kubernetes service account inside the cluster to associate the IAM credentials with."]}
    let make ?namespace =
      fun ?serviceAccount -> fun () -> { namespace; serviceAccount }
    let to_value x =
      structure_to_value
        [("namespace", (Option.map x.namespace ~f:String_.to_value));
        ("serviceAccount", (Option.map x.serviceAccount ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let serviceAccount =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "serviceAccount") in
      let namespace =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "namespace") in
      make ?serviceAccount ?namespace ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let serviceAccount = field_map json__ "serviceAccount" String_.of_json in
      let namespace = field_map json__ "namespace" String_.of_json in
      make ?serviceAccount ?namespace ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "An object containing the name of the Kubernetes service account inside the cluster to associate the IAM credentials with."]
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 because your request rate is too high. Reduce the frequency of requests."]
module ClusterName =
  struct
    type nonrec t = string
    let context_ = "ClusterName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:100) >>=
                  (fun () ->
                     check_pattern i ~pattern:"[0-9A-Za-z][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:"ClusterName" j
    let to_json = simple_to_json to_value
  end
module JwtToken =
  struct
    type nonrec t = string
    let context_ = "JwtToken"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                check_pattern i
                  ~pattern:"[A-Za-z0-9-_=]+\\.[A-Za-z0-9-_=]+\\.[A-Za-z0-9-_=]+"));
        i
    let of_string x = x
    let to_value x = `String x
    let to_query v = to_query to_value v
    let to_header x = x
    let of_xml = Xml.string_data_exn ~context:context_
    let of_json j = string_of_json ~kind:"JwtToken" j
    let to_json = simple_to_json to_value
  end
module AssumeRoleForPodIdentityResponse =
  struct
    type nonrec t =
      {
      subject: Subject.t option
        [@ocaml.doc
          "The name of the Kubernetes service account inside the cluster to associate the IAM credentials with."];
      audience: String_.t option
        [@ocaml.doc
          "The identity that is allowed to use the credentials. This value is always pods.eks.amazonaws.com."];
      podIdentityAssociation: PodIdentityAssociation.t option
        [@ocaml.doc
          "The Amazon Resource Name (ARN) and ID of the EKS Pod Identity association."];
      assumedRoleUser: AssumedRoleUser.t option
        [@ocaml.doc
          "An object with the permanent IAM role identity and the temporary session name. The ARN of the IAM role that the temporary credentials authenticate to. The session name of the temporary session requested to STS. The value is a unique identifier that contains the role ID, a colon (:), and the role session name of the role that is being assumed. The role ID is generated by IAM when the role is created. The role session name part of the value follows this format: eks-clustername-podname-random UUID"];
      credentials: Credentials.t option
        [@ocaml.doc
          "The Amazon Web Services Signature Version 4 type of temporary credentials."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `ExpiredTokenException of ExpiredTokenException.t 
      | `InternalServerException of InternalServerException.t 
      | `InvalidParameterException of InvalidParameterException.t 
      | `InvalidRequestException of InvalidRequestException.t 
      | `InvalidTokenException of InvalidTokenException.t 
      | `ResourceNotFoundException of ResourceNotFoundException.t 
      | `ServiceUnavailableException of ServiceUnavailableException.t 
      | `ThrottlingException of ThrottlingException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?subject =
      fun ?audience ->
        fun ?podIdentityAssociation ->
          fun ?assumedRoleUser ->
            fun ?credentials ->
              fun () ->
                {
                  subject;
                  audience;
                  podIdentityAssociation;
                  assumedRoleUser;
                  credentials
                }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "ExpiredTokenException" ->
          `ExpiredTokenException (ExpiredTokenException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "InvalidParameterException" ->
          `InvalidParameterException (InvalidParameterException.of_json json)
      | "InvalidRequestException" ->
          `InvalidRequestException (InvalidRequestException.of_json json)
      | "InvalidTokenException" ->
          `InvalidTokenException (InvalidTokenException.of_json json)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_json json)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.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
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_xml xml)
      | "ExpiredTokenException" ->
          `ExpiredTokenException (ExpiredTokenException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "InvalidParameterException" ->
          `InvalidParameterException (InvalidParameterException.of_xml xml)
      | "InvalidRequestException" ->
          `InvalidRequestException (InvalidRequestException.of_xml xml)
      | "InvalidTokenException" ->
          `InvalidTokenException (InvalidTokenException.of_xml xml)
      | "ResourceNotFoundException" ->
          `ResourceNotFoundException (ResourceNotFoundException.of_xml xml)
      | "ServiceUnavailableException" ->
          `ServiceUnavailableException
            (ServiceUnavailableException.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
      | `AccessDeniedException e ->
          `Assoc
            [("error", (`String "AccessDeniedException"));
            ("details", (AccessDeniedException.to_json e))]
      | `ExpiredTokenException e ->
          `Assoc
            [("error", (`String "ExpiredTokenException"));
            ("details", (ExpiredTokenException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `InvalidParameterException e ->
          `Assoc
            [("error", (`String "InvalidParameterException"));
            ("details", (InvalidParameterException.to_json e))]
      | `InvalidRequestException e ->
          `Assoc
            [("error", (`String "InvalidRequestException"));
            ("details", (InvalidRequestException.to_json e))]
      | `InvalidTokenException e ->
          `Assoc
            [("error", (`String "InvalidTokenException"));
            ("details", (InvalidTokenException.to_json e))]
      | `ResourceNotFoundException e ->
          `Assoc
            [("error", (`String "ResourceNotFoundException"));
            ("details", (ResourceNotFoundException.to_json e))]
      | `ServiceUnavailableException e ->
          `Assoc
            [("error", (`String "ServiceUnavailableException"));
            ("details", (ServiceUnavailableException.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
        [("subject", (Option.map x.subject ~f:Subject.to_value));
        ("audience", (Option.map x.audience ~f:String_.to_value));
        ("podIdentityAssociation",
          (Option.map x.podIdentityAssociation
             ~f:PodIdentityAssociation.to_value));
        ("assumedRoleUser",
          (Option.map x.assumedRoleUser ~f:AssumedRoleUser.to_value));
        ("credentials", (Option.map x.credentials ~f:Credentials.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let credentials =
        (Option.map ~f:Credentials.of_xml) (Xml.child xml_arg0 "credentials") in
      let assumedRoleUser =
        (Option.map ~f:AssumedRoleUser.of_xml)
          (Xml.child xml_arg0 "assumedRoleUser") in
      let podIdentityAssociation =
        (Option.map ~f:PodIdentityAssociation.of_xml)
          (Xml.child xml_arg0 "podIdentityAssociation") in
      let audience =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "audience") in
      let subject =
        (Option.map ~f:Subject.of_xml) (Xml.child xml_arg0 "subject") in
      make ?credentials ?assumedRoleUser ?podIdentityAssociation ?audience
        ?subject ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let credentials = field_map json__ "credentials" Credentials.of_json in
      let assumedRoleUser =
        field_map json__ "assumedRoleUser" AssumedRoleUser.of_json in
      let podIdentityAssociation =
        field_map json__ "podIdentityAssociation"
          PodIdentityAssociation.of_json in
      let audience = field_map json__ "audience" String_.of_json in
      let subject = field_map json__ "subject" Subject.of_json in
      make ?credentials ?assumedRoleUser ?podIdentityAssociation ?audience
        ?subject ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The Amazon EKS Auth API and the AssumeRoleForPodIdentity action are only used by the EKS Pod Identity Agent. We recommend that applications use the Amazon Web Services SDKs to connect to Amazon Web Services services; if credentials from an EKS Pod Identity association are available in the pod, the latest versions of the SDKs use them automatically."]
module AssumeRoleForPodIdentityRequest =
  struct
    type nonrec t =
      {
      clusterName: ClusterName.t
        [@ocaml.doc "The name of the cluster for the request."];
      token: JwtToken.t
        [@ocaml.doc
          "The token of the Kubernetes service account for the pod."]}
    let context_ = "AssumeRoleForPodIdentityRequest"
    let make ~clusterName = fun ~token -> fun () -> { clusterName; token }
    let to_value x =
      structure_to_value
        [("clusterName", (Some (ClusterName.to_value x.clusterName)));
        ("token", (Some (JwtToken.to_value x.token)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let token =
        JwtToken.of_xml (Xml.child_exn ~context:context_ xml_arg0 "token") in
      let clusterName =
        ClusterName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "clusterName") in
      make ~token ~clusterName ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let token = field_map_exn json__ "token" JwtToken.of_json in
      let clusterName =
        field_map_exn json__ "clusterName" ClusterName.of_json in
      make ~token ~clusterName ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "The Amazon EKS Auth API and the AssumeRoleForPodIdentity action are only used by the EKS Pod Identity Agent. We recommend that applications use the Amazon Web Services SDKs to connect to Amazon Web Services services; if credentials from an EKS Pod Identity association are available in the pod, the latest versions of the SDKs use them automatically."]