amazonka-marketplace-metering-2.0: Amazon Marketplace Metering SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.MarketplaceMetering.BatchMeterUsage

Description

BatchMeterUsage is called from a SaaS application listed on AWS Marketplace to post metering records for a set of customers.

For identical requests, the API is idempotent; requests can be retried with the same records or a subset of the input records.

Every request to BatchMeterUsage is for one product. If you need to meter usage for multiple products, you must make multiple calls to BatchMeterUsage.

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.

BatchMeterUsage can process up to 25 UsageRecords at a time.

A UsageRecord 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).

BatchMeterUsage returns a list of UsageRecordResult objects, showing the result for each UsageRecord, as well as a list of UnprocessedRecords, indicating errors in the service side that you should retry.

BatchMeterUsage requests must be less than 1MB in size.

For an example of using BatchMeterUsage, see BatchMeterUsage code example in the AWS Marketplace Seller Guide.

Synopsis

Creating a Request

data BatchMeterUsage Source #

A BatchMeterUsageRequest contains UsageRecords, which indicate quantities of usage within your application.

See: newBatchMeterUsage smart constructor.

Constructors

BatchMeterUsage' 

Fields

  • usageRecords :: [UsageRecord]

    The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.

  • productCode :: Text

    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.

Instances

Instances details
ToJSON BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

ToHeaders BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

ToPath BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

ToQuery BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

AWSRequest BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Associated Types

type AWSResponse BatchMeterUsage #

Generic BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Associated Types

type Rep BatchMeterUsage :: Type -> Type #

Read BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Show BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

NFData BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Methods

rnf :: BatchMeterUsage -> () #

Eq BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Hashable BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

type AWSResponse BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

type Rep BatchMeterUsage Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

type Rep BatchMeterUsage = D1 ('MetaData "BatchMeterUsage" "Amazonka.MarketplaceMetering.BatchMeterUsage" "amazonka-marketplace-metering-2.0-8iXXI93nW7fIf59koqHJQ" 'False) (C1 ('MetaCons "BatchMeterUsage'" 'PrefixI 'True) (S1 ('MetaSel ('Just "usageRecords") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [UsageRecord]) :*: S1 ('MetaSel ('Just "productCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)))

newBatchMeterUsage Source #

Create a value of BatchMeterUsage with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:usageRecords:BatchMeterUsage', batchMeterUsage_usageRecords - The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.

$sel:productCode:BatchMeterUsage', batchMeterUsage_productCode - 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.

Request Lenses

batchMeterUsage_usageRecords :: Lens' BatchMeterUsage [UsageRecord] Source #

The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.

batchMeterUsage_productCode :: Lens' BatchMeterUsage Text Source #

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.

Destructuring the Response

data BatchMeterUsageResponse Source #

Contains the UsageRecords processed by BatchMeterUsage and any records that have failed due to transient error.

See: newBatchMeterUsageResponse smart constructor.

Constructors

BatchMeterUsageResponse' 

Fields

  • results :: Maybe [UsageRecordResult]

    Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by AWS Marketplace Metering Service or were invalid. Invalid records should be fixed before being resubmitted.

  • unprocessedRecords :: Maybe [UsageRecord]

    Contains all UsageRecords that were not processed by BatchMeterUsage. This is a list of UsageRecords. You can retry the failed request by making another BatchMeterUsage call with this list as input in the BatchMeterUsageRequest.

  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Generic BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Associated Types

type Rep BatchMeterUsageResponse :: Type -> Type #

Read BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Show BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

NFData BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

Methods

rnf :: BatchMeterUsageResponse -> () #

Eq BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

type Rep BatchMeterUsageResponse Source # 
Instance details

Defined in Amazonka.MarketplaceMetering.BatchMeterUsage

type Rep BatchMeterUsageResponse = D1 ('MetaData "BatchMeterUsageResponse" "Amazonka.MarketplaceMetering.BatchMeterUsage" "amazonka-marketplace-metering-2.0-8iXXI93nW7fIf59koqHJQ" 'False) (C1 ('MetaCons "BatchMeterUsageResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "results") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [UsageRecordResult])) :*: (S1 ('MetaSel ('Just "unprocessedRecords") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [UsageRecord])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newBatchMeterUsageResponse Source #

Create a value of BatchMeterUsageResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:results:BatchMeterUsageResponse', batchMeterUsageResponse_results - Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by AWS Marketplace Metering Service or were invalid. Invalid records should be fixed before being resubmitted.

$sel:unprocessedRecords:BatchMeterUsageResponse', batchMeterUsageResponse_unprocessedRecords - Contains all UsageRecords that were not processed by BatchMeterUsage. This is a list of UsageRecords. You can retry the failed request by making another BatchMeterUsage call with this list as input in the BatchMeterUsageRequest.

$sel:httpStatus:BatchMeterUsageResponse', batchMeterUsageResponse_httpStatus - The response's http status code.

Response Lenses

batchMeterUsageResponse_results :: Lens' BatchMeterUsageResponse (Maybe [UsageRecordResult]) Source #

Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by AWS Marketplace Metering Service or were invalid. Invalid records should be fixed before being resubmitted.

batchMeterUsageResponse_unprocessedRecords :: Lens' BatchMeterUsageResponse (Maybe [UsageRecord]) Source #

Contains all UsageRecords that were not processed by BatchMeterUsage. This is a list of UsageRecords. You can retry the failed request by making another BatchMeterUsage call with this list as input in the BatchMeterUsageRequest.