amazonka-marketplace-metering-1.5.0: Amazon Marketplace Metering SDK.

Copyright(c) 2013-2017 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.MarketplaceMetering

Contents

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.

Synopsis

Service Configuration

marketplaceMetering :: Service Source #

API version 2016-01-14 of the Amazon Marketplace Metering SDK configuration.

Errors

Error matchers are designed for use with the functions provided by Control.Exception.Lens. This allows catching (and rethrowing) service specific errors returned by MarketplaceMetering.

InvalidEndpointRegionException

_InvalidEndpointRegionException :: AsError a => Getting (First ServiceError) a ServiceError Source #

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.

InvalidProductCodeException

_InvalidProductCodeException :: AsError a => Getting (First ServiceError) a ServiceError Source #

The product code passed does not match the product code used for publishing the product.

InvalidUsageDimensionException

_InvalidUsageDimensionException :: AsError a => Getting (First ServiceError) a ServiceError Source #

The usage dimension does not match one of the UsageDimensions associated with products.

DuplicateRequestException

_DuplicateRequestException :: AsError a => Getting (First ServiceError) a ServiceError Source #

A metering record has already been emitted by the same EC2 instance for the given {usageDimension, timestamp} with a different usageQuantity.

TimestampOutOfBoundsException

_TimestampOutOfBoundsException :: AsError a => Getting (First ServiceError) a ServiceError Source #

The timestamp value passed in the meterUsage() is out of allowed range.

ThrottlingException

_ThrottlingException :: AsError a => Getting (First ServiceError) a ServiceError Source #

The calls to the MeterUsage API are throttled.

InternalServiceErrorException

_InternalServiceErrorException :: AsError a => Getting (First ServiceError) a ServiceError Source #

An internal error has occurred. Retry your request. If the problem persists, post a message with details on the AWS forums.

InvalidTokenException

_InvalidTokenException :: AsError a => Getting (First ServiceError) a ServiceError Source #

Prism for InvalidTokenException' errors.

ExpiredTokenException

_ExpiredTokenException :: AsError a => Getting (First ServiceError) a ServiceError Source #

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.

InvalidCustomerIdentifierException

_InvalidCustomerIdentifierException :: AsError a => Getting (First ServiceError) a ServiceError Source #

You have metered usage for a CustomerIdentifier that does not exist.

Waiters

Waiters poll by repeatedly sending a request until some remote success condition configured by the Wait specification is fulfilled. The Wait specification determines how many attempts should be made, in addition to delay and retry strategies.

Operations

Some AWS operations return results that are incomplete and require subsequent requests in order to obtain the entire result set. The process of sending subsequent requests to continue where a previous request left off is called pagination. For example, the ListObjects operation of Amazon S3 returns up to 1000 objects at a time, and you must send subsequent requests with the appropriate Marker in order to retrieve the next page of results.

Operations that have an AWSPager instance can transparently perform subsequent requests, correctly setting Markers and other request facets to iterate through the entire result set of a truncated API operation. Operations which support this have an additional note in the documentation.

Many operations have the ability to filter results on the server side. See the individual operation parameters for details.

BatchMeterUsage

ResolveCustomer

MeterUsage

Types

UsageRecordResultStatus

data UsageRecordResultStatus Source #

Instances

Bounded UsageRecordResultStatus Source # 
Enum UsageRecordResultStatus Source # 
Eq UsageRecordResultStatus Source # 
Data UsageRecordResultStatus Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UsageRecordResultStatus -> c UsageRecordResultStatus #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UsageRecordResultStatus #

toConstr :: UsageRecordResultStatus -> Constr #

dataTypeOf :: UsageRecordResultStatus -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UsageRecordResultStatus) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UsageRecordResultStatus) #

gmapT :: (forall b. Data b => b -> b) -> UsageRecordResultStatus -> UsageRecordResultStatus #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecordResultStatus -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecordResultStatus -> r #

gmapQ :: (forall d. Data d => d -> u) -> UsageRecordResultStatus -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UsageRecordResultStatus -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UsageRecordResultStatus -> m UsageRecordResultStatus #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecordResultStatus -> m UsageRecordResultStatus #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecordResultStatus -> m UsageRecordResultStatus #

Ord UsageRecordResultStatus Source # 
Read UsageRecordResultStatus Source # 
Show UsageRecordResultStatus Source # 
Generic UsageRecordResultStatus Source # 
Hashable UsageRecordResultStatus Source # 
FromJSON UsageRecordResultStatus Source # 
NFData UsageRecordResultStatus Source # 

Methods

rnf :: UsageRecordResultStatus -> () #

ToQuery UsageRecordResultStatus Source # 
ToHeader UsageRecordResultStatus Source # 
ToByteString UsageRecordResultStatus Source # 
FromText UsageRecordResultStatus Source # 
ToText UsageRecordResultStatus Source # 
type Rep UsageRecordResultStatus Source # 
type Rep UsageRecordResultStatus = D1 (MetaData "UsageRecordResultStatus" "Network.AWS.MarketplaceMetering.Types.Sum" "amazonka-marketplace-metering-1.5.0-LB5sfoIg48s7GYrW24ZhWc" False) ((:+:) (C1 (MetaCons "CustomerNotSubscribed" PrefixI False) U1) ((:+:) (C1 (MetaCons "DuplicateRecord" PrefixI False) U1) (C1 (MetaCons "Success" PrefixI False) U1)))

UsageRecord

data UsageRecord Source #

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.

See: usageRecord smart constructor.

Instances

Eq UsageRecord Source # 
Data UsageRecord Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UsageRecord -> c UsageRecord #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UsageRecord #

toConstr :: UsageRecord -> Constr #

dataTypeOf :: UsageRecord -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UsageRecord) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UsageRecord) #

gmapT :: (forall b. Data b => b -> b) -> UsageRecord -> UsageRecord #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecord -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecord -> r #

gmapQ :: (forall d. Data d => d -> u) -> UsageRecord -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UsageRecord -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UsageRecord -> m UsageRecord #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecord -> m UsageRecord #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecord -> m UsageRecord #

Read UsageRecord Source # 
Show UsageRecord Source # 
Generic UsageRecord Source # 

Associated Types

type Rep UsageRecord :: * -> * #

Hashable UsageRecord Source # 
FromJSON UsageRecord Source # 
ToJSON UsageRecord Source # 
NFData UsageRecord Source # 

Methods

rnf :: UsageRecord -> () #

type Rep UsageRecord Source # 
type Rep UsageRecord = D1 (MetaData "UsageRecord" "Network.AWS.MarketplaceMetering.Types.Product" "amazonka-marketplace-metering-1.5.0-LB5sfoIg48s7GYrW24ZhWc" False) (C1 (MetaCons "UsageRecord'" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "_urTimestamp") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 POSIX)) (S1 (MetaSel (Just Symbol "_urCustomerIdentifier") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) ((:*:) (S1 (MetaSel (Just Symbol "_urDimension") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)) (S1 (MetaSel (Just Symbol "_urQuantity") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Nat)))))

usageRecord Source #

Creates a value of UsageRecord with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • urTimestamp - Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored. Your application can meter usage for up to one hour in the past.
  • urCustomerIdentifier - The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application.
  • urDimension - During the process of registering a product on AWS Marketplace, up to eight dimensions are specified. These represent different units of value in your application.
  • urQuantity - The quantity of usage consumed by the customer for the given dimension and time.

urTimestamp :: Lens' UsageRecord UTCTime Source #

Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored. Your application can meter usage for up to one hour in the past.

urCustomerIdentifier :: Lens' UsageRecord Text Source #

The CustomerIdentifier is obtained through the ResolveCustomer operation and represents an individual buyer in your application.

urDimension :: Lens' UsageRecord Text Source #

During the process of registering a product on AWS Marketplace, up to eight dimensions are specified. These represent different units of value in your application.

urQuantity :: Lens' UsageRecord Natural Source #

The quantity of usage consumed by the customer for the given dimension and time.

UsageRecordResult

data UsageRecordResult Source #

A UsageRecordResult indicates the status of a given UsageRecord processed by BatchMeterUsage.

See: usageRecordResult smart constructor.

Instances

Eq UsageRecordResult Source # 
Data UsageRecordResult Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UsageRecordResult -> c UsageRecordResult #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UsageRecordResult #

toConstr :: UsageRecordResult -> Constr #

dataTypeOf :: UsageRecordResult -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UsageRecordResult) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UsageRecordResult) #

gmapT :: (forall b. Data b => b -> b) -> UsageRecordResult -> UsageRecordResult #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecordResult -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UsageRecordResult -> r #

gmapQ :: (forall d. Data d => d -> u) -> UsageRecordResult -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UsageRecordResult -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UsageRecordResult -> m UsageRecordResult #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecordResult -> m UsageRecordResult #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UsageRecordResult -> m UsageRecordResult #

Read UsageRecordResult Source # 
Show UsageRecordResult Source # 
Generic UsageRecordResult Source # 
Hashable UsageRecordResult Source # 
FromJSON UsageRecordResult Source # 
NFData UsageRecordResult Source # 

Methods

rnf :: UsageRecordResult -> () #

type Rep UsageRecordResult Source # 
type Rep UsageRecordResult = D1 (MetaData "UsageRecordResult" "Network.AWS.MarketplaceMetering.Types.Product" "amazonka-marketplace-metering-1.5.0-LB5sfoIg48s7GYrW24ZhWc" False) (C1 (MetaCons "UsageRecordResult'" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "_urrStatus") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe UsageRecordResultStatus))) ((:*:) (S1 (MetaSel (Just Symbol "_urrUsageRecord") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe UsageRecord))) (S1 (MetaSel (Just Symbol "_urrMeteringRecordId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Text))))))

usageRecordResult :: UsageRecordResult Source #

Creates a value of UsageRecordResult with the minimum fields required to make a request.

Use one of the following lenses to modify other fields as desired:

  • urrStatus - The UsageRecordResult Status indicates the status of an individual UsageRecord processed by BatchMeterUsage. * Success - The UsageRecord was accepted and honored by BatchMeterUsage. * CustomerNotSubscribed - The CustomerIdentifier specified is not subscribed to your product. The UsageRecord was not honored. Future UsageRecords for this customer will fail until the customer subscribes to your product. * DuplicateRecord - Indicates that the UsageRecord was invalid and not honored. A previously metered UsageRecord had the same customer, dimension, and time, but a different quantity.
  • urrUsageRecord - The UsageRecord that was part of the BatchMeterUsage request.
  • urrMeteringRecordId - The MeteringRecordId is a unique identifier for this metering event.

urrStatus :: Lens' UsageRecordResult (Maybe UsageRecordResultStatus) Source #

The UsageRecordResult Status indicates the status of an individual UsageRecord processed by BatchMeterUsage. * Success - The UsageRecord was accepted and honored by BatchMeterUsage. * CustomerNotSubscribed - The CustomerIdentifier specified is not subscribed to your product. The UsageRecord was not honored. Future UsageRecords for this customer will fail until the customer subscribes to your product. * DuplicateRecord - Indicates that the UsageRecord was invalid and not honored. A previously metered UsageRecord had the same customer, dimension, and time, but a different quantity.

urrUsageRecord :: Lens' UsageRecordResult (Maybe UsageRecord) Source #

The UsageRecord that was part of the BatchMeterUsage request.

urrMeteringRecordId :: Lens' UsageRecordResult (Maybe Text) Source #

The MeteringRecordId is a unique identifier for this metering event.