Overview
A usage plugin implements the UsagePluginApi. This plugin can be used to collect usage data that is collected by a separate application. This application may have specialized knowledge of how to measure specific types of resource units, such as cellphone minutes.
UsagePluginApi
Developers of usage plugins need to implement the following APIs:
-
getUsageForAccount
: This method gets usage data for a specified account. -
getUsageForSubscription
: This method gets usage data for a particular subscription.
Each of the APIs take the following parameters:
-
startDate
: The beginning of the date range to be queried -
endDate
: The end of the date range to be queried -
context
: Provides the fullUsageContext
associated with this query, including the account ID. -
properties
: An optional list ofPluginProperty
items that are passed from the plogin to the caller.
In addition, the getUsageForSubsceiption
API includes a subscriptionId
parameter.
Both APIs return a list of RawUsageRecords. Each record includes:
-
date
: The date of the record -
unitType
: The type of resource used (as defined in the catalog) -
amount
: The number of units used -
trackingId
: Id for the record
Use Cases
The main use case for this plugin is to collect usage data that can be used for usage-based billing.