Skip to content

Commit

Permalink
Regenerating amazonka-marketplace-metering from latest service defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
brendanhay committed Nov 29, 2016
1 parent 570d674 commit d93c185
Show file tree
Hide file tree
Showing 13 changed files with 607 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ library

exposed-modules:
Network.AWS.MarketplaceMetering
, Network.AWS.MarketplaceMetering.BatchMeterUsage
, Network.AWS.MarketplaceMetering.MeterUsage
, Network.AWS.MarketplaceMetering.ResolveCustomer
, Network.AWS.MarketplaceMetering.Types
, Network.AWS.MarketplaceMetering.Waiters

Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
--
-- __Submitting Metering Records__
--
-- * /MeterUsage/ - Submits the metering record for a Marketplace product.
-- * /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.
--
--
--
Expand Down Expand Up @@ -52,19 +60,54 @@ module Network.AWS.MarketplaceMetering
-- ** InternalServiceErrorException
, _InternalServiceErrorException

-- ** InvalidTokenException
, _InvalidTokenException

-- ** ExpiredTokenException
, _ExpiredTokenException

-- ** InvalidCustomerIdentifierException
, _InvalidCustomerIdentifierException

-- * Waiters
-- $waiters

-- * Operations
-- $operations

-- ** BatchMeterUsage
, module Network.AWS.MarketplaceMetering.BatchMeterUsage

-- ** ResolveCustomer
, module Network.AWS.MarketplaceMetering.ResolveCustomer

-- ** MeterUsage
, module Network.AWS.MarketplaceMetering.MeterUsage

-- * Types

-- ** UsageRecordResultStatus
, UsageRecordResultStatus (..)

-- ** UsageRecord
, UsageRecord
, usageRecord
, urTimestamp
, urCustomerIdentifier
, urDimension
, urQuantity

-- ** UsageRecordResult
, UsageRecordResult
, usageRecordResult
, urrStatus
, urrUsageRecord
, urrMeteringRecordId
) where

import Network.AWS.MarketplaceMetering.BatchMeterUsage
import Network.AWS.MarketplaceMetering.MeterUsage
import Network.AWS.MarketplaceMetering.ResolveCustomer
import Network.AWS.MarketplaceMetering.Types
import Network.AWS.MarketplaceMetering.Waiters

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}

{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module : Network.AWS.MarketplaceMetering.BatchMeterUsage
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- BatchMeterUsage is called from a SaaS application listed on the 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.
--
-- BatchMeterUsage can process up to 25 UsageRecords at a time.
--
module Network.AWS.MarketplaceMetering.BatchMeterUsage
(
-- * Creating a Request
batchMeterUsage
, BatchMeterUsage
-- * Request Lenses
, bmuUsageRecords
, bmuProductCode

-- * Destructuring the Response
, batchMeterUsageResponse
, BatchMeterUsageResponse
-- * Response Lenses
, bmursResults
, bmursUnprocessedRecords
, bmursResponseStatus
) where

import Network.AWS.Lens
import Network.AWS.MarketplaceMetering.Types
import Network.AWS.MarketplaceMetering.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response

-- | A BatchMeterUsageRequest contains UsageRecords, which indicate quantities of usage within your application.
--
--
--
-- /See:/ 'batchMeterUsage' smart constructor.
data BatchMeterUsage = BatchMeterUsage'
{ _bmuUsageRecords :: ![UsageRecord]
, _bmuProductCode :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'BatchMeterUsage' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bmuUsageRecords' - The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.
--
-- * 'bmuProductCode' - 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.
batchMeterUsage
:: Text -- ^ 'bmuProductCode'
-> BatchMeterUsage
batchMeterUsage pProductCode_ =
BatchMeterUsage'
{ _bmuUsageRecords = mempty
, _bmuProductCode = pProductCode_
}

-- | The set of UsageRecords to submit. BatchMeterUsage accepts up to 25 UsageRecords at a time.
bmuUsageRecords :: Lens' BatchMeterUsage [UsageRecord]
bmuUsageRecords = lens _bmuUsageRecords (\ s a -> s{_bmuUsageRecords = a}) . _Coerce;

-- | 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.
bmuProductCode :: Lens' BatchMeterUsage Text
bmuProductCode = lens _bmuProductCode (\ s a -> s{_bmuProductCode = a});

instance AWSRequest BatchMeterUsage where
type Rs BatchMeterUsage = BatchMeterUsageResponse
request = postJSON marketplaceMetering
response
= receiveJSON
(\ s h x ->
BatchMeterUsageResponse' <$>
(x .?> "Results" .!@ mempty) <*>
(x .?> "UnprocessedRecords" .!@ mempty)
<*> (pure (fromEnum s)))

instance Hashable BatchMeterUsage

instance NFData BatchMeterUsage

instance ToHeaders BatchMeterUsage where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AWSMPMeteringService.BatchMeterUsage" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])

instance ToJSON BatchMeterUsage where
toJSON BatchMeterUsage'{..}
= object
(catMaybes
[Just ("UsageRecords" .= _bmuUsageRecords),
Just ("ProductCode" .= _bmuProductCode)])

instance ToPath BatchMeterUsage where
toPath = const "/"

instance ToQuery BatchMeterUsage where
toQuery = const mempty

-- | Contains the UsageRecords processed by BatchMeterUsage and any records that have failed due to transient error.
--
--
--
-- /See:/ 'batchMeterUsageResponse' smart constructor.
data BatchMeterUsageResponse = BatchMeterUsageResponse'
{ _bmursResults :: !(Maybe [UsageRecordResult])
, _bmursUnprocessedRecords :: !(Maybe [UsageRecord])
, _bmursResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'BatchMeterUsageResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bmursResults' - Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by AWS Marketplace Metering Service or were invalid.
--
-- * 'bmursUnprocessedRecords' - 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.
--
-- * 'bmursResponseStatus' - -- | The response status code.
batchMeterUsageResponse
:: Int -- ^ 'bmursResponseStatus'
-> BatchMeterUsageResponse
batchMeterUsageResponse pResponseStatus_ =
BatchMeterUsageResponse'
{ _bmursResults = Nothing
, _bmursUnprocessedRecords = Nothing
, _bmursResponseStatus = pResponseStatus_
}

-- | Contains all UsageRecords processed by BatchMeterUsage. These records were either honored by AWS Marketplace Metering Service or were invalid.
bmursResults :: Lens' BatchMeterUsageResponse [UsageRecordResult]
bmursResults = lens _bmursResults (\ s a -> s{_bmursResults = a}) . _Default . _Coerce;

-- | 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.
bmursUnprocessedRecords :: Lens' BatchMeterUsageResponse [UsageRecord]
bmursUnprocessedRecords = lens _bmursUnprocessedRecords (\ s a -> s{_bmursUnprocessedRecords = a}) . _Default . _Coerce;

-- | -- | The response status code.
bmursResponseStatus :: Lens' BatchMeterUsageResponse Int
bmursResponseStatus = lens _bmursResponseStatus (\ s a -> s{_bmursResponseStatus = a});

instance NFData BatchMeterUsageResponse
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
-- API to emit metering records. For identical requests, the API is idempotent. It simply returns the metering record ID.
--
--
-- MeterUsage is authenticated on the buyer's AWS account, generally when running from an EC2 instance on the AWS Marketplace.
--
module Network.AWS.MarketplaceMetering.MeterUsage
(
-- * Creating a Request
Expand Down Expand Up @@ -65,7 +67,7 @@ data MeterUsage = MeterUsage'
--
-- * 'muTimestamp' - Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored.
--
-- * 'muUsageDimension' - It will be one of the 'fcp dimension name' provided during the publishing of the product.
-- * 'muUsageDimension' - It will be one of the fcp dimension name provided during the publishing of the product.
--
-- * 'muUsageQuantity' - Consumption value for the hour.
--
Expand Down Expand Up @@ -94,7 +96,7 @@ muProductCode = lens _muProductCode (\ s a -> s{_muProductCode = a});
muTimestamp :: Lens' MeterUsage UTCTime
muTimestamp = lens _muTimestamp (\ s a -> s{_muTimestamp = a}) . _Time;

-- | It will be one of the 'fcp dimension name' provided during the publishing of the product.
-- | It will be one of the fcp dimension name provided during the publishing of the product.
muUsageDimension :: Lens' MeterUsage Text
muUsageDimension = lens _muUsageDimension (\ s a -> s{_muUsageDimension = a});

Expand Down
Loading

0 comments on commit d93c185

Please sign in to comment.