/AWS1/IF_MPM=>METERUSAGE()¶
About MeterUsage¶
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.
MeterUsage is authenticated on the buyer's Amazon Web Services account using
credentials from the Amazon EC2 instance, Amazon ECS task, or Amazon 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).
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.
For Amazon Web Services Regions that support MeterUsage, see MeterUsage Region support for Amazon EC2 and MeterUsage Region support for Amazon ECS and Amazon EKS.
Method Signature¶
METHODS /AWS1/IF_MPM~METERUSAGE
IMPORTING
!IV_PRODUCTCODE TYPE /AWS1/MPMPRODUCTCODE OPTIONAL
!IV_TIMESTAMP TYPE /AWS1/MPMTIMESTAMP OPTIONAL
!IV_USAGEDIMENSION TYPE /AWS1/MPMUSAGEDIMENSION OPTIONAL
!IV_USAGEQUANTITY TYPE /AWS1/MPMUSAGEQUANTITY OPTIONAL
!IV_DRYRUN TYPE /AWS1/MPMBOOLEAN OPTIONAL
!IT_USAGEALLOCATIONS TYPE /AWS1/CL_MPMUSAGEALLOCATION=>TT_USAGEALLOCATIONS OPTIONAL
!IV_CLIENTTOKEN TYPE /AWS1/MPMCLIENTTOKEN OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_mpmmeterusageresult
RAISING
/AWS1/CX_MPMCUSNOTENTITLEDEX
/AWS1/CX_MPMDUPLICATEREQUESTEX
/AWS1/CX_MPMIDEMPOTENCYCONFL00
/AWS1/CX_MPMINTERNALSVCERROREX
/AWS1/CX_MPMINVENDPTREGIONEX
/AWS1/CX_MPMINVPRODUCTCODEEX
/AWS1/CX_MPMINVALIDTAGEX
/AWS1/CX_MPMINVUSAGEALLOCSEX
/AWS1/CX_MPMINVUSAGEDIMENSIO00
/AWS1/CX_MPMTHROTTLINGEX
/AWS1/CX_MPMTSMPOUTOFBOUNDSEX
/AWS1/CX_MPMCLIENTEXC
/AWS1/CX_MPMSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_productcode TYPE /AWS1/MPMPRODUCTCODE /AWS1/MPMPRODUCTCODE¶
Product code is used to uniquely identify a product in Amazon Web Services Marketplace. The product code should be the same as the one used during the publishing of a new product.
iv_timestamp TYPE /AWS1/MPMTIMESTAMP /AWS1/MPMTIMESTAMP¶
Timestamp, in UTC, for which the usage is being reported. Your application can meter usage for up to six hours in the past. Make sure the
timestampvalue is not before the start of the software usage.
iv_usagedimension TYPE /AWS1/MPMUSAGEDIMENSION /AWS1/MPMUSAGEDIMENSION¶
It will be one of the fcp dimension name provided during the publishing of the product.
Optional arguments:¶
iv_usagequantity TYPE /AWS1/MPMUSAGEQUANTITY /AWS1/MPMUSAGEQUANTITY¶
Consumption value for the hour. Defaults to
0if not specified.
iv_dryrun TYPE /AWS1/MPMBOOLEAN /AWS1/MPMBOOLEAN¶
Checks whether you have the permissions required for the action, but does not make the request. If you have the permissions, the request returns
DryRunOperation; otherwise, it returnsUnauthorizedException. Defaults tofalseif not specified.
it_usageallocations TYPE /AWS1/CL_MPMUSAGEALLOCATION=>TT_USAGEALLOCATIONS TT_USAGEALLOCATIONS¶
The set of
UsageAllocationsto submit.The sum of all
UsageAllocationquantities must equal theUsageQuantityof theMeterUsagerequest, and eachUsageAllocationmust have a unique set of tags (include no tags).
iv_clienttoken TYPE /AWS1/MPMCLIENTTOKEN /AWS1/MPMCLIENTTOKEN¶
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 UUID type of value.
If you don't provide this value, then Amazon Web Services generates a random one for you.
If you retry the operation with the same
ClientToken, but with different parameters, the retry fails with anIdempotencyConflictExceptionerror.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_mpmmeterusageresult /AWS1/CL_MPMMETERUSAGERESULT¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->meterusage(
it_usageallocations = VALUE /aws1/cl_mpmusageallocation=>tt_usageallocations(
(
new /aws1/cl_mpmusageallocation(
it_tags = VALUE /aws1/cl_mpmtag=>tt_taglist(
(
new /aws1/cl_mpmtag(
iv_key = |string|
iv_value = |string|
)
)
)
iv_allocatedusagequantity = 123
)
)
)
iv_clienttoken = |string|
iv_dryrun = ABAP_TRUE
iv_productcode = |string|
iv_timestamp = '20150101000000.0000000'
iv_usagedimension = |string|
iv_usagequantity = 123
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_string = lo_result->get_meteringrecordid( ).
ENDIF.