{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.CostExplorer.GetCostAndUsage
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves cost and usage metrics for your account. You can specify which
-- cost and usage-related metric that you want the request to return. For
-- example, you can specify @BlendedCosts@ or @UsageQuantity@. You can also
-- filter and group your data by various dimensions, such as @SERVICE@ or
-- @AZ@, in a specific time range. For a complete list of valid dimensions,
-- see the
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_GetDimensionValues.html GetDimensionValues>
-- operation. Management account in an organization in Organizations have
-- access to all member accounts.
--
-- For information about filter limitations, see
-- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-limits.html Quotas and restrictions>
-- in the /Billing and Cost Management User Guide/.
module Amazonka.CostExplorer.GetCostAndUsage
  ( -- * Creating a Request
    GetCostAndUsage (..),
    newGetCostAndUsage,

    -- * Request Lenses
    getCostAndUsage_groupBy,
    getCostAndUsage_nextPageToken,
    getCostAndUsage_filter,
    getCostAndUsage_timePeriod,
    getCostAndUsage_granularity,
    getCostAndUsage_metrics,

    -- * Destructuring the Response
    GetCostAndUsageResponse (..),
    newGetCostAndUsageResponse,

    -- * Response Lenses
    getCostAndUsageResponse_resultsByTime,
    getCostAndUsageResponse_nextPageToken,
    getCostAndUsageResponse_dimensionValueAttributes,
    getCostAndUsageResponse_groupDefinitions,
    getCostAndUsageResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetCostAndUsage' smart constructor.
data GetCostAndUsage = GetCostAndUsage'
  { -- | You can group Amazon Web Services costs using up to two different
    -- groups, either dimensions, tag keys, cost categories, or any two group
    -- by types.
    --
    -- Valid values for the @DIMENSION@ type are @AZ@, @INSTANCE_TYPE@,
    -- @LEGAL_ENTITY_NAME@, @LINKED_ACCOUNT@, @OPERATION@, @PLATFORM@,
    -- @PURCHASE_TYPE@, @SERVICE@, @TENANCY@, @RECORD_TYPE@, and @USAGE_TYPE@.
    --
    -- When you group by the @TAG@ type and include a valid tag key, you get
    -- all tag values, including empty strings.
    GetCostAndUsage -> Maybe [GroupDefinition]
groupBy :: Prelude.Maybe [GroupDefinition],
    -- | The token to retrieve the next set of results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetCostAndUsage -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | Filters Amazon Web Services costs by different dimensions. For example,
    -- you can specify @SERVICE@ and @LINKED_ACCOUNT@ and get the costs that
    -- are associated with that account\'s usage of that service. You can nest
    -- @Expression@ objects to define any combination of dimension filters. For
    -- more information, see
    -- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>.
    GetCostAndUsage -> Maybe Expression
filter' :: Prelude.Maybe Expression,
    -- | Sets the start date and end date for retrieving Amazon Web Services
    -- costs. The start date is inclusive, but the end date is exclusive. For
    -- example, if @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the
    -- cost and usage data is retrieved from @2017-01-01@ up to and including
    -- @2017-04-30@ but not including @2017-05-01@.
    GetCostAndUsage -> DateInterval
timePeriod :: DateInterval,
    -- | Sets the Amazon Web Services cost granularity to @MONTHLY@ or @DAILY@,
    -- or @HOURLY@. If @Granularity@ isn\'t set, the response object doesn\'t
    -- include the @Granularity@, either @MONTHLY@ or @DAILY@, or @HOURLY@.
    GetCostAndUsage -> Granularity
granularity :: Granularity,
    -- | Which metrics are returned in the query. For more information about
    -- blended and unblended rates, see
    -- <http://aws.amazon.com/premiumsupport/knowledge-center/blended-rates-intro/ Why does the \"blended\" annotation appear on some line items in my bill?>.
    --
    -- Valid values are @AmortizedCost@, @BlendedCost@, @NetAmortizedCost@,
    -- @NetUnblendedCost@, @NormalizedUsageAmount@, @UnblendedCost@, and
    -- @UsageQuantity@.
    --
    -- If you return the @UsageQuantity@ metric, the service aggregates all
    -- usage numbers without taking into account the units. For example, if you
    -- aggregate @usageQuantity@ across all of Amazon EC2, the results aren\'t
    -- meaningful because Amazon EC2 compute hours and data transfer are
    -- measured in different units (for example, hours and GB). To get more
    -- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
    -- @UsageTypeGroups@.
    --
    -- @Metrics@ is required for @GetCostAndUsage@ requests.
    GetCostAndUsage -> [Text]
metrics :: [Prelude.Text]
  }
  deriving (GetCostAndUsage -> GetCostAndUsage -> Bool
(GetCostAndUsage -> GetCostAndUsage -> Bool)
-> (GetCostAndUsage -> GetCostAndUsage -> Bool)
-> Eq GetCostAndUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsage -> GetCostAndUsage -> Bool
$c/= :: GetCostAndUsage -> GetCostAndUsage -> Bool
== :: GetCostAndUsage -> GetCostAndUsage -> Bool
$c== :: GetCostAndUsage -> GetCostAndUsage -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsage]
ReadPrec GetCostAndUsage
Int -> ReadS GetCostAndUsage
ReadS [GetCostAndUsage]
(Int -> ReadS GetCostAndUsage)
-> ReadS [GetCostAndUsage]
-> ReadPrec GetCostAndUsage
-> ReadPrec [GetCostAndUsage]
-> Read GetCostAndUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsage]
$creadListPrec :: ReadPrec [GetCostAndUsage]
readPrec :: ReadPrec GetCostAndUsage
$creadPrec :: ReadPrec GetCostAndUsage
readList :: ReadS [GetCostAndUsage]
$creadList :: ReadS [GetCostAndUsage]
readsPrec :: Int -> ReadS GetCostAndUsage
$creadsPrec :: Int -> ReadS GetCostAndUsage
Prelude.Read, Int -> GetCostAndUsage -> ShowS
[GetCostAndUsage] -> ShowS
GetCostAndUsage -> String
(Int -> GetCostAndUsage -> ShowS)
-> (GetCostAndUsage -> String)
-> ([GetCostAndUsage] -> ShowS)
-> Show GetCostAndUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsage] -> ShowS
$cshowList :: [GetCostAndUsage] -> ShowS
show :: GetCostAndUsage -> String
$cshow :: GetCostAndUsage -> String
showsPrec :: Int -> GetCostAndUsage -> ShowS
$cshowsPrec :: Int -> GetCostAndUsage -> ShowS
Prelude.Show, (forall x. GetCostAndUsage -> Rep GetCostAndUsage x)
-> (forall x. Rep GetCostAndUsage x -> GetCostAndUsage)
-> Generic GetCostAndUsage
forall x. Rep GetCostAndUsage x -> GetCostAndUsage
forall x. GetCostAndUsage -> Rep GetCostAndUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCostAndUsage x -> GetCostAndUsage
$cfrom :: forall x. GetCostAndUsage -> Rep GetCostAndUsage x
Prelude.Generic)

-- |
-- Create a value of 'GetCostAndUsage' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'groupBy', 'getCostAndUsage_groupBy' - You can group Amazon Web Services costs using up to two different
-- groups, either dimensions, tag keys, cost categories, or any two group
-- by types.
--
-- Valid values for the @DIMENSION@ type are @AZ@, @INSTANCE_TYPE@,
-- @LEGAL_ENTITY_NAME@, @LINKED_ACCOUNT@, @OPERATION@, @PLATFORM@,
-- @PURCHASE_TYPE@, @SERVICE@, @TENANCY@, @RECORD_TYPE@, and @USAGE_TYPE@.
--
-- When you group by the @TAG@ type and include a valid tag key, you get
-- all tag values, including empty strings.
--
-- 'nextPageToken', 'getCostAndUsage_nextPageToken' - The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'filter'', 'getCostAndUsage_filter' - Filters Amazon Web Services costs by different dimensions. For example,
-- you can specify @SERVICE@ and @LINKED_ACCOUNT@ and get the costs that
-- are associated with that account\'s usage of that service. You can nest
-- @Expression@ objects to define any combination of dimension filters. For
-- more information, see
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>.
--
-- 'timePeriod', 'getCostAndUsage_timePeriod' - Sets the start date and end date for retrieving Amazon Web Services
-- costs. The start date is inclusive, but the end date is exclusive. For
-- example, if @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the
-- cost and usage data is retrieved from @2017-01-01@ up to and including
-- @2017-04-30@ but not including @2017-05-01@.
--
-- 'granularity', 'getCostAndUsage_granularity' - Sets the Amazon Web Services cost granularity to @MONTHLY@ or @DAILY@,
-- or @HOURLY@. If @Granularity@ isn\'t set, the response object doesn\'t
-- include the @Granularity@, either @MONTHLY@ or @DAILY@, or @HOURLY@.
--
-- 'metrics', 'getCostAndUsage_metrics' - Which metrics are returned in the query. For more information about
-- blended and unblended rates, see
-- <http://aws.amazon.com/premiumsupport/knowledge-center/blended-rates-intro/ Why does the \"blended\" annotation appear on some line items in my bill?>.
--
-- Valid values are @AmortizedCost@, @BlendedCost@, @NetAmortizedCost@,
-- @NetUnblendedCost@, @NormalizedUsageAmount@, @UnblendedCost@, and
-- @UsageQuantity@.
--
-- If you return the @UsageQuantity@ metric, the service aggregates all
-- usage numbers without taking into account the units. For example, if you
-- aggregate @usageQuantity@ across all of Amazon EC2, the results aren\'t
-- meaningful because Amazon EC2 compute hours and data transfer are
-- measured in different units (for example, hours and GB). To get more
-- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
-- @UsageTypeGroups@.
--
-- @Metrics@ is required for @GetCostAndUsage@ requests.
newGetCostAndUsage ::
  -- | 'timePeriod'
  DateInterval ->
  -- | 'granularity'
  Granularity ->
  GetCostAndUsage
newGetCostAndUsage :: DateInterval -> Granularity -> GetCostAndUsage
newGetCostAndUsage DateInterval
pTimePeriod_ Granularity
pGranularity_ =
  GetCostAndUsage' :: Maybe [GroupDefinition]
-> Maybe Text
-> Maybe Expression
-> DateInterval
-> Granularity
-> [Text]
-> GetCostAndUsage
GetCostAndUsage'
    { $sel:groupBy:GetCostAndUsage' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetCostAndUsage' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':GetCostAndUsage' :: Maybe Expression
filter' = Maybe Expression
forall a. Maybe a
Prelude.Nothing,
      $sel:timePeriod:GetCostAndUsage' :: DateInterval
timePeriod = DateInterval
pTimePeriod_,
      $sel:granularity:GetCostAndUsage' :: Granularity
granularity = Granularity
pGranularity_,
      $sel:metrics:GetCostAndUsage' :: [Text]
metrics = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | You can group Amazon Web Services costs using up to two different
-- groups, either dimensions, tag keys, cost categories, or any two group
-- by types.
--
-- Valid values for the @DIMENSION@ type are @AZ@, @INSTANCE_TYPE@,
-- @LEGAL_ENTITY_NAME@, @LINKED_ACCOUNT@, @OPERATION@, @PLATFORM@,
-- @PURCHASE_TYPE@, @SERVICE@, @TENANCY@, @RECORD_TYPE@, and @USAGE_TYPE@.
--
-- When you group by the @TAG@ type and include a valid tag key, you get
-- all tag values, including empty strings.
getCostAndUsage_groupBy :: Lens.Lens' GetCostAndUsage (Prelude.Maybe [GroupDefinition])
getCostAndUsage_groupBy :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_groupBy = (GetCostAndUsage -> Maybe [GroupDefinition])
-> (GetCostAndUsage -> Maybe [GroupDefinition] -> GetCostAndUsage)
-> Lens
     GetCostAndUsage
     GetCostAndUsage
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {Maybe [GroupDefinition]
groupBy :: Maybe [GroupDefinition]
$sel:groupBy:GetCostAndUsage' :: GetCostAndUsage -> Maybe [GroupDefinition]
groupBy} -> Maybe [GroupDefinition]
groupBy) (\s :: GetCostAndUsage
s@GetCostAndUsage' {} Maybe [GroupDefinition]
a -> GetCostAndUsage
s {$sel:groupBy:GetCostAndUsage' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
a} :: GetCostAndUsage) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
 -> GetCostAndUsage -> f GetCostAndUsage)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
    -> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsage
-> f GetCostAndUsage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
-> Iso
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to retrieve the next set of results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getCostAndUsage_nextPageToken :: Lens.Lens' GetCostAndUsage (Prelude.Maybe Prelude.Text)
getCostAndUsage_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_nextPageToken = (GetCostAndUsage -> Maybe Text)
-> (GetCostAndUsage -> Maybe Text -> GetCostAndUsage)
-> Lens GetCostAndUsage GetCostAndUsage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsage' :: GetCostAndUsage -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsage
s@GetCostAndUsage' {} Maybe Text
a -> GetCostAndUsage
s {$sel:nextPageToken:GetCostAndUsage' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsage)

-- | Filters Amazon Web Services costs by different dimensions. For example,
-- you can specify @SERVICE@ and @LINKED_ACCOUNT@ and get the costs that
-- are associated with that account\'s usage of that service. You can nest
-- @Expression@ objects to define any combination of dimension filters. For
-- more information, see
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>.
getCostAndUsage_filter :: Lens.Lens' GetCostAndUsage (Prelude.Maybe Expression)
getCostAndUsage_filter :: (Maybe Expression -> f (Maybe Expression))
-> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_filter = (GetCostAndUsage -> Maybe Expression)
-> (GetCostAndUsage -> Maybe Expression -> GetCostAndUsage)
-> Lens
     GetCostAndUsage
     GetCostAndUsage
     (Maybe Expression)
     (Maybe Expression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {Maybe Expression
filter' :: Maybe Expression
$sel:filter':GetCostAndUsage' :: GetCostAndUsage -> Maybe Expression
filter'} -> Maybe Expression
filter') (\s :: GetCostAndUsage
s@GetCostAndUsage' {} Maybe Expression
a -> GetCostAndUsage
s {$sel:filter':GetCostAndUsage' :: Maybe Expression
filter' = Maybe Expression
a} :: GetCostAndUsage)

-- | Sets the start date and end date for retrieving Amazon Web Services
-- costs. The start date is inclusive, but the end date is exclusive. For
-- example, if @start@ is @2017-01-01@ and @end@ is @2017-05-01@, then the
-- cost and usage data is retrieved from @2017-01-01@ up to and including
-- @2017-04-30@ but not including @2017-05-01@.
getCostAndUsage_timePeriod :: Lens.Lens' GetCostAndUsage DateInterval
getCostAndUsage_timePeriod :: (DateInterval -> f DateInterval)
-> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_timePeriod = (GetCostAndUsage -> DateInterval)
-> (GetCostAndUsage -> DateInterval -> GetCostAndUsage)
-> Lens GetCostAndUsage GetCostAndUsage DateInterval DateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {DateInterval
timePeriod :: DateInterval
$sel:timePeriod:GetCostAndUsage' :: GetCostAndUsage -> DateInterval
timePeriod} -> DateInterval
timePeriod) (\s :: GetCostAndUsage
s@GetCostAndUsage' {} DateInterval
a -> GetCostAndUsage
s {$sel:timePeriod:GetCostAndUsage' :: DateInterval
timePeriod = DateInterval
a} :: GetCostAndUsage)

-- | Sets the Amazon Web Services cost granularity to @MONTHLY@ or @DAILY@,
-- or @HOURLY@. If @Granularity@ isn\'t set, the response object doesn\'t
-- include the @Granularity@, either @MONTHLY@ or @DAILY@, or @HOURLY@.
getCostAndUsage_granularity :: Lens.Lens' GetCostAndUsage Granularity
getCostAndUsage_granularity :: (Granularity -> f Granularity)
-> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_granularity = (GetCostAndUsage -> Granularity)
-> (GetCostAndUsage -> Granularity -> GetCostAndUsage)
-> Lens GetCostAndUsage GetCostAndUsage Granularity Granularity
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {Granularity
granularity :: Granularity
$sel:granularity:GetCostAndUsage' :: GetCostAndUsage -> Granularity
granularity} -> Granularity
granularity) (\s :: GetCostAndUsage
s@GetCostAndUsage' {} Granularity
a -> GetCostAndUsage
s {$sel:granularity:GetCostAndUsage' :: Granularity
granularity = Granularity
a} :: GetCostAndUsage)

-- | Which metrics are returned in the query. For more information about
-- blended and unblended rates, see
-- <http://aws.amazon.com/premiumsupport/knowledge-center/blended-rates-intro/ Why does the \"blended\" annotation appear on some line items in my bill?>.
--
-- Valid values are @AmortizedCost@, @BlendedCost@, @NetAmortizedCost@,
-- @NetUnblendedCost@, @NormalizedUsageAmount@, @UnblendedCost@, and
-- @UsageQuantity@.
--
-- If you return the @UsageQuantity@ metric, the service aggregates all
-- usage numbers without taking into account the units. For example, if you
-- aggregate @usageQuantity@ across all of Amazon EC2, the results aren\'t
-- meaningful because Amazon EC2 compute hours and data transfer are
-- measured in different units (for example, hours and GB). To get more
-- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
-- @UsageTypeGroups@.
--
-- @Metrics@ is required for @GetCostAndUsage@ requests.
getCostAndUsage_metrics :: Lens.Lens' GetCostAndUsage [Prelude.Text]
getCostAndUsage_metrics :: ([Text] -> f [Text]) -> GetCostAndUsage -> f GetCostAndUsage
getCostAndUsage_metrics = (GetCostAndUsage -> [Text])
-> (GetCostAndUsage -> [Text] -> GetCostAndUsage)
-> Lens GetCostAndUsage GetCostAndUsage [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsage' {[Text]
metrics :: [Text]
$sel:metrics:GetCostAndUsage' :: GetCostAndUsage -> [Text]
metrics} -> [Text]
metrics) (\s :: GetCostAndUsage
s@GetCostAndUsage' {} [Text]
a -> GetCostAndUsage
s {$sel:metrics:GetCostAndUsage' :: [Text]
metrics = [Text]
a} :: GetCostAndUsage) (([Text] -> f [Text]) -> GetCostAndUsage -> f GetCostAndUsage)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetCostAndUsage
-> f GetCostAndUsage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest GetCostAndUsage where
  type
    AWSResponse GetCostAndUsage =
      GetCostAndUsageResponse
  request :: GetCostAndUsage -> Request GetCostAndUsage
request = Service -> GetCostAndUsage -> Request GetCostAndUsage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCostAndUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCostAndUsage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCostAndUsage))
-> Logger
-> Service
-> Proxy GetCostAndUsage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCostAndUsage)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageResponse
GetCostAndUsageResponse'
            (Maybe [ResultByTime]
 -> Maybe Text
 -> Maybe [DimensionValuesWithAttributes]
 -> Maybe [GroupDefinition]
 -> Int
 -> GetCostAndUsageResponse)
-> Either String (Maybe [ResultByTime])
-> Either
     String
     (Maybe Text
      -> Maybe [DimensionValuesWithAttributes]
      -> Maybe [GroupDefinition]
      -> Int
      -> GetCostAndUsageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ResultByTime]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultsByTime" Either String (Maybe (Maybe [ResultByTime]))
-> Maybe [ResultByTime] -> Either String (Maybe [ResultByTime])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResultByTime]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe [DimensionValuesWithAttributes]
   -> Maybe [GroupDefinition]
   -> Int
   -> GetCostAndUsageResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [DimensionValuesWithAttributes]
      -> Maybe [GroupDefinition] -> Int -> GetCostAndUsageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextPageToken")
            Either
  String
  (Maybe [DimensionValuesWithAttributes]
   -> Maybe [GroupDefinition] -> Int -> GetCostAndUsageResponse)
-> Either String (Maybe [DimensionValuesWithAttributes])
-> Either
     String (Maybe [GroupDefinition] -> Int -> GetCostAndUsageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [DimensionValuesWithAttributes]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DimensionValueAttributes"
                            Either String (Maybe (Maybe [DimensionValuesWithAttributes]))
-> Maybe [DimensionValuesWithAttributes]
-> Either String (Maybe [DimensionValuesWithAttributes])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DimensionValuesWithAttributes]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe [GroupDefinition] -> Int -> GetCostAndUsageResponse)
-> Either String (Maybe [GroupDefinition])
-> Either String (Int -> GetCostAndUsageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe (Maybe [GroupDefinition]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GroupDefinitions"
                            Either String (Maybe (Maybe [GroupDefinition]))
-> Maybe [GroupDefinition]
-> Either String (Maybe [GroupDefinition])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GroupDefinition]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> GetCostAndUsageResponse)
-> Either String Int -> Either String GetCostAndUsageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetCostAndUsage

instance Prelude.NFData GetCostAndUsage

instance Core.ToHeaders GetCostAndUsage where
  toHeaders :: GetCostAndUsage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCostAndUsage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSInsightsIndexService.GetCostAndUsage" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON GetCostAndUsage where
  toJSON :: GetCostAndUsage -> Value
toJSON GetCostAndUsage' {[Text]
Maybe [GroupDefinition]
Maybe Text
Maybe Expression
DateInterval
Granularity
metrics :: [Text]
granularity :: Granularity
timePeriod :: DateInterval
filter' :: Maybe Expression
nextPageToken :: Maybe Text
groupBy :: Maybe [GroupDefinition]
$sel:metrics:GetCostAndUsage' :: GetCostAndUsage -> [Text]
$sel:granularity:GetCostAndUsage' :: GetCostAndUsage -> Granularity
$sel:timePeriod:GetCostAndUsage' :: GetCostAndUsage -> DateInterval
$sel:filter':GetCostAndUsage' :: GetCostAndUsage -> Maybe Expression
$sel:nextPageToken:GetCostAndUsage' :: GetCostAndUsage -> Maybe Text
$sel:groupBy:GetCostAndUsage' :: GetCostAndUsage -> Maybe [GroupDefinition]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GroupBy" Text -> [GroupDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([GroupDefinition] -> Pair)
-> Maybe [GroupDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [GroupDefinition]
groupBy,
            (Text
"NextPageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextPageToken,
            (Text
"Filter" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Expression -> Pair) -> Maybe Expression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Expression
filter',
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimePeriod" Text -> DateInterval -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DateInterval
timePeriod),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Granularity" Text -> Granularity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Granularity
granularity),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Metrics" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
metrics)
          ]
      )

instance Core.ToPath GetCostAndUsage where
  toPath :: GetCostAndUsage -> ByteString
toPath = ByteString -> GetCostAndUsage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery GetCostAndUsage where
  toQuery :: GetCostAndUsage -> QueryString
toQuery = QueryString -> GetCostAndUsage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetCostAndUsageResponse' smart constructor.
data GetCostAndUsageResponse = GetCostAndUsageResponse'
  { -- | The time period that\'s covered by the results in the response.
    GetCostAndUsageResponse -> Maybe [ResultByTime]
resultsByTime :: Prelude.Maybe [ResultByTime],
    -- | The token for the next set of retrievable results. Amazon Web Services
    -- provides the token when the response from a previous call has more
    -- results than the maximum page size.
    GetCostAndUsageResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The attributes that apply to a specific dimension value. For example, if
    -- the value is a linked account, the attribute is that account name.
    GetCostAndUsageResponse -> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Prelude.Maybe [DimensionValuesWithAttributes],
    -- | The groups that are specified by the @Filter@ or @GroupBy@ parameters in
    -- the request.
    GetCostAndUsageResponse -> Maybe [GroupDefinition]
groupDefinitions :: Prelude.Maybe [GroupDefinition],
    -- | The response's http status code.
    GetCostAndUsageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool
(GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool)
-> (GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool)
-> Eq GetCostAndUsageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool
$c/= :: GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool
== :: GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool
$c== :: GetCostAndUsageResponse -> GetCostAndUsageResponse -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsageResponse]
ReadPrec GetCostAndUsageResponse
Int -> ReadS GetCostAndUsageResponse
ReadS [GetCostAndUsageResponse]
(Int -> ReadS GetCostAndUsageResponse)
-> ReadS [GetCostAndUsageResponse]
-> ReadPrec GetCostAndUsageResponse
-> ReadPrec [GetCostAndUsageResponse]
-> Read GetCostAndUsageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsageResponse]
$creadListPrec :: ReadPrec [GetCostAndUsageResponse]
readPrec :: ReadPrec GetCostAndUsageResponse
$creadPrec :: ReadPrec GetCostAndUsageResponse
readList :: ReadS [GetCostAndUsageResponse]
$creadList :: ReadS [GetCostAndUsageResponse]
readsPrec :: Int -> ReadS GetCostAndUsageResponse
$creadsPrec :: Int -> ReadS GetCostAndUsageResponse
Prelude.Read, Int -> GetCostAndUsageResponse -> ShowS
[GetCostAndUsageResponse] -> ShowS
GetCostAndUsageResponse -> String
(Int -> GetCostAndUsageResponse -> ShowS)
-> (GetCostAndUsageResponse -> String)
-> ([GetCostAndUsageResponse] -> ShowS)
-> Show GetCostAndUsageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsageResponse] -> ShowS
$cshowList :: [GetCostAndUsageResponse] -> ShowS
show :: GetCostAndUsageResponse -> String
$cshow :: GetCostAndUsageResponse -> String
showsPrec :: Int -> GetCostAndUsageResponse -> ShowS
$cshowsPrec :: Int -> GetCostAndUsageResponse -> ShowS
Prelude.Show, (forall x.
 GetCostAndUsageResponse -> Rep GetCostAndUsageResponse x)
-> (forall x.
    Rep GetCostAndUsageResponse x -> GetCostAndUsageResponse)
-> Generic GetCostAndUsageResponse
forall x. Rep GetCostAndUsageResponse x -> GetCostAndUsageResponse
forall x. GetCostAndUsageResponse -> Rep GetCostAndUsageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCostAndUsageResponse x -> GetCostAndUsageResponse
$cfrom :: forall x. GetCostAndUsageResponse -> Rep GetCostAndUsageResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCostAndUsageResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'resultsByTime', 'getCostAndUsageResponse_resultsByTime' - The time period that\'s covered by the results in the response.
--
-- 'nextPageToken', 'getCostAndUsageResponse_nextPageToken' - The token for the next set of retrievable results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
--
-- 'dimensionValueAttributes', 'getCostAndUsageResponse_dimensionValueAttributes' - The attributes that apply to a specific dimension value. For example, if
-- the value is a linked account, the attribute is that account name.
--
-- 'groupDefinitions', 'getCostAndUsageResponse_groupDefinitions' - The groups that are specified by the @Filter@ or @GroupBy@ parameters in
-- the request.
--
-- 'httpStatus', 'getCostAndUsageResponse_httpStatus' - The response's http status code.
newGetCostAndUsageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCostAndUsageResponse
newGetCostAndUsageResponse :: Int -> GetCostAndUsageResponse
newGetCostAndUsageResponse Int
pHttpStatus_ =
  GetCostAndUsageResponse' :: Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageResponse
GetCostAndUsageResponse'
    { $sel:resultsByTime:GetCostAndUsageResponse' :: Maybe [ResultByTime]
resultsByTime =
        Maybe [ResultByTime]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetCostAndUsageResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dimensionValueAttributes:GetCostAndUsageResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes = Maybe [DimensionValuesWithAttributes]
forall a. Maybe a
Prelude.Nothing,
      $sel:groupDefinitions:GetCostAndUsageResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCostAndUsageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The time period that\'s covered by the results in the response.
getCostAndUsageResponse_resultsByTime :: Lens.Lens' GetCostAndUsageResponse (Prelude.Maybe [ResultByTime])
getCostAndUsageResponse_resultsByTime :: (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageResponse -> f GetCostAndUsageResponse
getCostAndUsageResponse_resultsByTime = (GetCostAndUsageResponse -> Maybe [ResultByTime])
-> (GetCostAndUsageResponse
    -> Maybe [ResultByTime] -> GetCostAndUsageResponse)
-> Lens
     GetCostAndUsageResponse
     GetCostAndUsageResponse
     (Maybe [ResultByTime])
     (Maybe [ResultByTime])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageResponse' {Maybe [ResultByTime]
resultsByTime :: Maybe [ResultByTime]
$sel:resultsByTime:GetCostAndUsageResponse' :: GetCostAndUsageResponse -> Maybe [ResultByTime]
resultsByTime} -> Maybe [ResultByTime]
resultsByTime) (\s :: GetCostAndUsageResponse
s@GetCostAndUsageResponse' {} Maybe [ResultByTime]
a -> GetCostAndUsageResponse
s {$sel:resultsByTime:GetCostAndUsageResponse' :: Maybe [ResultByTime]
resultsByTime = Maybe [ResultByTime]
a} :: GetCostAndUsageResponse) ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
 -> GetCostAndUsageResponse -> f GetCostAndUsageResponse)
-> ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
    -> Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageResponse
-> f GetCostAndUsageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ResultByTime] [ResultByTime] [ResultByTime] [ResultByTime]
-> Iso
     (Maybe [ResultByTime])
     (Maybe [ResultByTime])
     (Maybe [ResultByTime])
     (Maybe [ResultByTime])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [ResultByTime] [ResultByTime] [ResultByTime] [ResultByTime]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of retrievable results. Amazon Web Services
-- provides the token when the response from a previous call has more
-- results than the maximum page size.
getCostAndUsageResponse_nextPageToken :: Lens.Lens' GetCostAndUsageResponse (Prelude.Maybe Prelude.Text)
getCostAndUsageResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsageResponse -> f GetCostAndUsageResponse
getCostAndUsageResponse_nextPageToken = (GetCostAndUsageResponse -> Maybe Text)
-> (GetCostAndUsageResponse
    -> Maybe Text -> GetCostAndUsageResponse)
-> Lens
     GetCostAndUsageResponse
     GetCostAndUsageResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsageResponse' :: GetCostAndUsageResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsageResponse
s@GetCostAndUsageResponse' {} Maybe Text
a -> GetCostAndUsageResponse
s {$sel:nextPageToken:GetCostAndUsageResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsageResponse)

-- | The attributes that apply to a specific dimension value. For example, if
-- the value is a linked account, the attribute is that account name.
getCostAndUsageResponse_dimensionValueAttributes :: Lens.Lens' GetCostAndUsageResponse (Prelude.Maybe [DimensionValuesWithAttributes])
getCostAndUsageResponse_dimensionValueAttributes :: (Maybe [DimensionValuesWithAttributes]
 -> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageResponse -> f GetCostAndUsageResponse
getCostAndUsageResponse_dimensionValueAttributes = (GetCostAndUsageResponse -> Maybe [DimensionValuesWithAttributes])
-> (GetCostAndUsageResponse
    -> Maybe [DimensionValuesWithAttributes]
    -> GetCostAndUsageResponse)
-> Lens
     GetCostAndUsageResponse
     GetCostAndUsageResponse
     (Maybe [DimensionValuesWithAttributes])
     (Maybe [DimensionValuesWithAttributes])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageResponse' {Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Maybe [DimensionValuesWithAttributes]
$sel:dimensionValueAttributes:GetCostAndUsageResponse' :: GetCostAndUsageResponse -> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes} -> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes) (\s :: GetCostAndUsageResponse
s@GetCostAndUsageResponse' {} Maybe [DimensionValuesWithAttributes]
a -> GetCostAndUsageResponse
s {$sel:dimensionValueAttributes:GetCostAndUsageResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes = Maybe [DimensionValuesWithAttributes]
a} :: GetCostAndUsageResponse) ((Maybe [DimensionValuesWithAttributes]
  -> f (Maybe [DimensionValuesWithAttributes]))
 -> GetCostAndUsageResponse -> f GetCostAndUsageResponse)
-> ((Maybe [DimensionValuesWithAttributes]
     -> f (Maybe [DimensionValuesWithAttributes]))
    -> Maybe [DimensionValuesWithAttributes]
    -> f (Maybe [DimensionValuesWithAttributes]))
-> (Maybe [DimensionValuesWithAttributes]
    -> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageResponse
-> f GetCostAndUsageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
-> Iso
     (Maybe [DimensionValuesWithAttributes])
     (Maybe [DimensionValuesWithAttributes])
     (Maybe [DimensionValuesWithAttributes])
     (Maybe [DimensionValuesWithAttributes])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
  [DimensionValuesWithAttributes]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The groups that are specified by the @Filter@ or @GroupBy@ parameters in
-- the request.
getCostAndUsageResponse_groupDefinitions :: Lens.Lens' GetCostAndUsageResponse (Prelude.Maybe [GroupDefinition])
getCostAndUsageResponse_groupDefinitions :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageResponse -> f GetCostAndUsageResponse
getCostAndUsageResponse_groupDefinitions = (GetCostAndUsageResponse -> Maybe [GroupDefinition])
-> (GetCostAndUsageResponse
    -> Maybe [GroupDefinition] -> GetCostAndUsageResponse)
-> Lens
     GetCostAndUsageResponse
     GetCostAndUsageResponse
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageResponse' {Maybe [GroupDefinition]
groupDefinitions :: Maybe [GroupDefinition]
$sel:groupDefinitions:GetCostAndUsageResponse' :: GetCostAndUsageResponse -> Maybe [GroupDefinition]
groupDefinitions} -> Maybe [GroupDefinition]
groupDefinitions) (\s :: GetCostAndUsageResponse
s@GetCostAndUsageResponse' {} Maybe [GroupDefinition]
a -> GetCostAndUsageResponse
s {$sel:groupDefinitions:GetCostAndUsageResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
a} :: GetCostAndUsageResponse) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
 -> GetCostAndUsageResponse -> f GetCostAndUsageResponse)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
    -> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageResponse
-> f GetCostAndUsageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
-> Iso
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
  [GroupDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
getCostAndUsageResponse_httpStatus :: Lens.Lens' GetCostAndUsageResponse Prelude.Int
getCostAndUsageResponse_httpStatus :: (Int -> f Int)
-> GetCostAndUsageResponse -> f GetCostAndUsageResponse
getCostAndUsageResponse_httpStatus = (GetCostAndUsageResponse -> Int)
-> (GetCostAndUsageResponse -> Int -> GetCostAndUsageResponse)
-> Lens GetCostAndUsageResponse GetCostAndUsageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCostAndUsageResponse' :: GetCostAndUsageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCostAndUsageResponse
s@GetCostAndUsageResponse' {} Int
a -> GetCostAndUsageResponse
s {$sel:httpStatus:GetCostAndUsageResponse' :: Int
httpStatus = Int
a} :: GetCostAndUsageResponse)

instance Prelude.NFData GetCostAndUsageResponse