MarketplaceMetering.Client.
meter_usage
(**kwargs)¶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.
See also: AWS API Documentation
Request Syntax
response = client.meter_usage(
ProductCode='string',
Timestamp=datetime(2015, 1, 1),
UsageDimension='string',
UsageQuantity=123,
DryRun=True|False,
UsageAllocations=[
{
'AllocatedUsageQuantity': 123,
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
]
)
[REQUIRED]
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.
[REQUIRED]
Timestamp, in UTC, for which the usage is being reported. Your application can meter usage for up to one hour in the past. Make sure the timestamp
value is not before the start of the software usage.
[REQUIRED]
It will be one of the fcp dimension name provided during the publishing of the product.
0
if not specified.DryRunOperation
; otherwise, it returns UnauthorizedException
. Defaults to false
if not specified.The set of UsageAllocations
to submit.
The sum of all UsageAllocation
quantities must equal the UsageQuantity
of the MeterUsage
request, and each UsageAllocation
must have a unique set of tags (include no tags).
Usage allocations allow you to split usage into buckets by tags.
Each UsageAllocation
indicates the usage quantity for a specific set of tags.
The total quantity allocated to this bucket of usage.
The set of tags that define the bucket of usage. For the bucket of items with no tags, this parameter can be left out.
Metadata assigned to an allocation. Each tag is made up of a key
and a value
.
One part of a key-value pair that makes up a tag
. A key
is a label that acts like a category for the specific tag values.
One part of a key-value pair that makes up a tag
. A value
acts as a descriptor within a tag category (key). The value can be empty or null.
dict
Response Syntax
{
'MeteringRecordId': 'string'
}
Response Structure
(dict) --
MeteringRecordId (string) --
Metering record id.
Exceptions
MarketplaceMetering.Client.exceptions.InternalServiceErrorException
MarketplaceMetering.Client.exceptions.InvalidProductCodeException
MarketplaceMetering.Client.exceptions.InvalidUsageDimensionException
MarketplaceMetering.Client.exceptions.InvalidTagException
MarketplaceMetering.Client.exceptions.InvalidUsageAllocationsException
MarketplaceMetering.Client.exceptions.InvalidEndpointRegionException
MarketplaceMetering.Client.exceptions.TimestampOutOfBoundsException
MarketplaceMetering.Client.exceptions.DuplicateRequestException
MarketplaceMetering.Client.exceptions.ThrottlingException
MarketplaceMetering.Client.exceptions.CustomerNotEntitledException