{-# 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.GetCostAndUsageWithResources
-- 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 with resources for your account. You
-- can specify which cost and usage-related metric, such as @BlendedCosts@
-- or @UsageQuantity@, that you want the request to return. 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. This API is currently available for the
-- Amazon Elastic Compute Cloud – Compute service only.
--
-- This is an opt-in only feature. You can enable this feature from the
-- Cost Explorer Settings page. For information on how to access the
-- Settings page, see
-- <https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/ce-access.html Controlling Access for Cost Explorer>
-- in the /Billing and Cost Management User Guide/.
module Amazonka.CostExplorer.GetCostAndUsageWithResources
  ( -- * Creating a Request
    GetCostAndUsageWithResources (..),
    newGetCostAndUsageWithResources,

    -- * Request Lenses
    getCostAndUsageWithResources_groupBy,
    getCostAndUsageWithResources_nextPageToken,
    getCostAndUsageWithResources_metrics,
    getCostAndUsageWithResources_timePeriod,
    getCostAndUsageWithResources_granularity,
    getCostAndUsageWithResources_filter,

    -- * Destructuring the Response
    GetCostAndUsageWithResourcesResponse (..),
    newGetCostAndUsageWithResourcesResponse,

    -- * Response Lenses
    getCostAndUsageWithResourcesResponse_resultsByTime,
    getCostAndUsageWithResourcesResponse_nextPageToken,
    getCostAndUsageWithResourcesResponse_dimensionValueAttributes,
    getCostAndUsageWithResourcesResponse_groupDefinitions,
    getCostAndUsageWithResourcesResponse_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:/ 'newGetCostAndUsageWithResources' smart constructor.
data GetCostAndUsageWithResources = GetCostAndUsageWithResources'
  { -- | You can group Amazon Web Services costs using up to two different
    -- groups: @DIMENSION@, @TAG@, @COST_CATEGORY@.
    GetCostAndUsageWithResources -> 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.
    GetCostAndUsageWithResources -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | 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 the units into account. 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 vs. GB). To get more
    -- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
    -- @UsageTypeGroups@.
    --
    -- @Metrics@ is required for @GetCostAndUsageWithResources@ requests.
    GetCostAndUsageWithResources -> Maybe [Text]
metrics :: Prelude.Maybe [Prelude.Text],
    -- | Sets the start and end dates for retrieving Amazon Web Services costs.
    -- The range must be within the last 14 days (the start date cannot be
    -- earlier than 14 days ago). 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@.
    GetCostAndUsageWithResources -> DateInterval
timePeriod :: DateInterval,
    -- | Sets the Amazon Web Services cost granularity to @MONTHLY@, @DAILY@, or
    -- @HOURLY@. If @Granularity@ isn\'t set, the response object doesn\'t
    -- include the @Granularity@, @MONTHLY@, @DAILY@, or @HOURLY@.
    GetCostAndUsageWithResources -> Granularity
granularity :: Granularity,
    -- | 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>.
    --
    -- The @GetCostAndUsageWithResources@ operation requires that you either
    -- group by or filter by a @ResourceId@. It requires the
    -- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
    -- @\"SERVICE = Amazon Elastic Compute Cloud - Compute\"@ in the filter.
    GetCostAndUsageWithResources -> Expression
filter' :: Expression
  }
  deriving (GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
(GetCostAndUsageWithResources
 -> GetCostAndUsageWithResources -> Bool)
-> (GetCostAndUsageWithResources
    -> GetCostAndUsageWithResources -> Bool)
-> Eq GetCostAndUsageWithResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
$c/= :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
== :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
$c== :: GetCostAndUsageWithResources
-> GetCostAndUsageWithResources -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsageWithResources]
ReadPrec GetCostAndUsageWithResources
Int -> ReadS GetCostAndUsageWithResources
ReadS [GetCostAndUsageWithResources]
(Int -> ReadS GetCostAndUsageWithResources)
-> ReadS [GetCostAndUsageWithResources]
-> ReadPrec GetCostAndUsageWithResources
-> ReadPrec [GetCostAndUsageWithResources]
-> Read GetCostAndUsageWithResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsageWithResources]
$creadListPrec :: ReadPrec [GetCostAndUsageWithResources]
readPrec :: ReadPrec GetCostAndUsageWithResources
$creadPrec :: ReadPrec GetCostAndUsageWithResources
readList :: ReadS [GetCostAndUsageWithResources]
$creadList :: ReadS [GetCostAndUsageWithResources]
readsPrec :: Int -> ReadS GetCostAndUsageWithResources
$creadsPrec :: Int -> ReadS GetCostAndUsageWithResources
Prelude.Read, Int -> GetCostAndUsageWithResources -> ShowS
[GetCostAndUsageWithResources] -> ShowS
GetCostAndUsageWithResources -> String
(Int -> GetCostAndUsageWithResources -> ShowS)
-> (GetCostAndUsageWithResources -> String)
-> ([GetCostAndUsageWithResources] -> ShowS)
-> Show GetCostAndUsageWithResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsageWithResources] -> ShowS
$cshowList :: [GetCostAndUsageWithResources] -> ShowS
show :: GetCostAndUsageWithResources -> String
$cshow :: GetCostAndUsageWithResources -> String
showsPrec :: Int -> GetCostAndUsageWithResources -> ShowS
$cshowsPrec :: Int -> GetCostAndUsageWithResources -> ShowS
Prelude.Show, (forall x.
 GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x)
-> (forall x.
    Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources)
-> Generic GetCostAndUsageWithResources
forall x.
Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources
forall x.
GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCostAndUsageWithResources x -> GetCostAndUsageWithResources
$cfrom :: forall x.
GetCostAndUsageWithResources -> Rep GetCostAndUsageWithResources x
Prelude.Generic)

-- |
-- Create a value of 'GetCostAndUsageWithResources' 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', 'getCostAndUsageWithResources_groupBy' - You can group Amazon Web Services costs using up to two different
-- groups: @DIMENSION@, @TAG@, @COST_CATEGORY@.
--
-- 'nextPageToken', 'getCostAndUsageWithResources_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.
--
-- 'metrics', 'getCostAndUsageWithResources_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 the units into account. 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 vs. GB). To get more
-- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
-- @UsageTypeGroups@.
--
-- @Metrics@ is required for @GetCostAndUsageWithResources@ requests.
--
-- 'timePeriod', 'getCostAndUsageWithResources_timePeriod' - Sets the start and end dates for retrieving Amazon Web Services costs.
-- The range must be within the last 14 days (the start date cannot be
-- earlier than 14 days ago). 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', 'getCostAndUsageWithResources_granularity' - Sets the Amazon Web Services cost granularity to @MONTHLY@, @DAILY@, or
-- @HOURLY@. If @Granularity@ isn\'t set, the response object doesn\'t
-- include the @Granularity@, @MONTHLY@, @DAILY@, or @HOURLY@.
--
-- 'filter'', 'getCostAndUsageWithResources_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>.
--
-- The @GetCostAndUsageWithResources@ operation requires that you either
-- group by or filter by a @ResourceId@. It requires the
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
-- @\"SERVICE = Amazon Elastic Compute Cloud - Compute\"@ in the filter.
newGetCostAndUsageWithResources ::
  -- | 'timePeriod'
  DateInterval ->
  -- | 'granularity'
  Granularity ->
  -- | 'filter''
  Expression ->
  GetCostAndUsageWithResources
newGetCostAndUsageWithResources :: DateInterval
-> Granularity -> Expression -> GetCostAndUsageWithResources
newGetCostAndUsageWithResources
  DateInterval
pTimePeriod_
  Granularity
pGranularity_
  Expression
pFilter_ =
    GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
-> Maybe Text
-> Maybe [Text]
-> DateInterval
-> Granularity
-> Expression
-> GetCostAndUsageWithResources
GetCostAndUsageWithResources'
      { $sel:groupBy:GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
groupBy =
          Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextPageToken:GetCostAndUsageWithResources' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:metrics:GetCostAndUsageWithResources' :: Maybe [Text]
metrics = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:timePeriod:GetCostAndUsageWithResources' :: DateInterval
timePeriod = DateInterval
pTimePeriod_,
        $sel:granularity:GetCostAndUsageWithResources' :: Granularity
granularity = Granularity
pGranularity_,
        $sel:filter':GetCostAndUsageWithResources' :: Expression
filter' = Expression
pFilter_
      }

-- | You can group Amazon Web Services costs using up to two different
-- groups: @DIMENSION@, @TAG@, @COST_CATEGORY@.
getCostAndUsageWithResources_groupBy :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe [GroupDefinition])
getCostAndUsageWithResources_groupBy :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_groupBy = (GetCostAndUsageWithResources -> Maybe [GroupDefinition])
-> (GetCostAndUsageWithResources
    -> Maybe [GroupDefinition] -> GetCostAndUsageWithResources)
-> Lens
     GetCostAndUsageWithResources
     GetCostAndUsageWithResources
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe [GroupDefinition]
groupBy :: Maybe [GroupDefinition]
$sel:groupBy:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [GroupDefinition]
groupBy} -> Maybe [GroupDefinition]
groupBy) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe [GroupDefinition]
a -> GetCostAndUsageWithResources
s {$sel:groupBy:GetCostAndUsageWithResources' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
a} :: GetCostAndUsageWithResources) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
 -> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
    -> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResources
-> f GetCostAndUsageWithResources
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.
getCostAndUsageWithResources_nextPageToken :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe Prelude.Text)
getCostAndUsageWithResources_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_nextPageToken = (GetCostAndUsageWithResources -> Maybe Text)
-> (GetCostAndUsageWithResources
    -> Maybe Text -> GetCostAndUsageWithResources)
-> Lens
     GetCostAndUsageWithResources
     GetCostAndUsageWithResources
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe Text
a -> GetCostAndUsageWithResources
s {$sel:nextPageToken:GetCostAndUsageWithResources' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsageWithResources)

-- | 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 the units into account. 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 vs. GB). To get more
-- meaningful @UsageQuantity@ metrics, filter by @UsageType@ or
-- @UsageTypeGroups@.
--
-- @Metrics@ is required for @GetCostAndUsageWithResources@ requests.
getCostAndUsageWithResources_metrics :: Lens.Lens' GetCostAndUsageWithResources (Prelude.Maybe [Prelude.Text])
getCostAndUsageWithResources_metrics :: (Maybe [Text] -> f (Maybe [Text]))
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_metrics = (GetCostAndUsageWithResources -> Maybe [Text])
-> (GetCostAndUsageWithResources
    -> Maybe [Text] -> GetCostAndUsageWithResources)
-> Lens
     GetCostAndUsageWithResources
     GetCostAndUsageWithResources
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Maybe [Text]
metrics :: Maybe [Text]
$sel:metrics:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [Text]
metrics} -> Maybe [Text]
metrics) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Maybe [Text]
a -> GetCostAndUsageWithResources
s {$sel:metrics:GetCostAndUsageWithResources' :: Maybe [Text]
metrics = Maybe [Text]
a} :: GetCostAndUsageWithResources) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetCostAndUsageWithResources
-> f GetCostAndUsageWithResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Sets the start and end dates for retrieving Amazon Web Services costs.
-- The range must be within the last 14 days (the start date cannot be
-- earlier than 14 days ago). 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@.
getCostAndUsageWithResources_timePeriod :: Lens.Lens' GetCostAndUsageWithResources DateInterval
getCostAndUsageWithResources_timePeriod :: (DateInterval -> f DateInterval)
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_timePeriod = (GetCostAndUsageWithResources -> DateInterval)
-> (GetCostAndUsageWithResources
    -> DateInterval -> GetCostAndUsageWithResources)
-> Lens
     GetCostAndUsageWithResources
     GetCostAndUsageWithResources
     DateInterval
     DateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {DateInterval
timePeriod :: DateInterval
$sel:timePeriod:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> DateInterval
timePeriod} -> DateInterval
timePeriod) (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} DateInterval
a -> GetCostAndUsageWithResources
s {$sel:timePeriod:GetCostAndUsageWithResources' :: DateInterval
timePeriod = DateInterval
a} :: GetCostAndUsageWithResources)

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

-- | 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>.
--
-- The @GetCostAndUsageWithResources@ operation requires that you either
-- group by or filter by a @ResourceId@. It requires the
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
-- @\"SERVICE = Amazon Elastic Compute Cloud - Compute\"@ in the filter.
getCostAndUsageWithResources_filter :: Lens.Lens' GetCostAndUsageWithResources Expression
getCostAndUsageWithResources_filter :: (Expression -> f Expression)
-> GetCostAndUsageWithResources -> f GetCostAndUsageWithResources
getCostAndUsageWithResources_filter = (GetCostAndUsageWithResources -> Expression)
-> (GetCostAndUsageWithResources
    -> Expression -> GetCostAndUsageWithResources)
-> Lens
     GetCostAndUsageWithResources
     GetCostAndUsageWithResources
     Expression
     Expression
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResources' {Expression
filter' :: Expression
$sel:filter':GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Expression
filter'} -> Expression
filter') (\s :: GetCostAndUsageWithResources
s@GetCostAndUsageWithResources' {} Expression
a -> GetCostAndUsageWithResources
s {$sel:filter':GetCostAndUsageWithResources' :: Expression
filter' = Expression
a} :: GetCostAndUsageWithResources)

instance Core.AWSRequest GetCostAndUsageWithResources where
  type
    AWSResponse GetCostAndUsageWithResources =
      GetCostAndUsageWithResourcesResponse
  request :: GetCostAndUsageWithResources
-> Request GetCostAndUsageWithResources
request = Service
-> GetCostAndUsageWithResources
-> Request GetCostAndUsageWithResources
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCostAndUsageWithResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCostAndUsageWithResources)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCostAndUsageWithResources))
-> Logger
-> Service
-> Proxy GetCostAndUsageWithResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCostAndUsageWithResources)))
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
-> GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse'
            (Maybe [ResultByTime]
 -> Maybe Text
 -> Maybe [DimensionValuesWithAttributes]
 -> Maybe [GroupDefinition]
 -> Int
 -> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [ResultByTime])
-> Either
     String
     (Maybe Text
      -> Maybe [DimensionValuesWithAttributes]
      -> Maybe [GroupDefinition]
      -> Int
      -> GetCostAndUsageWithResourcesResponse)
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
   -> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [DimensionValuesWithAttributes]
      -> Maybe [GroupDefinition]
      -> Int
      -> GetCostAndUsageWithResourcesResponse)
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
   -> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [DimensionValuesWithAttributes])
-> Either
     String
     (Maybe [GroupDefinition]
      -> Int -> GetCostAndUsageWithResourcesResponse)
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 -> GetCostAndUsageWithResourcesResponse)
-> Either String (Maybe [GroupDefinition])
-> Either String (Int -> GetCostAndUsageWithResourcesResponse)
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 -> GetCostAndUsageWithResourcesResponse)
-> Either String Int
-> Either String GetCostAndUsageWithResourcesResponse
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
    GetCostAndUsageWithResources

instance Prelude.NFData GetCostAndUsageWithResources

instance Core.ToHeaders GetCostAndUsageWithResources where
  toHeaders :: GetCostAndUsageWithResources -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCostAndUsageWithResources -> 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.GetCostAndUsageWithResources" ::
                          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 GetCostAndUsageWithResources where
  toJSON :: GetCostAndUsageWithResources -> Value
toJSON GetCostAndUsageWithResources' {Maybe [Text]
Maybe [GroupDefinition]
Maybe Text
DateInterval
Granularity
Expression
filter' :: Expression
granularity :: Granularity
timePeriod :: DateInterval
metrics :: Maybe [Text]
nextPageToken :: Maybe Text
groupBy :: Maybe [GroupDefinition]
$sel:filter':GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Expression
$sel:granularity:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Granularity
$sel:timePeriod:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> DateInterval
$sel:metrics:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe [Text]
$sel:nextPageToken:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> Maybe Text
$sel:groupBy:GetCostAndUsageWithResources' :: GetCostAndUsageWithResources -> 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
"Metrics" 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]
metrics,
            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
"Filter" Text -> Expression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Expression
filter')
          ]
      )

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

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

-- | /See:/ 'newGetCostAndUsageWithResourcesResponse' smart constructor.
data GetCostAndUsageWithResourcesResponse = GetCostAndUsageWithResourcesResponse'
  { -- | The time period that is covered by the results in the response.
    GetCostAndUsageWithResourcesResponse -> 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.
    GetCostAndUsageWithResourcesResponse -> 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.
    GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Prelude.Maybe [DimensionValuesWithAttributes],
    -- | The groups that are specified by the @Filter@ or @GroupBy@ parameters in
    -- the request.
    GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition]
groupDefinitions :: Prelude.Maybe [GroupDefinition],
    -- | The response's http status code.
    GetCostAndUsageWithResourcesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
(GetCostAndUsageWithResourcesResponse
 -> GetCostAndUsageWithResourcesResponse -> Bool)
-> (GetCostAndUsageWithResourcesResponse
    -> GetCostAndUsageWithResourcesResponse -> Bool)
-> Eq GetCostAndUsageWithResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
$c/= :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
== :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
$c== :: GetCostAndUsageWithResourcesResponse
-> GetCostAndUsageWithResourcesResponse -> Bool
Prelude.Eq, ReadPrec [GetCostAndUsageWithResourcesResponse]
ReadPrec GetCostAndUsageWithResourcesResponse
Int -> ReadS GetCostAndUsageWithResourcesResponse
ReadS [GetCostAndUsageWithResourcesResponse]
(Int -> ReadS GetCostAndUsageWithResourcesResponse)
-> ReadS [GetCostAndUsageWithResourcesResponse]
-> ReadPrec GetCostAndUsageWithResourcesResponse
-> ReadPrec [GetCostAndUsageWithResourcesResponse]
-> Read GetCostAndUsageWithResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCostAndUsageWithResourcesResponse]
$creadListPrec :: ReadPrec [GetCostAndUsageWithResourcesResponse]
readPrec :: ReadPrec GetCostAndUsageWithResourcesResponse
$creadPrec :: ReadPrec GetCostAndUsageWithResourcesResponse
readList :: ReadS [GetCostAndUsageWithResourcesResponse]
$creadList :: ReadS [GetCostAndUsageWithResourcesResponse]
readsPrec :: Int -> ReadS GetCostAndUsageWithResourcesResponse
$creadsPrec :: Int -> ReadS GetCostAndUsageWithResourcesResponse
Prelude.Read, Int -> GetCostAndUsageWithResourcesResponse -> ShowS
[GetCostAndUsageWithResourcesResponse] -> ShowS
GetCostAndUsageWithResourcesResponse -> String
(Int -> GetCostAndUsageWithResourcesResponse -> ShowS)
-> (GetCostAndUsageWithResourcesResponse -> String)
-> ([GetCostAndUsageWithResourcesResponse] -> ShowS)
-> Show GetCostAndUsageWithResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCostAndUsageWithResourcesResponse] -> ShowS
$cshowList :: [GetCostAndUsageWithResourcesResponse] -> ShowS
show :: GetCostAndUsageWithResourcesResponse -> String
$cshow :: GetCostAndUsageWithResourcesResponse -> String
showsPrec :: Int -> GetCostAndUsageWithResourcesResponse -> ShowS
$cshowsPrec :: Int -> GetCostAndUsageWithResourcesResponse -> ShowS
Prelude.Show, (forall x.
 GetCostAndUsageWithResourcesResponse
 -> Rep GetCostAndUsageWithResourcesResponse x)
-> (forall x.
    Rep GetCostAndUsageWithResourcesResponse x
    -> GetCostAndUsageWithResourcesResponse)
-> Generic GetCostAndUsageWithResourcesResponse
forall x.
Rep GetCostAndUsageWithResourcesResponse x
-> GetCostAndUsageWithResourcesResponse
forall x.
GetCostAndUsageWithResourcesResponse
-> Rep GetCostAndUsageWithResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCostAndUsageWithResourcesResponse x
-> GetCostAndUsageWithResourcesResponse
$cfrom :: forall x.
GetCostAndUsageWithResourcesResponse
-> Rep GetCostAndUsageWithResourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCostAndUsageWithResourcesResponse' 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', 'getCostAndUsageWithResourcesResponse_resultsByTime' - The time period that is covered by the results in the response.
--
-- 'nextPageToken', 'getCostAndUsageWithResourcesResponse_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', 'getCostAndUsageWithResourcesResponse_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', 'getCostAndUsageWithResourcesResponse_groupDefinitions' - The groups that are specified by the @Filter@ or @GroupBy@ parameters in
-- the request.
--
-- 'httpStatus', 'getCostAndUsageWithResourcesResponse_httpStatus' - The response's http status code.
newGetCostAndUsageWithResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCostAndUsageWithResourcesResponse
newGetCostAndUsageWithResourcesResponse :: Int -> GetCostAndUsageWithResourcesResponse
newGetCostAndUsageWithResourcesResponse Int
pHttpStatus_ =
  GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
-> Maybe Text
-> Maybe [DimensionValuesWithAttributes]
-> Maybe [GroupDefinition]
-> Int
-> GetCostAndUsageWithResourcesResponse
GetCostAndUsageWithResourcesResponse'
    { $sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
resultsByTime =
        Maybe [ResultByTime]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes =
        Maybe [DimensionValuesWithAttributes]
forall a. Maybe a
Prelude.Nothing,
      $sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The time period that is covered by the results in the response.
getCostAndUsageWithResourcesResponse_resultsByTime :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [ResultByTime])
getCostAndUsageWithResourcesResponse_resultsByTime :: (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_resultsByTime = (GetCostAndUsageWithResourcesResponse -> Maybe [ResultByTime])
-> (GetCostAndUsageWithResourcesResponse
    -> Maybe [ResultByTime] -> GetCostAndUsageWithResourcesResponse)
-> Lens
     GetCostAndUsageWithResourcesResponse
     GetCostAndUsageWithResourcesResponse
     (Maybe [ResultByTime])
     (Maybe [ResultByTime])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [ResultByTime]
resultsByTime :: Maybe [ResultByTime]
$sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe [ResultByTime]
resultsByTime} -> Maybe [ResultByTime]
resultsByTime) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [ResultByTime]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:resultsByTime:GetCostAndUsageWithResourcesResponse' :: Maybe [ResultByTime]
resultsByTime = Maybe [ResultByTime]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
 -> GetCostAndUsageWithResourcesResponse
 -> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
    -> Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> (Maybe [ResultByTime] -> f (Maybe [ResultByTime]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
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.
getCostAndUsageWithResourcesResponse_nextPageToken :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe Prelude.Text)
getCostAndUsageWithResourcesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_nextPageToken = (GetCostAndUsageWithResourcesResponse -> Maybe Text)
-> (GetCostAndUsageWithResourcesResponse
    -> Maybe Text -> GetCostAndUsageWithResourcesResponse)
-> Lens
     GetCostAndUsageWithResourcesResponse
     GetCostAndUsageWithResourcesResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe Text
a -> GetCostAndUsageWithResourcesResponse
s {$sel:nextPageToken:GetCostAndUsageWithResourcesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetCostAndUsageWithResourcesResponse)

-- | The attributes that apply to a specific dimension value. For example, if
-- the value is a linked account, the attribute is that account name.
getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [DimensionValuesWithAttributes])
getCostAndUsageWithResourcesResponse_dimensionValueAttributes :: (Maybe [DimensionValuesWithAttributes]
 -> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_dimensionValueAttributes = (GetCostAndUsageWithResourcesResponse
 -> Maybe [DimensionValuesWithAttributes])
-> (GetCostAndUsageWithResourcesResponse
    -> Maybe [DimensionValuesWithAttributes]
    -> GetCostAndUsageWithResourcesResponse)
-> Lens
     GetCostAndUsageWithResourcesResponse
     GetCostAndUsageWithResourcesResponse
     (Maybe [DimensionValuesWithAttributes])
     (Maybe [DimensionValuesWithAttributes])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes :: Maybe [DimensionValuesWithAttributes]
$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse
-> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes} -> Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [DimensionValuesWithAttributes]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:dimensionValueAttributes:GetCostAndUsageWithResourcesResponse' :: Maybe [DimensionValuesWithAttributes]
dimensionValueAttributes = Maybe [DimensionValuesWithAttributes]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [DimensionValuesWithAttributes]
  -> f (Maybe [DimensionValuesWithAttributes]))
 -> GetCostAndUsageWithResourcesResponse
 -> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [DimensionValuesWithAttributes]
     -> f (Maybe [DimensionValuesWithAttributes]))
    -> Maybe [DimensionValuesWithAttributes]
    -> f (Maybe [DimensionValuesWithAttributes]))
-> (Maybe [DimensionValuesWithAttributes]
    -> f (Maybe [DimensionValuesWithAttributes]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
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.
getCostAndUsageWithResourcesResponse_groupDefinitions :: Lens.Lens' GetCostAndUsageWithResourcesResponse (Prelude.Maybe [GroupDefinition])
getCostAndUsageWithResourcesResponse_groupDefinitions :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_groupDefinitions = (GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition])
-> (GetCostAndUsageWithResourcesResponse
    -> Maybe [GroupDefinition] -> GetCostAndUsageWithResourcesResponse)
-> Lens
     GetCostAndUsageWithResourcesResponse
     GetCostAndUsageWithResourcesResponse
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Maybe [GroupDefinition]
groupDefinitions :: Maybe [GroupDefinition]
$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Maybe [GroupDefinition]
groupDefinitions} -> Maybe [GroupDefinition]
groupDefinitions) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Maybe [GroupDefinition]
a -> GetCostAndUsageWithResourcesResponse
s {$sel:groupDefinitions:GetCostAndUsageWithResourcesResponse' :: Maybe [GroupDefinition]
groupDefinitions = Maybe [GroupDefinition]
a} :: GetCostAndUsageWithResourcesResponse) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
 -> GetCostAndUsageWithResourcesResponse
 -> f GetCostAndUsageWithResourcesResponse)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
    -> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
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.
getCostAndUsageWithResourcesResponse_httpStatus :: Lens.Lens' GetCostAndUsageWithResourcesResponse Prelude.Int
getCostAndUsageWithResourcesResponse_httpStatus :: (Int -> f Int)
-> GetCostAndUsageWithResourcesResponse
-> f GetCostAndUsageWithResourcesResponse
getCostAndUsageWithResourcesResponse_httpStatus = (GetCostAndUsageWithResourcesResponse -> Int)
-> (GetCostAndUsageWithResourcesResponse
    -> Int -> GetCostAndUsageWithResourcesResponse)
-> Lens
     GetCostAndUsageWithResourcesResponse
     GetCostAndUsageWithResourcesResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCostAndUsageWithResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: GetCostAndUsageWithResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCostAndUsageWithResourcesResponse
s@GetCostAndUsageWithResourcesResponse' {} Int
a -> GetCostAndUsageWithResourcesResponse
s {$sel:httpStatus:GetCostAndUsageWithResourcesResponse' :: Int
httpStatus = Int
a} :: GetCostAndUsageWithResourcesResponse)

instance
  Prelude.NFData
    GetCostAndUsageWithResourcesResponse