-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
api.go
2493 lines (2161 loc) · 82.8 KB
/
api.go
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
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package marketplacemetering
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol"
)
const opBatchMeterUsage = "BatchMeterUsage"
// BatchMeterUsageRequest generates a "aws/request.Request" representing the
// client's request for the BatchMeterUsage operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See BatchMeterUsage for more information on using the BatchMeterUsage
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// // Example sending a request using the BatchMeterUsageRequest method.
// req, resp := client.BatchMeterUsageRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/BatchMeterUsage
func (c *MarketplaceMetering) BatchMeterUsageRequest(input *BatchMeterUsageInput) (req *request.Request, output *BatchMeterUsageOutput) {
op := &request.Operation{
Name: opBatchMeterUsage,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &BatchMeterUsageInput{}
}
output = &BatchMeterUsageOutput{}
req = c.newRequest(op, input, output)
return
}
// BatchMeterUsage API operation for AWSMarketplace Metering.
//
// BatchMeterUsage is called from a SaaS application listed on AWS Marketplace
// to post metering records for a set of customers.
//
// For identical requests, the API is idempotent; requests can be retried with
// the same records or a subset of the input records.
//
// Every request to BatchMeterUsage is for one product. If you need to meter
// usage for multiple products, you must make multiple calls to BatchMeterUsage.
//
// Usage records are expected to be submitted as quickly as possible after the
// event that is being recorded, and are not accepted more than 6 hours after
// the event.
//
// BatchMeterUsage can process up to 25 UsageRecords at a time.
//
// A UsageRecord can optionally include multiple usage allocations, to provide
// customers with usage data split into buckets by tags that you define (or
// allow the customer to define).
//
// BatchMeterUsage returns a list of UsageRecordResult objects, showing the
// result for each UsageRecord, as well as a list of UnprocessedRecords, indicating
// errors in the service side that you should retry.
//
// BatchMeterUsage requests must be less than 1MB in size.
//
// For an example of using BatchMeterUsage, see BatchMeterUsage code example
// (https://docs.aws.amazon.com/marketplace/latest/userguide/saas-code-examples.html#saas-batchmeterusage-example)
// in the AWS Marketplace Seller Guide.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for AWSMarketplace Metering's
// API operation BatchMeterUsage for usage and error information.
//
// Returned Error Types:
//
// - InternalServiceErrorException
// An internal error has occurred. Retry your request. If the problem persists,
// post a message with details on the AWS forums.
//
// - InvalidProductCodeException
// The product code passed does not match the product code used for publishing
// the product.
//
// - InvalidUsageDimensionException
// The usage dimension does not match one of the UsageDimensions associated
// with products.
//
// - InvalidTagException
// The tag is invalid, or the number of tags is greater than 5.
//
// - InvalidUsageAllocationsException
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
//
// - InvalidCustomerIdentifierException
// You have metered usage for a CustomerIdentifier that does not exist.
//
// - TimestampOutOfBoundsException
// The timestamp value passed in the UsageRecord is out of allowed range.
//
// For BatchMeterUsage, if any of the records are outside of the allowed range,
// the entire batch is not processed. You must remove invalid records and try
// again.
//
// - ThrottlingException
// The calls to the API are throttled.
//
// - DisabledApiException
// The API is disabled in the Region.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/BatchMeterUsage
func (c *MarketplaceMetering) BatchMeterUsage(input *BatchMeterUsageInput) (*BatchMeterUsageOutput, error) {
req, out := c.BatchMeterUsageRequest(input)
return out, req.Send()
}
// BatchMeterUsageWithContext is the same as BatchMeterUsage with the addition of
// the ability to pass a context and additional request options.
//
// See BatchMeterUsage for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *MarketplaceMetering) BatchMeterUsageWithContext(ctx aws.Context, input *BatchMeterUsageInput, opts ...request.Option) (*BatchMeterUsageOutput, error) {
req, out := c.BatchMeterUsageRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opMeterUsage = "MeterUsage"
// MeterUsageRequest generates a "aws/request.Request" representing the
// client's request for the MeterUsage operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See MeterUsage for more information on using the MeterUsage
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// // Example sending a request using the MeterUsageRequest method.
// req, resp := client.MeterUsageRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/MeterUsage
func (c *MarketplaceMetering) MeterUsageRequest(input *MeterUsageInput) (req *request.Request, output *MeterUsageOutput) {
op := &request.Operation{
Name: opMeterUsage,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &MeterUsageInput{}
}
output = &MeterUsageOutput{}
req = c.newRequest(op, input, output)
return
}
// MeterUsage API operation for AWSMarketplace Metering.
//
// API to emit metering records. For identical requests, the API is idempotent.
// It simply returns the metering record ID.
//
// MeterUsage is authenticated on the buyer's AWS account using credentials
// from the EC2 instance, ECS task, or EKS pod.
//
// MeterUsage can optionally include multiple usage allocations, to provide
// customers with usage data split into buckets by tags that you define (or
// allow the customer to define).
//
// Usage records are expected to be submitted as quickly as possible after the
// event that is being recorded, and are not accepted more than 6 hours after
// the event.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for AWSMarketplace Metering's
// API operation MeterUsage for usage and error information.
//
// Returned Error Types:
//
// - InternalServiceErrorException
// An internal error has occurred. Retry your request. If the problem persists,
// post a message with details on the AWS forums.
//
// - InvalidProductCodeException
// The product code passed does not match the product code used for publishing
// the product.
//
// - InvalidUsageDimensionException
// The usage dimension does not match one of the UsageDimensions associated
// with products.
//
// - InvalidTagException
// The tag is invalid, or the number of tags is greater than 5.
//
// - InvalidUsageAllocationsException
// The usage allocation objects are invalid, or the number of allocations is
// greater than 500 for a single usage record.
//
// - InvalidEndpointRegionException
// The endpoint being called is in a AWS Region different from your EC2 instance,
// ECS task, or EKS pod. The Region of the Metering Service endpoint and the
// AWS Region of the resource must match.
//
// - TimestampOutOfBoundsException
// The timestamp value passed in the UsageRecord is out of allowed range.
//
// For BatchMeterUsage, if any of the records are outside of the allowed range,
// the entire batch is not processed. You must remove invalid records and try
// again.
//
// - DuplicateRequestException
// A metering record has already been emitted by the same EC2 instance, ECS
// task, or EKS pod for the given {usageDimension, timestamp} with a different
// usageQuantity.
//
// - ThrottlingException
// The calls to the API are throttled.
//
// - CustomerNotEntitledException
// Exception thrown when the customer does not have a valid subscription for
// the product.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/MeterUsage
func (c *MarketplaceMetering) MeterUsage(input *MeterUsageInput) (*MeterUsageOutput, error) {
req, out := c.MeterUsageRequest(input)
return out, req.Send()
}
// MeterUsageWithContext is the same as MeterUsage with the addition of
// the ability to pass a context and additional request options.
//
// See MeterUsage for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *MarketplaceMetering) MeterUsageWithContext(ctx aws.Context, input *MeterUsageInput, opts ...request.Option) (*MeterUsageOutput, error) {
req, out := c.MeterUsageRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opRegisterUsage = "RegisterUsage"
// RegisterUsageRequest generates a "aws/request.Request" representing the
// client's request for the RegisterUsage operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See RegisterUsage for more information on using the RegisterUsage
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// // Example sending a request using the RegisterUsageRequest method.
// req, resp := client.RegisterUsageRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/RegisterUsage
func (c *MarketplaceMetering) RegisterUsageRequest(input *RegisterUsageInput) (req *request.Request, output *RegisterUsageOutput) {
op := &request.Operation{
Name: opRegisterUsage,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &RegisterUsageInput{}
}
output = &RegisterUsageOutput{}
req = c.newRequest(op, input, output)
return
}
// RegisterUsage API operation for AWSMarketplace Metering.
//
// Paid container software products sold through AWS Marketplace must integrate
// with the AWS Marketplace Metering Service and call the RegisterUsage operation
// for software entitlement and metering. Free and BYOL products for Amazon
// ECS or Amazon EKS aren't required to call RegisterUsage, but you may choose
// to do so if you would like to receive usage data in your seller reports.
// The sections below explain the behavior of RegisterUsage. RegisterUsage performs
// two primary functions: metering and entitlement.
//
// - Entitlement: RegisterUsage allows you to verify that the customer running
// your paid software is subscribed to your product on AWS Marketplace, enabling
// you to guard against unauthorized use. Your container image that integrates
// with RegisterUsage is only required to guard against unauthorized use
// at container startup, as such a CustomerNotSubscribedException or PlatformNotSupportedException
// will only be thrown on the initial call to RegisterUsage. Subsequent calls
// from the same Amazon ECS task instance (e.g. task-id) or Amazon EKS pod
// will not throw a CustomerNotSubscribedException, even if the customer
// unsubscribes while the Amazon ECS task or Amazon EKS pod is still running.
//
// - Metering: RegisterUsage meters software use per ECS task, per hour,
// or per pod for Amazon EKS with usage prorated to the second. A minimum
// of 1 minute of usage applies to tasks that are short lived. For example,
// if a customer has a 10 node Amazon ECS or Amazon EKS cluster and a service
// configured as a Daemon Set, then Amazon ECS or Amazon EKS will launch
// a task on all 10 cluster nodes and the customer will be charged: (10 *
// hourly_rate). Metering for software use is automatically handled by the
// AWS Marketplace Metering Control Plane -- your software is not required
// to perform any metering specific actions, other than call RegisterUsage
// once for metering of software use to commence. The AWS Marketplace Metering
// Control Plane will also continue to bill customers for running ECS tasks
// and Amazon EKS pods, regardless of the customers subscription state, removing
// the need for your software to perform entitlement checks at runtime.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for AWSMarketplace Metering's
// API operation RegisterUsage for usage and error information.
//
// Returned Error Types:
//
// - InvalidProductCodeException
// The product code passed does not match the product code used for publishing
// the product.
//
// - InvalidRegionException
// RegisterUsage must be called in the same AWS Region the ECS task was launched
// in. This prevents a container from hardcoding a Region (e.g. withRegion(“us-east-1”)
// when calling RegisterUsage.
//
// - InvalidPublicKeyVersionException
// Public Key version is invalid.
//
// - PlatformNotSupportedException
// AWS Marketplace does not support metering usage from the underlying platform.
// Currently, Amazon ECS, Amazon EKS, and AWS Fargate are supported.
//
// - CustomerNotEntitledException
// Exception thrown when the customer does not have a valid subscription for
// the product.
//
// - ThrottlingException
// The calls to the API are throttled.
//
// - InternalServiceErrorException
// An internal error has occurred. Retry your request. If the problem persists,
// post a message with details on the AWS forums.
//
// - DisabledApiException
// The API is disabled in the Region.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/RegisterUsage
func (c *MarketplaceMetering) RegisterUsage(input *RegisterUsageInput) (*RegisterUsageOutput, error) {
req, out := c.RegisterUsageRequest(input)
return out, req.Send()
}
// RegisterUsageWithContext is the same as RegisterUsage with the addition of
// the ability to pass a context and additional request options.
//
// See RegisterUsage for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *MarketplaceMetering) RegisterUsageWithContext(ctx aws.Context, input *RegisterUsageInput, opts ...request.Option) (*RegisterUsageOutput, error) {
req, out := c.RegisterUsageRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
const opResolveCustomer = "ResolveCustomer"
// ResolveCustomerRequest generates a "aws/request.Request" representing the
// client's request for the ResolveCustomer operation. The "output" return
// value will be populated with the request's response once the request completes
// successfully.
//
// Use "Send" method on the returned Request to send the API call to the service.
// the "output" return value is not valid until after Send returns without error.
//
// See ResolveCustomer for more information on using the ResolveCustomer
// API call, and error handling.
//
// This method is useful when you want to inject custom logic or configuration
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
//
// // Example sending a request using the ResolveCustomerRequest method.
// req, resp := client.ResolveCustomerRequest(params)
//
// err := req.Send()
// if err == nil { // resp is now filled
// fmt.Println(resp)
// }
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/ResolveCustomer
func (c *MarketplaceMetering) ResolveCustomerRequest(input *ResolveCustomerInput) (req *request.Request, output *ResolveCustomerOutput) {
op := &request.Operation{
Name: opResolveCustomer,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &ResolveCustomerInput{}
}
output = &ResolveCustomerOutput{}
req = c.newRequest(op, input, output)
return
}
// ResolveCustomer API operation for AWSMarketplace Metering.
//
// ResolveCustomer is called by a SaaS application during the registration process.
// When a buyer visits your website during the registration process, the buyer
// submits a registration token through their browser. The registration token
// is resolved through this API to obtain a CustomerIdentifier along with the
// CustomerAWSAccountId and ProductCode.
//
// The API needs to called from the seller account id used to publish the SaaS
// application to successfully resolve the token.
//
// For an example of using ResolveCustomer, see ResolveCustomer code example
// (https://docs.aws.amazon.com/marketplace/latest/userguide/saas-code-examples.html#saas-resolvecustomer-example)
// in the AWS Marketplace Seller Guide.
//
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
// with awserr.Error's Code and Message methods to get detailed information about
// the error.
//
// See the AWS API reference guide for AWSMarketplace Metering's
// API operation ResolveCustomer for usage and error information.
//
// Returned Error Types:
//
// - InvalidTokenException
// Registration token is invalid.
//
// - ExpiredTokenException
// The submitted registration token has expired. This can happen if the buyer's
// browser takes too long to redirect to your page, the buyer has resubmitted
// the registration token, or your application has held on to the registration
// token for too long. Your SaaS registration website should redeem this token
// as soon as it is submitted by the buyer's browser.
//
// - ThrottlingException
// The calls to the API are throttled.
//
// - InternalServiceErrorException
// An internal error has occurred. Retry your request. If the problem persists,
// post a message with details on the AWS forums.
//
// - DisabledApiException
// The API is disabled in the Region.
//
// See also, https://docs.aws.amazon.com/goto/WebAPI/meteringmarketplace-2016-01-14/ResolveCustomer
func (c *MarketplaceMetering) ResolveCustomer(input *ResolveCustomerInput) (*ResolveCustomerOutput, error) {
req, out := c.ResolveCustomerRequest(input)
return out, req.Send()
}
// ResolveCustomerWithContext is the same as ResolveCustomer with the addition of
// the ability to pass a context and additional request options.
//
// See ResolveCustomer for details on how to use this API operation.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *MarketplaceMetering) ResolveCustomerWithContext(ctx aws.Context, input *ResolveCustomerInput, opts ...request.Option) (*ResolveCustomerOutput, error) {
req, out := c.ResolveCustomerRequest(input)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return out, req.Send()
}
// A BatchMeterUsageRequest contains UsageRecords, which indicate quantities
// of usage within your application.
type BatchMeterUsageInput struct {
_ struct{} `type:"structure"`
// Product code is used to uniquely identify a product in AWS Marketplace. The
// product code should be the same as the one used during the publishing of
// a new product.
//
// ProductCode is a required field
ProductCode *string `min:"1" type:"string" required:"true"`
// The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords
// at a time.
//
// UsageRecords is a required field
UsageRecords []*UsageRecord `type:"list" required:"true"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s BatchMeterUsageInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s BatchMeterUsageInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *BatchMeterUsageInput) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "BatchMeterUsageInput"}
if s.ProductCode == nil {
invalidParams.Add(request.NewErrParamRequired("ProductCode"))
}
if s.ProductCode != nil && len(*s.ProductCode) < 1 {
invalidParams.Add(request.NewErrParamMinLen("ProductCode", 1))
}
if s.UsageRecords == nil {
invalidParams.Add(request.NewErrParamRequired("UsageRecords"))
}
if s.UsageRecords != nil {
for i, v := range s.UsageRecords {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "UsageRecords", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetProductCode sets the ProductCode field's value.
func (s *BatchMeterUsageInput) SetProductCode(v string) *BatchMeterUsageInput {
s.ProductCode = &v
return s
}
// SetUsageRecords sets the UsageRecords field's value.
func (s *BatchMeterUsageInput) SetUsageRecords(v []*UsageRecord) *BatchMeterUsageInput {
s.UsageRecords = v
return s
}
// Contains the UsageRecords processed by BatchMeterUsage and any records that
// have failed due to transient error.
type BatchMeterUsageOutput struct {
_ struct{} `type:"structure"`
// Contains all UsageRecords processed by BatchMeterUsage. These records were
// either honored by AWS Marketplace Metering Service or were invalid. Invalid
// records should be fixed before being resubmitted.
Results []*UsageRecordResult `type:"list"`
// Contains all UsageRecords that were not processed by BatchMeterUsage. This
// is a list of UsageRecords. You can retry the failed request by making another
// BatchMeterUsage call with this list as input in the BatchMeterUsageRequest.
UnprocessedRecords []*UsageRecord `type:"list"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s BatchMeterUsageOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s BatchMeterUsageOutput) GoString() string {
return s.String()
}
// SetResults sets the Results field's value.
func (s *BatchMeterUsageOutput) SetResults(v []*UsageRecordResult) *BatchMeterUsageOutput {
s.Results = v
return s
}
// SetUnprocessedRecords sets the UnprocessedRecords field's value.
func (s *BatchMeterUsageOutput) SetUnprocessedRecords(v []*UsageRecord) *BatchMeterUsageOutput {
s.UnprocessedRecords = v
return s
}
// Exception thrown when the customer does not have a valid subscription for
// the product.
type CustomerNotEntitledException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s CustomerNotEntitledException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s CustomerNotEntitledException) GoString() string {
return s.String()
}
func newErrorCustomerNotEntitledException(v protocol.ResponseMetadata) error {
return &CustomerNotEntitledException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *CustomerNotEntitledException) Code() string {
return "CustomerNotEntitledException"
}
// Message returns the exception's message.
func (s *CustomerNotEntitledException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *CustomerNotEntitledException) OrigErr() error {
return nil
}
func (s *CustomerNotEntitledException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s *CustomerNotEntitledException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *CustomerNotEntitledException) RequestID() string {
return s.RespMetadata.RequestID
}
// The API is disabled in the Region.
type DisabledApiException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s DisabledApiException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s DisabledApiException) GoString() string {
return s.String()
}
func newErrorDisabledApiException(v protocol.ResponseMetadata) error {
return &DisabledApiException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *DisabledApiException) Code() string {
return "DisabledApiException"
}
// Message returns the exception's message.
func (s *DisabledApiException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *DisabledApiException) OrigErr() error {
return nil
}
func (s *DisabledApiException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s *DisabledApiException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *DisabledApiException) RequestID() string {
return s.RespMetadata.RequestID
}
// A metering record has already been emitted by the same EC2 instance, ECS
// task, or EKS pod for the given {usageDimension, timestamp} with a different
// usageQuantity.
type DuplicateRequestException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s DuplicateRequestException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s DuplicateRequestException) GoString() string {
return s.String()
}
func newErrorDuplicateRequestException(v protocol.ResponseMetadata) error {
return &DuplicateRequestException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *DuplicateRequestException) Code() string {
return "DuplicateRequestException"
}
// Message returns the exception's message.
func (s *DuplicateRequestException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *DuplicateRequestException) OrigErr() error {
return nil
}
func (s *DuplicateRequestException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s *DuplicateRequestException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *DuplicateRequestException) RequestID() string {
return s.RespMetadata.RequestID
}
// The submitted registration token has expired. This can happen if the buyer's
// browser takes too long to redirect to your page, the buyer has resubmitted
// the registration token, or your application has held on to the registration
// token for too long. Your SaaS registration website should redeem this token
// as soon as it is submitted by the buyer's browser.
type ExpiredTokenException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s ExpiredTokenException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s ExpiredTokenException) GoString() string {
return s.String()
}
func newErrorExpiredTokenException(v protocol.ResponseMetadata) error {
return &ExpiredTokenException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *ExpiredTokenException) Code() string {
return "ExpiredTokenException"
}
// Message returns the exception's message.
func (s *ExpiredTokenException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *ExpiredTokenException) OrigErr() error {
return nil
}
func (s *ExpiredTokenException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s *ExpiredTokenException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *ExpiredTokenException) RequestID() string {
return s.RespMetadata.RequestID
}
// An internal error has occurred. Retry your request. If the problem persists,
// post a message with details on the AWS forums.
type InternalServiceErrorException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s InternalServiceErrorException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s InternalServiceErrorException) GoString() string {
return s.String()
}
func newErrorInternalServiceErrorException(v protocol.ResponseMetadata) error {
return &InternalServiceErrorException{
RespMetadata: v,
}
}
// Code returns the exception type name.
func (s *InternalServiceErrorException) Code() string {
return "InternalServiceErrorException"
}
// Message returns the exception's message.
func (s *InternalServiceErrorException) Message() string {
if s.Message_ != nil {
return *s.Message_
}
return ""
}
// OrigErr always returns nil, satisfies awserr.Error interface.
func (s *InternalServiceErrorException) OrigErr() error {
return nil
}
func (s *InternalServiceErrorException) Error() string {
return fmt.Sprintf("%s: %s", s.Code(), s.Message())
}
// Status code returns the HTTP status code for the request's response error.
func (s *InternalServiceErrorException) StatusCode() int {
return s.RespMetadata.StatusCode
}
// RequestID returns the service's response RequestID for request.
func (s *InternalServiceErrorException) RequestID() string {
return s.RespMetadata.RequestID
}
// You have metered usage for a CustomerIdentifier that does not exist.
type InvalidCustomerIdentifierException struct {
_ struct{} `type:"structure"`
RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
Message_ *string `locationName:"message" type:"string"`
}
// String returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".
func (s InvalidCustomerIdentifierException) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation.
//
// API parameter values that are decorated as "sensitive" in the API will not
// be included in the string output. The member name will be present, but the
// value will be replaced with "sensitive".