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
(* 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.signer_data
let apiVersion = "2017-08-25"
let endpointPrefix = "data-signer"
let serviceFullName = "AWS Signer Data Plane"
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 RevokedEntity =
  struct
    type nonrec t = string
    let context_ = "RevokedEntity"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:2048) >>=
             (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:"RevokedEntity" j
    let to_json = simple_to_json to_value
  end
module CertificateHash =
  struct
    type nonrec t = string
    let context_ = "CertificateHash"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:2048) >>=
             (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:"CertificateHash" j
    let to_json = simple_to_json to_value
  end
module AccessDeniedException =
  struct
    type nonrec t = {
      message: String_.t option ;
      code: String_.t option }
    let make ?message = fun ?code -> fun () -> { message; code }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value));
        ("code", (Option.map x.code ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let code = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "code") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?code ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let code = field_map json__ "code" String_.of_json in
      let message = field_map json__ "message" String_.of_json in
      make ?code ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "You do not have sufficient permissions to perform this action."]
module InternalServiceErrorException =
  struct
    type nonrec t = {
      message: String_.t option ;
      code: String_.t option }
    let make ?message = fun ?code -> fun () -> { message; code }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value));
        ("code", (Option.map x.code ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let code = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "code") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?code ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let code = field_map json__ "code" String_.of_json in
      let message = field_map json__ "message" String_.of_json in
      make ?code ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "An internal service error occurred."]
module RevokedEntities =
  struct
    type nonrec t = RevokedEntity.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:RevokedEntity.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:RevokedEntity.of_xml)
    let of_json j =
      list_of_json ~kind:"RevokedEntities" ~of_json:RevokedEntity.of_json j
    let to_json v = composed_to_json to_value v
  end
module TooManyRequestsException =
  struct
    type nonrec t = {
      message: String_.t option ;
      code: String_.t option }
    let make ?message = fun ?code -> fun () -> { message; code }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value));
        ("code", (Option.map x.code ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let code = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "code") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?code ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let code = field_map json__ "code" String_.of_json in
      let message = field_map json__ "message" String_.of_json in
      make ?code ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request was denied due to request throttling."]
module ValidationException =
  struct
    type nonrec t = {
      message: String_.t option ;
      code: String_.t option }
    let make ?message = fun ?code -> fun () -> { message; code }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:String_.to_value));
        ("code", (Option.map x.code ~f:String_.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let code = (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "code") in
      let message =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "message") in
      make ?code ?message ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let code = field_map json__ "code" String_.of_json in
      let message = field_map json__ "message" String_.of_json in
      make ?code ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "The request contains invalid parameters or is malformed."]
module Arn =
  struct
    type nonrec t = string
    let context_ = "Arn"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:2048) >>=
             (fun () -> check_string_min i ~min:20));
        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:"Arn" j
    let to_json = simple_to_json to_value
  end
module CertificateHashes =
  struct
    type nonrec t = CertificateHash.t list
    let make i = i
    let of_string _ =
      failwithf "of_string is not implemented for List_shape objects" ()
      [@@warning "-32"]
    let to_value xs =
      (xs |> (List.map ~f:CertificateHash.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:CertificateHash.of_xml)
    let of_json j =
      list_of_json ~kind:"CertificateHashes" ~of_json:CertificateHash.of_json
        j
    let to_json v = composed_to_json to_value v
  end
module PlatformId =
  struct
    type nonrec t = string
    let context_ = "PlatformId"
    let make i =
      let open Result in
        ok_or_failwith (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:"PlatformId" 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 GetRevocationStatusResponse =
  struct
    type nonrec t =
      {
      revokedEntities: RevokedEntities.t option
        [@ocaml.doc
          "List of entity identifiers that have been revoked. Empty if no revocations found."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `InternalServiceErrorException of InternalServiceErrorException.t 
      | `TooManyRequestsException of TooManyRequestsException.t 
      | `ValidationException of ValidationException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?revokedEntities = fun () -> { revokedEntities }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_json json)
      | "TooManyRequestsException" ->
          `TooManyRequestsException (TooManyRequestsException.of_json json)
      | "ValidationException" ->
          `ValidationException (ValidationException.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)
      | "InternalServiceErrorException" ->
          `InternalServiceErrorException
            (InternalServiceErrorException.of_xml xml)
      | "TooManyRequestsException" ->
          `TooManyRequestsException (TooManyRequestsException.of_xml xml)
      | "ValidationException" ->
          `ValidationException (ValidationException.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))]
      | `InternalServiceErrorException e ->
          `Assoc
            [("error", (`String "InternalServiceErrorException"));
            ("details", (InternalServiceErrorException.to_json e))]
      | `TooManyRequestsException e ->
          `Assoc
            [("error", (`String "TooManyRequestsException"));
            ("details", (TooManyRequestsException.to_json e))]
      | `ValidationException e ->
          `Assoc
            [("error", (`String "ValidationException"));
            ("details", (ValidationException.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
        [("revokedEntities",
           (Option.map x.revokedEntities ~f:RevokedEntities.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let revokedEntities =
        (Option.map ~f:RevokedEntities.of_xml)
          (Xml.child xml_arg0 "revokedEntities") in
      make ?revokedEntities ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let revokedEntities =
        field_map json__ "revokedEntities" RevokedEntities.of_json in
      make ?revokedEntities ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Response containing the list of revoked entities."]
module GetRevocationStatusRequest =
  struct
    type nonrec t =
      {
      signatureTimestamp: Timestamp.t
        [@ocaml.doc
          "The timestamp when the artifact was signed, in ISO 8601 format."];
      platformId: PlatformId.t
        [@ocaml.doc "The platform identifier for the signing platform used."];
      profileVersionArn: Arn.t
        [@ocaml.doc
          "The ARN of the signing profile version used to sign the artifact."];
      jobArn: Arn.t
        [@ocaml.doc
          "The ARN of the signing job that produced the signature."];
      certificateHashes: CertificateHashes.t
        [@ocaml.doc "List of certificate hashes to check for revocation."]}
    let context_ = "GetRevocationStatusRequest"
    let make ~signatureTimestamp =
      fun ~platformId ->
        fun ~profileVersionArn ->
          fun ~jobArn ->
            fun ~certificateHashes ->
              fun () ->
                {
                  signatureTimestamp;
                  platformId;
                  profileVersionArn;
                  jobArn;
                  certificateHashes
                }
    let to_value x =
      structure_to_value
        [("signatureTimestamp",
           (Some (Timestamp.to_value x.signatureTimestamp)));
        ("platformId", (Some (PlatformId.to_value x.platformId)));
        ("profileVersionArn", (Some (Arn.to_value x.profileVersionArn)));
        ("jobArn", (Some (Arn.to_value x.jobArn)));
        ("certificateHashes",
          (Some (CertificateHashes.to_value x.certificateHashes)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let certificateHashes =
        CertificateHashes.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "certificateHashes") in
      let jobArn =
        Arn.of_xml (Xml.child_exn ~context:context_ xml_arg0 "jobArn") in
      let profileVersionArn =
        Arn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "profileVersionArn") in
      let platformId =
        PlatformId.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "platformId") in
      let signatureTimestamp =
        Timestamp.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "signatureTimestamp") in
      make ~certificateHashes ~jobArn ~profileVersionArn ~platformId
        ~signatureTimestamp ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let certificateHashes =
        field_map_exn json__ "certificateHashes" CertificateHashes.of_json in
      let jobArn = field_map_exn json__ "jobArn" Arn.of_json in
      let profileVersionArn =
        field_map_exn json__ "profileVersionArn" Arn.of_json in
      let platformId = field_map_exn json__ "platformId" PlatformId.of_json in
      let signatureTimestamp =
        field_map_exn json__ "signatureTimestamp" Timestamp.of_json in
      make ~certificateHashes ~jobArn ~profileVersionArn ~platformId
        ~signatureTimestamp ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc "Request structure for checking revocation status."]