Skip to content

Commit f57e27e

Browse files
author
AWS
committed
AWSMarketplace Metering Update: Added ClientToken parameter to MeterUsage API for specifying idempotent requests.
1 parent 6df3105 commit f57e27e

File tree

4 files changed

+70
-45
lines changed

4 files changed

+70
-45
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "feature",
3+
"category": "AWSMarketplace Metering",
4+
"contributor": "",
5+
"description": "Added ClientToken parameter to MeterUsage API for specifying idempotent requests."
6+
}

services/marketplacemetering/src/main/resources/codegen-resources/endpoint-rule-set.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
"required": true,
77
"default": false,
88
"documentation": "When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",
9-
"type": "Boolean"
9+
"type": "boolean"
1010
},
1111
"UseFIPS": {
1212
"builtIn": "AWS::UseFIPS",
1313
"required": true,
1414
"default": false,
1515
"documentation": "When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",
16-
"type": "Boolean"
16+
"type": "boolean"
1717
},
1818
"Endpoint": {
1919
"builtIn": "SDK::Endpoint",
2020
"required": false,
2121
"documentation": "Override the endpoint used to send this request",
22-
"type": "String"
22+
"type": "string"
2323
},
2424
"Region": {
2525
"builtIn": "AWS::Region",
2626
"required": false,
2727
"documentation": "The AWS region used to dispatch the request.",
28-
"type": "String"
28+
"type": "string"
2929
}
3030
},
3131
"rules": [

services/marketplacemetering/src/main/resources/codegen-resources/endpoint-tests.json

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -138,53 +138,27 @@
138138
}
139139
},
140140
{
141-
"documentation": "For region us-gov-west-1 with FIPS enabled and DualStack enabled",
142-
"expect": {
143-
"endpoint": {
144-
"url": "https://metering.marketplace-fips.us-gov-west-1.api.aws"
145-
}
146-
},
147-
"params": {
148-
"Region": "us-gov-west-1",
149-
"UseFIPS": true,
150-
"UseDualStack": true
151-
}
152-
},
153-
{
154-
"documentation": "For region us-gov-west-1 with FIPS enabled and DualStack disabled",
141+
"documentation": "For region eusc-de-east-1 with FIPS enabled and DualStack disabled",
155142
"expect": {
156143
"endpoint": {
157-
"url": "https://metering.marketplace-fips.us-gov-west-1.amazonaws.com"
144+
"url": "https://metering.marketplace-fips.eusc-de-east-1.amazonaws.eu"
158145
}
159146
},
160147
"params": {
161-
"Region": "us-gov-west-1",
148+
"Region": "eusc-de-east-1",
162149
"UseFIPS": true,
163150
"UseDualStack": false
164151
}
165152
},
166153
{
167-
"documentation": "For region us-gov-west-1 with FIPS disabled and DualStack enabled",
168-
"expect": {
169-
"endpoint": {
170-
"url": "https://metering-marketplace.us-gov-west-1.api.aws"
171-
}
172-
},
173-
"params": {
174-
"Region": "us-gov-west-1",
175-
"UseFIPS": false,
176-
"UseDualStack": true
177-
}
178-
},
179-
{
180-
"documentation": "For region us-gov-west-1 with FIPS disabled and DualStack disabled",
154+
"documentation": "For region eusc-de-east-1 with FIPS disabled and DualStack disabled",
181155
"expect": {
182156
"endpoint": {
183-
"url": "https://metering.marketplace.us-gov-west-1.amazonaws.com"
157+
"url": "https://metering.marketplace.eusc-de-east-1.amazonaws.eu"
184158
}
185159
},
186160
"params": {
187-
"Region": "us-gov-west-1",
161+
"Region": "eusc-de-east-1",
188162
"UseFIPS": false,
189163
"UseDualStack": false
190164
}
@@ -294,27 +268,53 @@
294268
}
295269
},
296270
{
297-
"documentation": "For region eusc-de-east-1 with FIPS enabled and DualStack disabled",
271+
"documentation": "For region us-gov-west-1 with FIPS enabled and DualStack enabled",
298272
"expect": {
299273
"endpoint": {
300-
"url": "https://metering.marketplace-fips.eusc-de-east-1.amazonaws.eu"
274+
"url": "https://metering.marketplace-fips.us-gov-west-1.api.aws"
301275
}
302276
},
303277
"params": {
304-
"Region": "eusc-de-east-1",
278+
"Region": "us-gov-west-1",
279+
"UseFIPS": true,
280+
"UseDualStack": true
281+
}
282+
},
283+
{
284+
"documentation": "For region us-gov-west-1 with FIPS enabled and DualStack disabled",
285+
"expect": {
286+
"endpoint": {
287+
"url": "https://metering.marketplace-fips.us-gov-west-1.amazonaws.com"
288+
}
289+
},
290+
"params": {
291+
"Region": "us-gov-west-1",
305292
"UseFIPS": true,
306293
"UseDualStack": false
307294
}
308295
},
309296
{
310-
"documentation": "For region eusc-de-east-1 with FIPS disabled and DualStack disabled",
297+
"documentation": "For region us-gov-west-1 with FIPS disabled and DualStack enabled",
311298
"expect": {
312299
"endpoint": {
313-
"url": "https://metering.marketplace.eusc-de-east-1.amazonaws.eu"
300+
"url": "https://metering-marketplace.us-gov-west-1.api.aws"
314301
}
315302
},
316303
"params": {
317-
"Region": "eusc-de-east-1",
304+
"Region": "us-gov-west-1",
305+
"UseFIPS": false,
306+
"UseDualStack": true
307+
}
308+
},
309+
{
310+
"documentation": "For region us-gov-west-1 with FIPS disabled and DualStack disabled",
311+
"expect": {
312+
"endpoint": {
313+
"url": "https://metering.marketplace.us-gov-west-1.amazonaws.com"
314+
}
315+
},
316+
"params": {
317+
"Region": "us-gov-west-1",
318318
"UseFIPS": false,
319319
"UseDualStack": false
320320
}

services/marketplacemetering/src/main/resources/codegen-resources/service-2.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{"shape":"ThrottlingException"},
3535
{"shape":"DisabledApiException"}
3636
],
37-
"documentation":"<important> <p> The <code>CustomerIdentifier</code> parameter is scheduled for deprecation. Use <code>CustomerAWSAccountID</code> instead.</p> <p>These parameters are mutually exclusive. You can't specify both <code>CustomerIdentifier</code> and <code>CustomerAWSAccountID</code> in the same request. </p> </important> <p>To post metering records for customers, SaaS applications call <code>BatchMeterUsage</code>, which is used for metering SaaS flexible consumption pricing (FCP). Identical requests are idempotent and can be retried with the same records or a subset of records. Each <code>BatchMeterUsage</code> request is for only one product. If you want to meter usage for multiple products, you must make multiple <code>BatchMeterUsage</code> calls.</p> <p>Usage records should be submitted in quick succession following a recorded event. Usage records aren't accepted 6 hours or more after an event.</p> <p> <code>BatchMeterUsage</code> can process up to 25 <code>UsageRecords</code> at a time, and each request must be less than 1 MB in size. Optionally, you can have multiple usage allocations for usage data that's split into buckets according to predefined tags.</p> <p> <code>BatchMeterUsage</code> returns a list of <code>UsageRecordResult</code> objects, which have each <code>UsageRecord</code>. It also returns a list of <code>UnprocessedRecords</code>, which indicate errors on the service side that should be retried.</p> <p>For Amazon Web Services Regions that support <code>BatchMeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#batchmeterusage-region-support\">BatchMeterUsage Region support</a>. </p> <note> <p>For an example of <code>BatchMeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/userguide/saas-code-examples.html#saas-batchmeterusage-example\"> BatchMeterUsage code example</a> in the <i>Amazon Web Services Marketplace Seller Guide</i>.</p> </note>"
37+
"documentation":"<important> <p> The <code>CustomerIdentifier</code> parameter is scheduled for deprecation on March 31, 2026. Use <code>CustomerAWSAccountID</code> instead.</p> <p>These parameters are mutually exclusive. You can't specify both <code>CustomerIdentifier</code> and <code>CustomerAWSAccountID</code> in the same request. </p> </important> <p>To post metering records for customers, SaaS applications call <code>BatchMeterUsage</code>, which is used for metering SaaS flexible consumption pricing (FCP). Identical requests are idempotent and can be retried with the same records or a subset of records. Each <code>BatchMeterUsage</code> request is for only one product. If you want to meter usage for multiple products, you must make multiple <code>BatchMeterUsage</code> calls.</p> <p>Usage records should be submitted in quick succession following a recorded event. Usage records aren't accepted 6 hours or more after an event.</p> <p> <code>BatchMeterUsage</code> can process up to 25 <code>UsageRecords</code> at a time, and each request must be less than 1 MB in size. Optionally, you can have multiple usage allocations for usage data that's split into buckets according to predefined tags.</p> <p> <code>BatchMeterUsage</code> returns a list of <code>UsageRecordResult</code> objects, which have each <code>UsageRecord</code>. It also returns a list of <code>UnprocessedRecords</code>, which indicate errors on the service side that should be retried.</p> <p>For Amazon Web Services Regions that support <code>BatchMeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#batchmeterusage-region-support\">BatchMeterUsage Region support</a>. </p> <note> <p>For an example of <code>BatchMeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/userguide/saas-code-examples.html#saas-batchmeterusage-example\"> BatchMeterUsage code example</a> in the <i>Amazon Web Services Marketplace Seller Guide</i>.</p> </note>"
3838
},
3939
"MeterUsage":{
4040
"name":"MeterUsage",
@@ -53,10 +53,11 @@
5353
{"shape":"InvalidEndpointRegionException"},
5454
{"shape":"TimestampOutOfBoundsException"},
5555
{"shape":"DuplicateRequestException"},
56+
{"shape":"IdempotencyConflictException"},
5657
{"shape":"ThrottlingException"},
5758
{"shape":"CustomerNotEntitledException"}
5859
],
59-
"documentation":"<p>API to emit metering records. For identical requests, the API is idempotent and returns the metering record ID. This is used for metering flexible consumption pricing (FCP) Amazon Machine Images (AMI) and container products.</p> <p> <code>MeterUsage</code> is authenticated on the buyer's Amazon Web Services account using credentials from the Amazon EC2 instance, Amazon ECS task, or Amazon EKS pod.</p> <p> <code>MeterUsage</code> 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).</p> <p>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.</p> <p>For Amazon Web Services Regions that support <code>MeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#meterusage-region-support-ec2\">MeterUsage Region support for Amazon EC2</a> and <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#meterusage-region-support-ecs-eks\">MeterUsage Region support for Amazon ECS and Amazon EKS</a>. </p>"
60+
"documentation":"<p>API to emit metering records. For identical requests, the API is idempotent and returns the metering record ID. This is used for metering flexible consumption pricing (FCP) Amazon Machine Images (AMI) and container products.</p> <p> <code>MeterUsage</code> is authenticated on the buyer's Amazon Web Services account using credentials from the Amazon EC2 instance, Amazon ECS task, or Amazon EKS pod.</p> <p> <code>MeterUsage</code> 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).</p> <p>Submit usage records to report events from the previous hour. If you submit records that are greater than six hours after events occur, the records won’t be accepted. The timestamp in your request determines when an event is recorded. You can only report usage once per hour for each dimension. For AMI-based products, this is per dimension and per EC2 instance. For container products, this is per dimension and per ECS task or EKS pod. You can’t modify values after they’re recorded. If you report usage before the current hour ends, you will be unable to report additional usage until the next hour begins.</p> <p>For Amazon Web Services Regions that support <code>MeterUsage</code>, see <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#meterusage-region-support-ec2\">MeterUsage Region support for Amazon EC2</a> and <a href=\"https://docs.aws.amazon.com/marketplace/latest/APIReference/metering-regions.html#meterusage-region-support-ecs-eks\">MeterUsage Region support for Amazon ECS and Amazon EKS</a>. </p>"
6061
},
6162
"RegisterUsage":{
6263
"name":"RegisterUsage",
@@ -135,6 +136,11 @@
135136
"documentation":"<p>Contains the <code>UsageRecords</code> processed by <code>BatchMeterUsage</code> and any records that have failed due to transient error.</p>"
136137
},
137138
"Boolean":{"type":"boolean"},
139+
"ClientToken":{
140+
"type":"string",
141+
"max":64,
142+
"min":1
143+
},
138144
"CustomerAWSAccountId":{
139145
"type":"string",
140146
"max":255,
@@ -179,6 +185,14 @@
179185
"documentation":"<p>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.</p>",
180186
"exception":true
181187
},
188+
"IdempotencyConflictException":{
189+
"type":"structure",
190+
"members":{
191+
"message":{"shape":"errorMessage"}
192+
},
193+
"documentation":"<p>The <code>ClientToken</code> is being used for multiple requests.</p>",
194+
"exception":true
195+
},
182196
"InternalServiceErrorException":{
183197
"type":"structure",
184198
"members":{
@@ -291,6 +305,11 @@
291305
"UsageAllocations":{
292306
"shape":"UsageAllocations",
293307
"documentation":"<p>The set of <code>UsageAllocations</code> to submit.</p> <p>The sum of all <code>UsageAllocation</code> quantities must equal the <code>UsageQuantity</code> of the <code>MeterUsage</code> request, and each <code>UsageAllocation</code> must have a unique set of tags (include no tags).</p>"
308+
},
309+
"ClientToken":{
310+
"shape":"ClientToken",
311+
"documentation":"<p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href=\"https://wikipedia.org/wiki/Universally_unique_identifier\">UUID type of value</a>.</p> <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p> <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotencyConflictException</code> error.</p>",
312+
"idempotencyToken":true
294313
}
295314
}
296315
},
@@ -484,7 +503,7 @@
484503
"members":{
485504
"Timestamp":{
486505
"shape":"Timestamp",
487-
"documentation":"<p>Timestamp, in UTC, for which the usage is being reported.</p> <p>Your application can meter usage for up to one hour in the past. Make sure the <code>timestamp</code> value is not before the start of the software usage.</p>"
506+
"documentation":"<p>Timestamp, in UTC, for which the usage is being reported.</p> <p>Your application can meter usage for up to six hours in the past. Make sure the <code>timestamp</code> value is not before the start of the software usage.</p>"
488507
},
489508
"CustomerIdentifier":{
490509
"shape":"CustomerIdentifier",

0 commit comments

Comments
 (0)