@datafire/amazonaws_metering_marketplace
Client library for AWSMarketplace Metering
Installation and Usage
npm install --save @datafire/amazonaws_metering_marketplace
let amazonaws_metering_marketplace = require('@datafire/amazonaws_metering_marketplace').create({
accessKeyId: "",
secretAccessKey: "",
region: ""
});
amazonaws_metering_marketplace.BatchMeterUsage({
"UsageRecords": [],
"ProductCode": ""
}).then(data => {
console.log(data);
});
Description
AWS Marketplace Metering Service
This reference provides descriptions of the low-level AWS Marketplace Metering Service API.
AWS Marketplace sellers can use this API to submit usage data for custom usage dimensions.
Submitting Metering Records
-
MeterUsage- Submits the metering record for a Marketplace product. MeterUsage is called from an EC2 instance.
-
BatchMeterUsage- Submits the metering record for a set of customers. BatchMeterUsage is called from a software-as-a-service (SaaS) application.
Accepting New Customers
-
ResolveCustomer- 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 the browser. The Registration Token is resolved through this API to obtain a CustomerIdentifier and Product Code.
Actions
BatchMeterUsage
amazonaws_metering_marketplace.BatchMeterUsage({
"UsageRecords": [],
"ProductCode": ""
}, context)
Input
- input
object
- ProductCode required ProductCode
- UsageRecords required UsageRecordList
Output
- output BatchMeterUsageResult
MeterUsage
amazonaws_metering_marketplace.MeterUsage({
"ProductCode": "",
"Timestamp": "",
"UsageDimension": "",
"UsageQuantity": 0,
"DryRun": true
}, context)
Input
- input
object
- DryRun required Boolean
- ProductCode required ProductCode
- Timestamp required Timestamp
- UsageDimension required UsageDimension
- UsageQuantity required UsageQuantity
Output
- output MeterUsageResult
ResolveCustomer
amazonaws_metering_marketplace.ResolveCustomer({
"RegistrationToken": ""
}, context)
Input
- input
object
- RegistrationToken required NonEmptyString
Output
- output ResolveCustomerResult
Definitions
BatchMeterUsageRequest
- BatchMeterUsageRequest
object
: A BatchMeterUsageRequest contains UsageRecords, which indicate quantities of usage within your application.- ProductCode required ProductCode
- UsageRecords required UsageRecordList
BatchMeterUsageResult
- BatchMeterUsageResult
object
: Contains the UsageRecords processed by BatchMeterUsage and any records that have failed due to transient error.- Results UsageRecordResultList
- UnprocessedRecords UsageRecordList
Boolean
- Boolean
boolean
CustomerIdentifier
- CustomerIdentifier
string
DuplicateRequestException
- DuplicateRequestException
object
: A metering record has already been emitted by the same EC2 instance for the given {usageDimension, timestamp} with a different usageQuantity.- message errorMessage
ExpiredTokenException
- ExpiredTokenException
object
: 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.- message errorMessage
InternalServiceErrorException
- InternalServiceErrorException
object
: An internal error has occurred. Retry your request. If the problem persists, post a message with details on the AWS forums.- message errorMessage
InvalidCustomerIdentifierException
- InvalidCustomerIdentifierException
object
: You have metered usage for a CustomerIdentifier that does not exist.- message errorMessage
InvalidEndpointRegionException
- InvalidEndpointRegionException
object
: The endpoint being called is in a region different from your EC2 instance. The region of the Metering service endpoint and the region of the EC2 instance must match.- message errorMessage
InvalidProductCodeException
- InvalidProductCodeException
object
: The product code passed does not match the product code used for publishing the product.- message errorMessage
InvalidTokenException
- InvalidTokenException
object
- message errorMessage
InvalidUsageDimensionException
- InvalidUsageDimensionException
object
: The usage dimension does not match one of the UsageDimensions associated with products.- message errorMessage
MeterUsageRequest
- MeterUsageRequest
object
- DryRun required Boolean
- ProductCode required ProductCode
- Timestamp required Timestamp
- UsageDimension required UsageDimension
- UsageQuantity required UsageQuantity
MeterUsageResult
- MeterUsageResult
object
- MeteringRecordId String
NonEmptyString
- NonEmptyString
string
ProductCode
- ProductCode
string
ResolveCustomerRequest
- ResolveCustomerRequest
object
: Contains input to the ResolveCustomer operation.- RegistrationToken required NonEmptyString
ResolveCustomerResult
- ResolveCustomerResult
object
: The result of the ResolveCustomer operation. Contains the CustomerIdentifier and product code.- CustomerIdentifier CustomerIdentifier
- ProductCode ProductCode
String
- String
string
ThrottlingException
- ThrottlingException
object
: The calls to the MeterUsage API are throttled.- message errorMessage
Timestamp
- Timestamp
string
TimestampOutOfBoundsException
- TimestampOutOfBoundsException
object
: The timestamp value passed in the meterUsage() is out of allowed range.- message errorMessage
UsageDimension
- UsageDimension
string
UsageQuantity
- UsageQuantity
integer
UsageRecord
- UsageRecord
object
:A UsageRecord indicates a quantity of usage for a given product, customer, dimension and time.
Multiple requests with the same UsageRecords as input will be deduplicated to prevent double charges.
- CustomerIdentifier required CustomerIdentifier
- Dimension required UsageDimension
- Quantity required UsageQuantity
- Timestamp required Timestamp
UsageRecordList
- UsageRecordList
array
- items UsageRecord
UsageRecordResult
- UsageRecordResult
object
: A UsageRecordResult indicates the status of a given UsageRecord processed by BatchMeterUsage.- MeteringRecordId String
- Status UsageRecordResultStatus
- UsageRecord UsageRecord
UsageRecordResultList
- UsageRecordResultList
array
- items UsageRecordResult
UsageRecordResultStatus
- UsageRecordResultStatus
string
(values: Success, CustomerNotSubscribed, DuplicateRecord)
errorMessage
- errorMessage
string