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
(* 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.marketplace_reporting
let apiVersion = "2018-05-10"
let endpointPrefix = "reporting-marketplace"
let serviceFullName = "AWS Marketplace Reporting 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 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 EmbeddingDomain =
  struct
    type nonrec t = string
    let context_ = "EmbeddingDomain"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:2000) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"(https://[a-zA-Z\\.\\*0-9\\-_]+[\\.]{1}[a-zA-Z]{1,}[a-zA-Z0-9&?/-_=]*[a-zA-Z\\*0-9/]+|http[s]*://localhost(:[0-9]{1,5})?)")));
        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:"EmbeddingDomain" j
    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 do not have sufficient access to perform this action."]
module BadRequestException =
  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 is malformed, or it contains an error such as an invalid parameter. Ensure the request has all required parameters."]
module DashboardIdentifier =
  struct
    type nonrec t = string
    let context_ = "DashboardIdentifier"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_min i ~min:1) >>=
             (fun () ->
                (check_string_max i ~max:1023) >>=
                  (fun () ->
                     check_pattern i
                       ~pattern:"arn:aws:aws-marketplace::[0-9]{12}:AWSMarketplace/ReportingData/(Agreement_V1/Dashboard/AgreementSummary_V1|BillingEvent_V1/Dashboard/CostAnalysis_V1)")));
        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:"DashboardIdentifier" j
    let to_json = simple_to_json to_value
  end
module EmbeddingDomains =
  struct
    type nonrec t = EmbeddingDomain.t list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:2) >>= (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:EmbeddingDomain.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:EmbeddingDomain.of_xml)
    let of_json j =
      list_of_json ~kind:"EmbeddingDomains" ~of_json:EmbeddingDomain.of_json
        j
    let to_json v = composed_to_json to_value v
  end
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 "The operation failed due to a server error."]
module UnauthorizedException =
  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 do not have permission to perform this action."]
module GetBuyerDashboardOutput =
  struct
    type nonrec t =
      {
      embedUrl: String_.t option
        [@ocaml.doc "The dashboard's embedding URL."];
      dashboardIdentifier: DashboardIdentifier.t option
        [@ocaml.doc "The ARN of the returned dashboard."];
      embeddingDomains: EmbeddingDomains.t option
        [@ocaml.doc
          "The fully qualified domains specified in the request. The domains enable access to the generated URL that is then embedded. You can list up to two domains or subdomains in each API call. To include all subdomains under a specific domain, use *. For example, https://*.amazon.com includes all subdomains under https://aws.amazon.com."]}
    type nonrec error =
      [ `AccessDeniedException of AccessDeniedException.t 
      | `BadRequestException of BadRequestException.t 
      | `InternalServerException of InternalServerException.t 
      | `UnauthorizedException of UnauthorizedException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?embedUrl =
      fun ?dashboardIdentifier ->
        fun ?embeddingDomains ->
          fun () -> { embedUrl; dashboardIdentifier; embeddingDomains }
    let error_of_json name json =
      match name with
      | "AccessDeniedException" ->
          `AccessDeniedException (AccessDeniedException.of_json json)
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_json json)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_json json)
      | "UnauthorizedException" ->
          `UnauthorizedException (UnauthorizedException.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)
      | "BadRequestException" ->
          `BadRequestException (BadRequestException.of_xml xml)
      | "InternalServerException" ->
          `InternalServerException (InternalServerException.of_xml xml)
      | "UnauthorizedException" ->
          `UnauthorizedException (UnauthorizedException.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))]
      | `BadRequestException e ->
          `Assoc
            [("error", (`String "BadRequestException"));
            ("details", (BadRequestException.to_json e))]
      | `InternalServerException e ->
          `Assoc
            [("error", (`String "InternalServerException"));
            ("details", (InternalServerException.to_json e))]
      | `UnauthorizedException e ->
          `Assoc
            [("error", (`String "UnauthorizedException"));
            ("details", (UnauthorizedException.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
        [("embedUrl", (Option.map x.embedUrl ~f:String_.to_value));
        ("dashboardIdentifier",
          (Option.map x.dashboardIdentifier ~f:DashboardIdentifier.to_value));
        ("embeddingDomains",
          (Option.map x.embeddingDomains ~f:EmbeddingDomains.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let embeddingDomains =
        (Option.map ~f:EmbeddingDomains.of_xml)
          (Xml.child xml_arg0 "embeddingDomains") in
      let dashboardIdentifier =
        (Option.map ~f:DashboardIdentifier.of_xml)
          (Xml.child xml_arg0 "dashboardIdentifier") in
      let embedUrl =
        (Option.map ~f:String_.of_xml) (Xml.child xml_arg0 "embedUrl") in
      make ?embeddingDomains ?dashboardIdentifier ?embedUrl ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let embeddingDomains =
        field_map json__ "embeddingDomains" EmbeddingDomains.of_json in
      let dashboardIdentifier =
        field_map json__ "dashboardIdentifier" DashboardIdentifier.of_json in
      let embedUrl = field_map json__ "embedUrl" String_.of_json in
      make ?embeddingDomains ?dashboardIdentifier ?embedUrl ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates an embedding URL for an Amazon QuickSight dashboard for an anonymous user. This API is available only to Amazon Web Services Organization management accounts or delegated administrators registered for the procurement insights (procurement-insights.marketplace.amazonaws.com) feature. The following rules apply to a generated URL: It contains a temporary bearer token, valid for 5 minutes after it is generated. Once redeemed within that period, it cannot be re-used again. It has a session lifetime of one hour. The 5-minute validity period runs separately from the session lifetime."]
module GetBuyerDashboardInput =
  struct
    type nonrec t =
      {
      dashboardIdentifier: DashboardIdentifier.t
        [@ocaml.doc "The ARN of the requested dashboard."];
      embeddingDomains: EmbeddingDomains.t
        [@ocaml.doc
          "Fully qualified domains that you add to the allow list for access to the generated URL that is then embedded. You can list up to two domains or subdomains in each API call. To include all subdomains under a specific domain, use *. For example, https://*.amazon.com includes all subdomains under https://aws.amazon.com."]}
    let context_ = "GetBuyerDashboardInput"
    let make ~dashboardIdentifier =
      fun ~embeddingDomains ->
        fun () -> { dashboardIdentifier; embeddingDomains }
    let to_value x =
      structure_to_value
        [("dashboardIdentifier",
           (Some (DashboardIdentifier.to_value x.dashboardIdentifier)));
        ("embeddingDomains",
          (Some (EmbeddingDomains.to_value x.embeddingDomains)))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let embeddingDomains =
        EmbeddingDomains.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "embeddingDomains") in
      let dashboardIdentifier =
        DashboardIdentifier.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "dashboardIdentifier") in
      make ~embeddingDomains ~dashboardIdentifier ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let embeddingDomains =
        field_map_exn json__ "embeddingDomains" EmbeddingDomains.of_json in
      let dashboardIdentifier =
        field_map_exn json__ "dashboardIdentifier"
          DashboardIdentifier.of_json in
      make ~embeddingDomains ~dashboardIdentifier ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Generates an embedding URL for an Amazon QuickSight dashboard for an anonymous user. This API is available only to Amazon Web Services Organization management accounts or delegated administrators registered for the procurement insights (procurement-insights.marketplace.amazonaws.com) feature. The following rules apply to a generated URL: It contains a temporary bearer token, valid for 5 minutes after it is generated. Once redeemed within that period, it cannot be re-used again. It has a session lifetime of one hour. The 5-minute validity period runs separately from the session lifetime."]