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
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
(* 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.marketplacecommerceanalytics
let apiVersion = "2015-07-01"
let endpointPrefix = "marketplacecommerceanalytics"
let serviceFullName = "AWS Marketplace Commerce Analytics"
let signatureVersion = "v4"
let protocol = "json"
let globalEndpoint = endpointPrefix ^ ".amazonaws.com"
let targetPrefix = "MarketplaceCommerceAnalytics20150701"
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 ExceptionMessage =
  struct
    type nonrec t = string
    let context_ = "ExceptionMessage"
    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:"ExceptionMessage" j
    let to_json = simple_to_json to_value
  end
module OptionalKey =
  struct
    type nonrec t = string
    let context_ = "OptionalKey"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:255) >>=
             (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:"OptionalKey" j
    let to_json = simple_to_json to_value
  end
module OptionalValue =
  struct
    type nonrec t = string
    let context_ = "OptionalValue"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:255) >>=
             (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:"OptionalValue" j
    let to_json = simple_to_json to_value
  end
module DataSetRequestId =
  struct
    type nonrec t = string
    let context_ = "DataSetRequestId"
    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:"DataSetRequestId" j
    let to_json = simple_to_json to_value
  end
module MarketplaceCommerceAnalyticsException =
  struct
    type nonrec t =
      {
      message: ExceptionMessage.t option
        [@ocaml.doc "This message describes details of the error."]}
    let make ?message = fun () -> { message }
    let to_value x =
      structure_to_value
        [("message", (Option.map x.message ~f:ExceptionMessage.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let message =
        (Option.map ~f:ExceptionMessage.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" ExceptionMessage.of_json in
      make ?message ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This exception is thrown when an internal service error occurs."]
module CustomerDefinedValues =
  struct
    type nonrec t = (OptionalKey.t * OptionalValue.t) list
    let make i =
      let open Result in
        ok_or_failwith
          ((check_list_max i ~max:5) >>= (fun () -> check_list_min i ~min:1));
        i
    let of_header xs =
      make
        (List.filter_map xs
           ~f:(fun (k, v) ->
                 (Base.String.chop_prefix k ~prefix:"x-amz-meta-") |>
                   (Option.map
                      ~f:(fun chopped ->
                            ((OptionalKey.of_string chopped),
                              (OptionalValue.of_string v))))))
    let to_value xs =
      (xs |>
         (List.map
            ~f:(fun (x, y) ->
                  (OptionalKey.to_value x) |>
                    (fun x -> (OptionalValue.to_value y) |> (fun y -> (x, y))))))
        |> (fun x -> `Map x)
    let to_query v = to_query to_value v
    let to_header _ =
      failwithf "to_header is not implemented for Map_shape objects" ()
    let of_xml _ =
      failwith "of_xml_converter_of_shape: Map_shape case not implemented"
    let of_json j =
      object_of_json ~key_of_string:OptionalKey.of_string
        ~of_json:OptionalValue.of_json j
    let to_json v = composed_to_json to_value v
  end
module DestinationS3BucketName =
  struct
    type nonrec t = string
    let context_ = "DestinationS3BucketName"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:63) >>=
             (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:"DestinationS3BucketName" j
    let to_json = simple_to_json to_value
  end
module DestinationS3Prefix =
  struct
    type nonrec t = string
    let context_ = "DestinationS3Prefix"
    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:"DestinationS3Prefix" j
    let to_json = simple_to_json to_value
  end
module FromDate =
  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 RoleNameArn =
  struct
    type nonrec t = string
    let context_ = "RoleNameArn"
    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:"RoleNameArn" j
    let to_json = simple_to_json to_value
  end
module SnsTopicArn =
  struct
    type nonrec t = string
    let context_ = "SnsTopicArn"
    let make i =
      let open Result in
        ok_or_failwith
          ((check_string_max i ~max:256) >>=
             (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:"SnsTopicArn" j
    let to_json = simple_to_json to_value
  end
module SupportDataSetType =
  struct
    type nonrec t =
      | Customer_support_contacts_data 
      | Test_customer_support_contacts_data 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Customer_support_contacts_data -> "customer_support_contacts_data"
      | Test_customer_support_contacts_data ->
          "test_customer_support_contacts_data"
      | Non_static_id s -> s
    let of_string =
      function
      | "customer_support_contacts_data" -> Customer_support_contacts_data
      | "test_customer_support_contacts_data" ->
          Test_customer_support_contacts_data
      | 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 SupportDataSetType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"SupportDataSetType" j)
    let to_json = simple_to_json to_value
  end
module DataSetPublicationDate =
  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 DataSetType =
  struct
    type nonrec t =
      | Customer_subscriber_hourly_monthly_subscriptions 
      | Customer_subscriber_annual_subscriptions 
      | Daily_business_usage_by_instance_type 
      | Daily_business_fees 
      | Daily_business_free_trial_conversions 
      | Daily_business_new_instances 
      | Daily_business_new_product_subscribers 
      | Daily_business_canceled_product_subscribers 
      | Monthly_revenue_billing_and_revenue_data 
      | Monthly_revenue_annual_subscriptions 
      | Monthly_revenue_field_demonstration_usage 
      | Monthly_revenue_flexible_payment_schedule 
      | Disbursed_amount_by_product 
      | Disbursed_amount_by_product_with_uncollected_funds 
      | Disbursed_amount_by_instance_hours 
      | Disbursed_amount_by_customer_geo 
      | Disbursed_amount_by_age_of_uncollected_funds 
      | Disbursed_amount_by_age_of_disbursed_funds 
      | Disbursed_amount_by_age_of_past_due_funds 
      | Disbursed_amount_by_uncollected_funds_breakdown 
      | Customer_profile_by_industry 
      | Customer_profile_by_revenue 
      | Customer_profile_by_geography 
      | Sales_compensation_billed_revenue 
      | Us_sales_and_use_tax_records 
      | Non_static_id of string 
    let make i = i
    let to_string =
      function
      | Customer_subscriber_hourly_monthly_subscriptions ->
          "customer_subscriber_hourly_monthly_subscriptions"
      | Customer_subscriber_annual_subscriptions ->
          "customer_subscriber_annual_subscriptions"
      | Daily_business_usage_by_instance_type ->
          "daily_business_usage_by_instance_type"
      | Daily_business_fees -> "daily_business_fees"
      | Daily_business_free_trial_conversions ->
          "daily_business_free_trial_conversions"
      | Daily_business_new_instances -> "daily_business_new_instances"
      | Daily_business_new_product_subscribers ->
          "daily_business_new_product_subscribers"
      | Daily_business_canceled_product_subscribers ->
          "daily_business_canceled_product_subscribers"
      | Monthly_revenue_billing_and_revenue_data ->
          "monthly_revenue_billing_and_revenue_data"
      | Monthly_revenue_annual_subscriptions ->
          "monthly_revenue_annual_subscriptions"
      | Monthly_revenue_field_demonstration_usage ->
          "monthly_revenue_field_demonstration_usage"
      | Monthly_revenue_flexible_payment_schedule ->
          "monthly_revenue_flexible_payment_schedule"
      | Disbursed_amount_by_product -> "disbursed_amount_by_product"
      | Disbursed_amount_by_product_with_uncollected_funds ->
          "disbursed_amount_by_product_with_uncollected_funds"
      | Disbursed_amount_by_instance_hours ->
          "disbursed_amount_by_instance_hours"
      | Disbursed_amount_by_customer_geo ->
          "disbursed_amount_by_customer_geo"
      | Disbursed_amount_by_age_of_uncollected_funds ->
          "disbursed_amount_by_age_of_uncollected_funds"
      | Disbursed_amount_by_age_of_disbursed_funds ->
          "disbursed_amount_by_age_of_disbursed_funds"
      | Disbursed_amount_by_age_of_past_due_funds ->
          "disbursed_amount_by_age_of_past_due_funds"
      | Disbursed_amount_by_uncollected_funds_breakdown ->
          "disbursed_amount_by_uncollected_funds_breakdown"
      | Customer_profile_by_industry -> "customer_profile_by_industry"
      | Customer_profile_by_revenue -> "customer_profile_by_revenue"
      | Customer_profile_by_geography -> "customer_profile_by_geography"
      | Sales_compensation_billed_revenue ->
          "sales_compensation_billed_revenue"
      | Us_sales_and_use_tax_records -> "us_sales_and_use_tax_records"
      | Non_static_id s -> s
    let of_string =
      function
      | "customer_subscriber_hourly_monthly_subscriptions" ->
          Customer_subscriber_hourly_monthly_subscriptions
      | "customer_subscriber_annual_subscriptions" ->
          Customer_subscriber_annual_subscriptions
      | "daily_business_usage_by_instance_type" ->
          Daily_business_usage_by_instance_type
      | "daily_business_fees" -> Daily_business_fees
      | "daily_business_free_trial_conversions" ->
          Daily_business_free_trial_conversions
      | "daily_business_new_instances" -> Daily_business_new_instances
      | "daily_business_new_product_subscribers" ->
          Daily_business_new_product_subscribers
      | "daily_business_canceled_product_subscribers" ->
          Daily_business_canceled_product_subscribers
      | "monthly_revenue_billing_and_revenue_data" ->
          Monthly_revenue_billing_and_revenue_data
      | "monthly_revenue_annual_subscriptions" ->
          Monthly_revenue_annual_subscriptions
      | "monthly_revenue_field_demonstration_usage" ->
          Monthly_revenue_field_demonstration_usage
      | "monthly_revenue_flexible_payment_schedule" ->
          Monthly_revenue_flexible_payment_schedule
      | "disbursed_amount_by_product" -> Disbursed_amount_by_product
      | "disbursed_amount_by_product_with_uncollected_funds" ->
          Disbursed_amount_by_product_with_uncollected_funds
      | "disbursed_amount_by_instance_hours" ->
          Disbursed_amount_by_instance_hours
      | "disbursed_amount_by_customer_geo" ->
          Disbursed_amount_by_customer_geo
      | "disbursed_amount_by_age_of_uncollected_funds" ->
          Disbursed_amount_by_age_of_uncollected_funds
      | "disbursed_amount_by_age_of_disbursed_funds" ->
          Disbursed_amount_by_age_of_disbursed_funds
      | "disbursed_amount_by_age_of_past_due_funds" ->
          Disbursed_amount_by_age_of_past_due_funds
      | "disbursed_amount_by_uncollected_funds_breakdown" ->
          Disbursed_amount_by_uncollected_funds_breakdown
      | "customer_profile_by_industry" -> Customer_profile_by_industry
      | "customer_profile_by_revenue" -> Customer_profile_by_revenue
      | "customer_profile_by_geography" -> Customer_profile_by_geography
      | "sales_compensation_billed_revenue" ->
          Sales_compensation_billed_revenue
      | "us_sales_and_use_tax_records" -> Us_sales_and_use_tax_records
      | 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 DataSetType" xml_arg0)
    let of_json j = of_string (string_of_json ~kind:"DataSetType" j)
    let to_json = simple_to_json to_value
  end
module StartSupportDataExportResult =
  struct
    type nonrec t =
      {
      dataSetRequestId: DataSetRequestId.t option
        [@ocaml.doc
          "This target has been deprecated. A unique identifier representing a specific request to the StartSupportDataExport operation. This identifier can be used to correlate a request with notifications from the SNS topic."]}
    type nonrec error =
      [
        `MarketplaceCommerceAnalyticsException of
          MarketplaceCommerceAnalyticsException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?dataSetRequestId = fun () -> { dataSetRequestId }
    let error_of_json name json =
      match name with
      | "MarketplaceCommerceAnalyticsException" ->
          `MarketplaceCommerceAnalyticsException
            (MarketplaceCommerceAnalyticsException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "MarketplaceCommerceAnalyticsException" ->
          `MarketplaceCommerceAnalyticsException
            (MarketplaceCommerceAnalyticsException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `MarketplaceCommerceAnalyticsException e ->
          `Assoc
            [("error", (`String "MarketplaceCommerceAnalyticsException"));
            ("details", (MarketplaceCommerceAnalyticsException.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
        [("dataSetRequestId",
           (Option.map x.dataSetRequestId ~f:DataSetRequestId.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dataSetRequestId =
        (Option.map ~f:DataSetRequestId.of_xml)
          (Xml.child xml_arg0 "dataSetRequestId") in
      make ?dataSetRequestId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dataSetRequestId =
        field_map json__ "dataSetRequestId" DataSetRequestId.of_json in
      make ?dataSetRequestId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This target has been deprecated. Container for the result of the StartSupportDataExport operation."]
module StartSupportDataExportRequest =
  struct
    type nonrec t =
      {
      dataSetType: SupportDataSetType.t
        [@ocaml.doc
          "This target has been deprecated. Specifies the data set type to be written to the output csv file. The data set types customer_support_contacts_data and test_customer_support_contacts_data both result in a csv file containing the following fields: Product Id, Product Code, Customer Guid, Subscription Guid, Subscription Start Date, Organization, AWS Account Id, Given Name, Surname, Telephone Number, Email, Title, Country Code, ZIP Code, Operation Type, and Operation Time. customer_support_contacts_data Customer support contact data. The data set will contain all changes (Creates, Updates, and Deletes) to customer support contact data from the date specified in the from_date parameter. test_customer_support_contacts_data An example data set containing static test data in the same format as customer_support_contacts_data"];
      fromDate: FromDate.t
        [@ocaml.doc
          "This target has been deprecated. The start date from which to retrieve the data set in UTC. This parameter only affects the customer_support_contacts_data data set type."];
      roleNameArn: RoleNameArn.t
        [@ocaml.doc
          "This target has been deprecated. The Amazon Resource Name (ARN) of the Role with an attached permissions policy to interact with the provided AWS services."];
      destinationS3BucketName: DestinationS3BucketName.t
        [@ocaml.doc
          "This target has been deprecated. The name (friendly name, not ARN) of the destination S3 bucket."];
      destinationS3Prefix: DestinationS3Prefix.t option
        [@ocaml.doc
          "This target has been deprecated. (Optional) The desired S3 prefix for the published data set, similar to a directory path in standard file systems. For example, if given the bucket name \"mybucket\" and the prefix \"myprefix/mydatasets\", the output file \"outputfile\" would be published to \"s3://mybucket/myprefix/mydatasets/outputfile\". If the prefix directory structure does not exist, it will be created. If no prefix is provided, the data set will be published to the S3 bucket root."];
      snsTopicArn: SnsTopicArn.t
        [@ocaml.doc
          "This target has been deprecated. Amazon Resource Name (ARN) for the SNS Topic that will be notified when the data set has been published or if an error has occurred."];
      customerDefinedValues: CustomerDefinedValues.t option
        [@ocaml.doc
          "This target has been deprecated. (Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and the data set metadata file."]}
    let context_ = "StartSupportDataExportRequest"
    let make ?destinationS3Prefix =
      fun ?customerDefinedValues ->
        fun ~dataSetType ->
          fun ~fromDate ->
            fun ~roleNameArn ->
              fun ~destinationS3BucketName ->
                fun ~snsTopicArn ->
                  fun () ->
                    {
                      destinationS3Prefix;
                      customerDefinedValues;
                      dataSetType;
                      fromDate;
                      roleNameArn;
                      destinationS3BucketName;
                      snsTopicArn
                    }
    let to_value x =
      structure_to_value
        [("dataSetType", (Some (SupportDataSetType.to_value x.dataSetType)));
        ("fromDate", (Some (FromDate.to_value x.fromDate)));
        ("roleNameArn", (Some (RoleNameArn.to_value x.roleNameArn)));
        ("destinationS3BucketName",
          (Some (DestinationS3BucketName.to_value x.destinationS3BucketName)));
        ("destinationS3Prefix",
          (Option.map x.destinationS3Prefix ~f:DestinationS3Prefix.to_value));
        ("snsTopicArn", (Some (SnsTopicArn.to_value x.snsTopicArn)));
        ("customerDefinedValues",
          (Option.map x.customerDefinedValues
             ~f:CustomerDefinedValues.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let customerDefinedValues =
        (Option.map ~f:CustomerDefinedValues.of_xml)
          (Xml.child xml_arg0 "customerDefinedValues") in
      let snsTopicArn =
        SnsTopicArn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "snsTopicArn") in
      let destinationS3Prefix =
        (Option.map ~f:DestinationS3Prefix.of_xml)
          (Xml.child xml_arg0 "destinationS3Prefix") in
      let destinationS3BucketName =
        DestinationS3BucketName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "destinationS3BucketName") in
      let roleNameArn =
        RoleNameArn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "roleNameArn") in
      let fromDate =
        FromDate.of_xml (Xml.child_exn ~context:context_ xml_arg0 "fromDate") in
      let dataSetType =
        SupportDataSetType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "dataSetType") in
      make ?customerDefinedValues ~snsTopicArn ?destinationS3Prefix
        ~destinationS3BucketName ~roleNameArn ~fromDate ~dataSetType ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let customerDefinedValues =
        field_map json__ "customerDefinedValues"
          CustomerDefinedValues.of_json in
      let snsTopicArn =
        field_map_exn json__ "snsTopicArn" SnsTopicArn.of_json in
      let destinationS3Prefix =
        field_map json__ "destinationS3Prefix" DestinationS3Prefix.of_json in
      let destinationS3BucketName =
        field_map_exn json__ "destinationS3BucketName"
          DestinationS3BucketName.of_json in
      let roleNameArn =
        field_map_exn json__ "roleNameArn" RoleNameArn.of_json in
      let fromDate = field_map_exn json__ "fromDate" FromDate.of_json in
      let dataSetType =
        field_map_exn json__ "dataSetType" SupportDataSetType.of_json in
      make ?customerDefinedValues ~snsTopicArn ?destinationS3Prefix
        ~destinationS3BucketName ~roleNameArn ~fromDate ~dataSetType ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "This target has been deprecated. Container for the parameters to the StartSupportDataExport operation."]
module GenerateDataSetResult =
  struct
    type nonrec t =
      {
      dataSetRequestId: DataSetRequestId.t option
        [@ocaml.doc
          "A unique identifier representing a specific request to the GenerateDataSet operation. This identifier can be used to correlate a request with notifications from the SNS topic."]}
    type nonrec error =
      [
        `MarketplaceCommerceAnalyticsException of
          MarketplaceCommerceAnalyticsException.t 
      | `Unknown_operation_error of (string * string option) ]
    let make ?dataSetRequestId = fun () -> { dataSetRequestId }
    let error_of_json name json =
      match name with
      | "MarketplaceCommerceAnalyticsException" ->
          `MarketplaceCommerceAnalyticsException
            (MarketplaceCommerceAnalyticsException.of_json json)
      | name ->
          `Unknown_operation_error
            (name, (Some (Yojson.Safe.to_string json)))
    let error_of_xml name xml =
      match name with
      | "MarketplaceCommerceAnalyticsException" ->
          `MarketplaceCommerceAnalyticsException
            (MarketplaceCommerceAnalyticsException.of_xml xml)
      | name ->
          `Unknown_operation_error (name, (Some (Awso.Xml.to_string xml)))
    let error_to_json : error -> Yojson.Safe.t =
      function
      | `MarketplaceCommerceAnalyticsException e ->
          `Assoc
            [("error", (`String "MarketplaceCommerceAnalyticsException"));
            ("details", (MarketplaceCommerceAnalyticsException.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
        [("dataSetRequestId",
           (Option.map x.dataSetRequestId ~f:DataSetRequestId.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let dataSetRequestId =
        (Option.map ~f:DataSetRequestId.of_xml)
          (Xml.child xml_arg0 "dataSetRequestId") in
      make ?dataSetRequestId ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let dataSetRequestId =
        field_map json__ "dataSetRequestId" DataSetRequestId.of_json in
      make ?dataSetRequestId ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Container for the result of the GenerateDataSet operation."]
module GenerateDataSetRequest =
  struct
    type nonrec t =
      {
      dataSetType: DataSetType.t
        [@ocaml.doc
          "The desired data set type. customer_subscriber_hourly_monthly_subscriptions From 2017-09-15 to present: Available daily by 24:00 UTC. customer_subscriber_annual_subscriptions From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_usage_by_instance_type From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_fees From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_free_trial_conversions From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_new_instances From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_new_product_subscribers From 2017-09-15 to present: Available daily by 24:00 UTC. daily_business_canceled_product_subscribers From 2017-09-15 to present: Available daily by 24:00 UTC. monthly_revenue_billing_and_revenue_data From 2017-09-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. Data includes metered transactions (e.g. hourly) from one month prior. monthly_revenue_annual_subscriptions From 2017-09-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. Data includes up-front software charges (e.g. annual) from one month prior. monthly_revenue_field_demonstration_usage From 2018-03-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. monthly_revenue_flexible_payment_schedule From 2018-11-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. disbursed_amount_by_product From 2017-09-15 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_instance_hours From 2017-09-15 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_customer_geo From 2017-09-15 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_age_of_uncollected_funds From 2017-09-15 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_age_of_disbursed_funds From 2017-09-15 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_age_of_past_due_funds From 2018-04-07 to present: Available every 30 days by 24:00 UTC. disbursed_amount_by_uncollected_funds_breakdown From 2019-10-04 to present: Available every 30 days by 24:00 UTC. sales_compensation_billed_revenue From 2017-09-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. Data includes metered transactions (e.g. hourly) from one month prior, and up-front software charges (e.g. annual) from one month prior. us_sales_and_use_tax_records From 2017-09-15 to present: Available monthly on the 15th day of the month by 24:00 UTC. disbursed_amount_by_product_with_uncollected_funds This data set is deprecated. Download related reports from AMMP instead! customer_profile_by_industry This data set is deprecated. Download related reports from AMMP instead! customer_profile_by_revenue This data set is deprecated. Download related reports from AMMP instead! customer_profile_by_geography This data set is deprecated. Download related reports from AMMP instead!"];
      dataSetPublicationDate: DataSetPublicationDate.t
        [@ocaml.doc
          "The date a data set was published. For daily data sets, provide a date with day-level granularity for the desired day. For monthly data sets except those with prefix disbursed_amount, provide a date with month-level granularity for the desired month (the day value will be ignored). For data sets with prefix disbursed_amount, provide a date with day-level granularity for the desired day. For these data sets we will look backwards in time over the range of 31 days until the first data set is found (the latest one)."];
      roleNameArn: RoleNameArn.t
        [@ocaml.doc
          "The Amazon Resource Name (ARN) of the Role with an attached permissions policy to interact with the provided AWS services."];
      destinationS3BucketName: DestinationS3BucketName.t
        [@ocaml.doc
          "The name (friendly name, not ARN) of the destination S3 bucket."];
      destinationS3Prefix: DestinationS3Prefix.t option
        [@ocaml.doc
          "(Optional) The desired S3 prefix for the published data set, similar to a directory path in standard file systems. For example, if given the bucket name \"mybucket\" and the prefix \"myprefix/mydatasets\", the output file \"outputfile\" would be published to \"s3://mybucket/myprefix/mydatasets/outputfile\". If the prefix directory structure does not exist, it will be created. If no prefix is provided, the data set will be published to the S3 bucket root."];
      snsTopicArn: SnsTopicArn.t
        [@ocaml.doc
          "Amazon Resource Name (ARN) for the SNS Topic that will be notified when the data set has been published or if an error has occurred."];
      customerDefinedValues: CustomerDefinedValues.t option
        [@ocaml.doc
          "(Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and the data set metadata file. These key-value pairs can be used to correlated responses with tracking information from other systems."]}
    let context_ = "GenerateDataSetRequest"
    let make ?destinationS3Prefix =
      fun ?customerDefinedValues ->
        fun ~dataSetType ->
          fun ~dataSetPublicationDate ->
            fun ~roleNameArn ->
              fun ~destinationS3BucketName ->
                fun ~snsTopicArn ->
                  fun () ->
                    {
                      destinationS3Prefix;
                      customerDefinedValues;
                      dataSetType;
                      dataSetPublicationDate;
                      roleNameArn;
                      destinationS3BucketName;
                      snsTopicArn
                    }
    let to_value x =
      structure_to_value
        [("dataSetType", (Some (DataSetType.to_value x.dataSetType)));
        ("dataSetPublicationDate",
          (Some (DataSetPublicationDate.to_value x.dataSetPublicationDate)));
        ("roleNameArn", (Some (RoleNameArn.to_value x.roleNameArn)));
        ("destinationS3BucketName",
          (Some (DestinationS3BucketName.to_value x.destinationS3BucketName)));
        ("destinationS3Prefix",
          (Option.map x.destinationS3Prefix ~f:DestinationS3Prefix.to_value));
        ("snsTopicArn", (Some (SnsTopicArn.to_value x.snsTopicArn)));
        ("customerDefinedValues",
          (Option.map x.customerDefinedValues
             ~f:CustomerDefinedValues.to_value))]
    let to_query v = to_query to_value v
    let of_xml xml_arg0 =
      let customerDefinedValues =
        (Option.map ~f:CustomerDefinedValues.of_xml)
          (Xml.child xml_arg0 "customerDefinedValues") in
      let snsTopicArn =
        SnsTopicArn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "snsTopicArn") in
      let destinationS3Prefix =
        (Option.map ~f:DestinationS3Prefix.of_xml)
          (Xml.child xml_arg0 "destinationS3Prefix") in
      let destinationS3BucketName =
        DestinationS3BucketName.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "destinationS3BucketName") in
      let roleNameArn =
        RoleNameArn.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "roleNameArn") in
      let dataSetPublicationDate =
        DataSetPublicationDate.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "dataSetPublicationDate") in
      let dataSetType =
        DataSetType.of_xml
          (Xml.child_exn ~context:context_ xml_arg0 "dataSetType") in
      make ?customerDefinedValues ~snsTopicArn ?destinationS3Prefix
        ~destinationS3BucketName ~roleNameArn ~dataSetPublicationDate
        ~dataSetType ()
    let of_string s = of_xml (Awso.Xml.parse_response s)[@@warning "-32"]
    let of_json json__ =
      let customerDefinedValues =
        field_map json__ "customerDefinedValues"
          CustomerDefinedValues.of_json in
      let snsTopicArn =
        field_map_exn json__ "snsTopicArn" SnsTopicArn.of_json in
      let destinationS3Prefix =
        field_map json__ "destinationS3Prefix" DestinationS3Prefix.of_json in
      let destinationS3BucketName =
        field_map_exn json__ "destinationS3BucketName"
          DestinationS3BucketName.of_json in
      let roleNameArn =
        field_map_exn json__ "roleNameArn" RoleNameArn.of_json in
      let dataSetPublicationDate =
        field_map_exn json__ "dataSetPublicationDate"
          DataSetPublicationDate.of_json in
      let dataSetType =
        field_map_exn json__ "dataSetType" DataSetType.of_json in
      make ?customerDefinedValues ~snsTopicArn ?destinationS3Prefix
        ~destinationS3BucketName ~roleNameArn ~dataSetPublicationDate
        ~dataSetType ()
    let to_json v = composed_to_json to_value v
  end[@@ocaml.doc
       "Container for the parameters to the GenerateDataSet operation."]