{-# 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.GetReservationCoverage
-- 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 the reservation coverage for your account. This enables you to
-- see how much of your Amazon Elastic Compute Cloud, Amazon ElastiCache,
-- Amazon Relational Database Service, or Amazon Redshift usage is covered
-- by a reservation. An organization\'s management account can see the
-- coverage of the associated member accounts. This supports dimensions,
-- Cost Categories, and nested expressions. For any time period, you can
-- filter data about reservation usage by the following dimensions:
--
-- -   AZ
--
-- -   CACHE_ENGINE
--
-- -   DATABASE_ENGINE
--
-- -   DEPLOYMENT_OPTION
--
-- -   INSTANCE_TYPE
--
-- -   LINKED_ACCOUNT
--
-- -   OPERATING_SYSTEM
--
-- -   PLATFORM
--
-- -   REGION
--
-- -   SERVICE
--
-- -   TAG
--
-- -   TENANCY
--
-- To determine valid values for a dimension, use the @GetDimensionValues@
-- operation.
module Amazonka.CostExplorer.GetReservationCoverage
  ( -- * Creating a Request
    GetReservationCoverage (..),
    newGetReservationCoverage,

    -- * Request Lenses
    getReservationCoverage_groupBy,
    getReservationCoverage_nextPageToken,
    getReservationCoverage_metrics,
    getReservationCoverage_granularity,
    getReservationCoverage_filter,
    getReservationCoverage_maxResults,
    getReservationCoverage_sortBy,
    getReservationCoverage_timePeriod,

    -- * Destructuring the Response
    GetReservationCoverageResponse (..),
    newGetReservationCoverageResponse,

    -- * Response Lenses
    getReservationCoverageResponse_nextPageToken,
    getReservationCoverageResponse_total,
    getReservationCoverageResponse_httpStatus,
    getReservationCoverageResponse_coveragesByTime,
  )
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

-- | You can use the following request parameters to query for how much of
-- your instance usage a reservation covered.
--
-- /See:/ 'newGetReservationCoverage' smart constructor.
data GetReservationCoverage = GetReservationCoverage'
  { -- | You can group the data by the following attributes:
    --
    -- -   AZ
    --
    -- -   CACHE_ENGINE
    --
    -- -   DATABASE_ENGINE
    --
    -- -   DEPLOYMENT_OPTION
    --
    -- -   INSTANCE_TYPE
    --
    -- -   LINKED_ACCOUNT
    --
    -- -   OPERATING_SYSTEM
    --
    -- -   PLATFORM
    --
    -- -   REGION
    --
    -- -   TENANCY
    GetReservationCoverage -> 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.
    GetReservationCoverage -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The measurement that you want your reservation coverage reported in.
    --
    -- Valid values are @Hour@, @Unit@, and @Cost@. You can use multiple values
    -- in a request.
    GetReservationCoverage -> Maybe [Text]
metrics :: Prelude.Maybe [Prelude.Text],
    -- | The granularity of the Amazon Web Services cost data for the
    -- reservation. Valid values are @MONTHLY@ and @DAILY@.
    --
    -- If @GroupBy@ is set, @Granularity@ can\'t be set. If @Granularity@
    -- isn\'t set, the response object doesn\'t include @Granularity@, either
    -- @MONTHLY@ or @DAILY@.
    --
    -- The @GetReservationCoverage@ operation supports only @DAILY@ and
    -- @MONTHLY@ granularities.
    GetReservationCoverage -> Maybe Granularity
granularity :: Prelude.Maybe Granularity,
    -- | Filters utilization data by dimensions. You can filter by the following
    -- dimensions:
    --
    -- -   AZ
    --
    -- -   CACHE_ENGINE
    --
    -- -   DATABASE_ENGINE
    --
    -- -   DEPLOYMENT_OPTION
    --
    -- -   INSTANCE_TYPE
    --
    -- -   LINKED_ACCOUNT
    --
    -- -   OPERATING_SYSTEM
    --
    -- -   PLATFORM
    --
    -- -   REGION
    --
    -- -   SERVICE
    --
    -- -   TAG
    --
    -- -   TENANCY
    --
    -- @GetReservationCoverage@ uses the same
    -- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
    -- object as the other operations, but only @AND@ is supported among each
    -- dimension. You can nest only one level deep. If there are multiple
    -- values for a dimension, they are OR\'d together.
    --
    -- If you don\'t provide a @SERVICE@ filter, Cost Explorer defaults to EC2.
    --
    -- Cost category is also supported.
    GetReservationCoverage -> Maybe Expression
filter' :: Prelude.Maybe Expression,
    -- | The maximum number of objects that you returned for this request. If
    -- more objects are available, in the response, Amazon Web Services
    -- provides a NextPageToken value that you can use in a subsequent call to
    -- get the next batch of objects.
    GetReservationCoverage -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The value by which you want to sort the data.
    --
    -- The following values are supported for @Key@:
    --
    -- -   @OnDemandCost@
    --
    -- -   @CoverageHoursPercentage@
    --
    -- -   @OnDemandHours@
    --
    -- -   @ReservedHours@
    --
    -- -   @TotalRunningHours@
    --
    -- -   @CoverageNormalizedUnitsPercentage@
    --
    -- -   @OnDemandNormalizedUnits@
    --
    -- -   @ReservedNormalizedUnits@
    --
    -- -   @TotalRunningNormalizedUnits@
    --
    -- -   @Time@
    --
    -- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
    GetReservationCoverage -> Maybe SortDefinition
sortBy :: Prelude.Maybe SortDefinition,
    -- | The start and end dates of the period that you want to retrieve data
    -- about reservation coverage for. You can retrieve data for a maximum of
    -- 13 months: the last 12 months and the current month. 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@.
    GetReservationCoverage -> DateInterval
timePeriod :: DateInterval
  }
  deriving (GetReservationCoverage -> GetReservationCoverage -> Bool
(GetReservationCoverage -> GetReservationCoverage -> Bool)
-> (GetReservationCoverage -> GetReservationCoverage -> Bool)
-> Eq GetReservationCoverage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReservationCoverage -> GetReservationCoverage -> Bool
$c/= :: GetReservationCoverage -> GetReservationCoverage -> Bool
== :: GetReservationCoverage -> GetReservationCoverage -> Bool
$c== :: GetReservationCoverage -> GetReservationCoverage -> Bool
Prelude.Eq, ReadPrec [GetReservationCoverage]
ReadPrec GetReservationCoverage
Int -> ReadS GetReservationCoverage
ReadS [GetReservationCoverage]
(Int -> ReadS GetReservationCoverage)
-> ReadS [GetReservationCoverage]
-> ReadPrec GetReservationCoverage
-> ReadPrec [GetReservationCoverage]
-> Read GetReservationCoverage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReservationCoverage]
$creadListPrec :: ReadPrec [GetReservationCoverage]
readPrec :: ReadPrec GetReservationCoverage
$creadPrec :: ReadPrec GetReservationCoverage
readList :: ReadS [GetReservationCoverage]
$creadList :: ReadS [GetReservationCoverage]
readsPrec :: Int -> ReadS GetReservationCoverage
$creadsPrec :: Int -> ReadS GetReservationCoverage
Prelude.Read, Int -> GetReservationCoverage -> ShowS
[GetReservationCoverage] -> ShowS
GetReservationCoverage -> String
(Int -> GetReservationCoverage -> ShowS)
-> (GetReservationCoverage -> String)
-> ([GetReservationCoverage] -> ShowS)
-> Show GetReservationCoverage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReservationCoverage] -> ShowS
$cshowList :: [GetReservationCoverage] -> ShowS
show :: GetReservationCoverage -> String
$cshow :: GetReservationCoverage -> String
showsPrec :: Int -> GetReservationCoverage -> ShowS
$cshowsPrec :: Int -> GetReservationCoverage -> ShowS
Prelude.Show, (forall x. GetReservationCoverage -> Rep GetReservationCoverage x)
-> (forall x.
    Rep GetReservationCoverage x -> GetReservationCoverage)
-> Generic GetReservationCoverage
forall x. Rep GetReservationCoverage x -> GetReservationCoverage
forall x. GetReservationCoverage -> Rep GetReservationCoverage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetReservationCoverage x -> GetReservationCoverage
$cfrom :: forall x. GetReservationCoverage -> Rep GetReservationCoverage x
Prelude.Generic)

-- |
-- Create a value of 'GetReservationCoverage' 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', 'getReservationCoverage_groupBy' - You can group the data by the following attributes:
--
-- -   AZ
--
-- -   CACHE_ENGINE
--
-- -   DATABASE_ENGINE
--
-- -   DEPLOYMENT_OPTION
--
-- -   INSTANCE_TYPE
--
-- -   LINKED_ACCOUNT
--
-- -   OPERATING_SYSTEM
--
-- -   PLATFORM
--
-- -   REGION
--
-- -   TENANCY
--
-- 'nextPageToken', 'getReservationCoverage_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', 'getReservationCoverage_metrics' - The measurement that you want your reservation coverage reported in.
--
-- Valid values are @Hour@, @Unit@, and @Cost@. You can use multiple values
-- in a request.
--
-- 'granularity', 'getReservationCoverage_granularity' - The granularity of the Amazon Web Services cost data for the
-- reservation. Valid values are @MONTHLY@ and @DAILY@.
--
-- If @GroupBy@ is set, @Granularity@ can\'t be set. If @Granularity@
-- isn\'t set, the response object doesn\'t include @Granularity@, either
-- @MONTHLY@ or @DAILY@.
--
-- The @GetReservationCoverage@ operation supports only @DAILY@ and
-- @MONTHLY@ granularities.
--
-- 'filter'', 'getReservationCoverage_filter' - Filters utilization data by dimensions. You can filter by the following
-- dimensions:
--
-- -   AZ
--
-- -   CACHE_ENGINE
--
-- -   DATABASE_ENGINE
--
-- -   DEPLOYMENT_OPTION
--
-- -   INSTANCE_TYPE
--
-- -   LINKED_ACCOUNT
--
-- -   OPERATING_SYSTEM
--
-- -   PLATFORM
--
-- -   REGION
--
-- -   SERVICE
--
-- -   TAG
--
-- -   TENANCY
--
-- @GetReservationCoverage@ uses the same
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
-- object as the other operations, but only @AND@ is supported among each
-- dimension. You can nest only one level deep. If there are multiple
-- values for a dimension, they are OR\'d together.
--
-- If you don\'t provide a @SERVICE@ filter, Cost Explorer defaults to EC2.
--
-- Cost category is also supported.
--
-- 'maxResults', 'getReservationCoverage_maxResults' - The maximum number of objects that you returned for this request. If
-- more objects are available, in the response, Amazon Web Services
-- provides a NextPageToken value that you can use in a subsequent call to
-- get the next batch of objects.
--
-- 'sortBy', 'getReservationCoverage_sortBy' - The value by which you want to sort the data.
--
-- The following values are supported for @Key@:
--
-- -   @OnDemandCost@
--
-- -   @CoverageHoursPercentage@
--
-- -   @OnDemandHours@
--
-- -   @ReservedHours@
--
-- -   @TotalRunningHours@
--
-- -   @CoverageNormalizedUnitsPercentage@
--
-- -   @OnDemandNormalizedUnits@
--
-- -   @ReservedNormalizedUnits@
--
-- -   @TotalRunningNormalizedUnits@
--
-- -   @Time@
--
-- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
--
-- 'timePeriod', 'getReservationCoverage_timePeriod' - The start and end dates of the period that you want to retrieve data
-- about reservation coverage for. You can retrieve data for a maximum of
-- 13 months: the last 12 months and the current month. 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@.
newGetReservationCoverage ::
  -- | 'timePeriod'
  DateInterval ->
  GetReservationCoverage
newGetReservationCoverage :: DateInterval -> GetReservationCoverage
newGetReservationCoverage DateInterval
pTimePeriod_ =
  GetReservationCoverage' :: Maybe [GroupDefinition]
-> Maybe Text
-> Maybe [Text]
-> Maybe Granularity
-> Maybe Expression
-> Maybe Natural
-> Maybe SortDefinition
-> DateInterval
-> GetReservationCoverage
GetReservationCoverage'
    { $sel:groupBy:GetReservationCoverage' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetReservationCoverage' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metrics:GetReservationCoverage' :: Maybe [Text]
metrics = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:granularity:GetReservationCoverage' :: Maybe Granularity
granularity = Maybe Granularity
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':GetReservationCoverage' :: Maybe Expression
filter' = Maybe Expression
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetReservationCoverage' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:GetReservationCoverage' :: Maybe SortDefinition
sortBy = Maybe SortDefinition
forall a. Maybe a
Prelude.Nothing,
      $sel:timePeriod:GetReservationCoverage' :: DateInterval
timePeriod = DateInterval
pTimePeriod_
    }

-- | You can group the data by the following attributes:
--
-- -   AZ
--
-- -   CACHE_ENGINE
--
-- -   DATABASE_ENGINE
--
-- -   DEPLOYMENT_OPTION
--
-- -   INSTANCE_TYPE
--
-- -   LINKED_ACCOUNT
--
-- -   OPERATING_SYSTEM
--
-- -   PLATFORM
--
-- -   REGION
--
-- -   TENANCY
getReservationCoverage_groupBy :: Lens.Lens' GetReservationCoverage (Prelude.Maybe [GroupDefinition])
getReservationCoverage_groupBy :: (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_groupBy = (GetReservationCoverage -> Maybe [GroupDefinition])
-> (GetReservationCoverage
    -> Maybe [GroupDefinition] -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe [GroupDefinition])
     (Maybe [GroupDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe [GroupDefinition]
groupBy :: Maybe [GroupDefinition]
$sel:groupBy:GetReservationCoverage' :: GetReservationCoverage -> Maybe [GroupDefinition]
groupBy} -> Maybe [GroupDefinition]
groupBy) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe [GroupDefinition]
a -> GetReservationCoverage
s {$sel:groupBy:GetReservationCoverage' :: Maybe [GroupDefinition]
groupBy = Maybe [GroupDefinition]
a} :: GetReservationCoverage) ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
 -> GetReservationCoverage -> f GetReservationCoverage)
-> ((Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
    -> Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> (Maybe [GroupDefinition] -> f (Maybe [GroupDefinition]))
-> GetReservationCoverage
-> f GetReservationCoverage
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.
getReservationCoverage_nextPageToken :: Lens.Lens' GetReservationCoverage (Prelude.Maybe Prelude.Text)
getReservationCoverage_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_nextPageToken = (GetReservationCoverage -> Maybe Text)
-> (GetReservationCoverage -> Maybe Text -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetReservationCoverage' :: GetReservationCoverage -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe Text
a -> GetReservationCoverage
s {$sel:nextPageToken:GetReservationCoverage' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetReservationCoverage)

-- | The measurement that you want your reservation coverage reported in.
--
-- Valid values are @Hour@, @Unit@, and @Cost@. You can use multiple values
-- in a request.
getReservationCoverage_metrics :: Lens.Lens' GetReservationCoverage (Prelude.Maybe [Prelude.Text])
getReservationCoverage_metrics :: (Maybe [Text] -> f (Maybe [Text]))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_metrics = (GetReservationCoverage -> Maybe [Text])
-> (GetReservationCoverage
    -> Maybe [Text] -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe [Text]
metrics :: Maybe [Text]
$sel:metrics:GetReservationCoverage' :: GetReservationCoverage -> Maybe [Text]
metrics} -> Maybe [Text]
metrics) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe [Text]
a -> GetReservationCoverage
s {$sel:metrics:GetReservationCoverage' :: Maybe [Text]
metrics = Maybe [Text]
a} :: GetReservationCoverage) ((Maybe [Text] -> f (Maybe [Text]))
 -> GetReservationCoverage -> f GetReservationCoverage)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetReservationCoverage
-> f GetReservationCoverage
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

-- | The granularity of the Amazon Web Services cost data for the
-- reservation. Valid values are @MONTHLY@ and @DAILY@.
--
-- If @GroupBy@ is set, @Granularity@ can\'t be set. If @Granularity@
-- isn\'t set, the response object doesn\'t include @Granularity@, either
-- @MONTHLY@ or @DAILY@.
--
-- The @GetReservationCoverage@ operation supports only @DAILY@ and
-- @MONTHLY@ granularities.
getReservationCoverage_granularity :: Lens.Lens' GetReservationCoverage (Prelude.Maybe Granularity)
getReservationCoverage_granularity :: (Maybe Granularity -> f (Maybe Granularity))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_granularity = (GetReservationCoverage -> Maybe Granularity)
-> (GetReservationCoverage
    -> Maybe Granularity -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe Granularity)
     (Maybe Granularity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe Granularity
granularity :: Maybe Granularity
$sel:granularity:GetReservationCoverage' :: GetReservationCoverage -> Maybe Granularity
granularity} -> Maybe Granularity
granularity) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe Granularity
a -> GetReservationCoverage
s {$sel:granularity:GetReservationCoverage' :: Maybe Granularity
granularity = Maybe Granularity
a} :: GetReservationCoverage)

-- | Filters utilization data by dimensions. You can filter by the following
-- dimensions:
--
-- -   AZ
--
-- -   CACHE_ENGINE
--
-- -   DATABASE_ENGINE
--
-- -   DEPLOYMENT_OPTION
--
-- -   INSTANCE_TYPE
--
-- -   LINKED_ACCOUNT
--
-- -   OPERATING_SYSTEM
--
-- -   PLATFORM
--
-- -   REGION
--
-- -   SERVICE
--
-- -   TAG
--
-- -   TENANCY
--
-- @GetReservationCoverage@ uses the same
-- <https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Expression.html Expression>
-- object as the other operations, but only @AND@ is supported among each
-- dimension. You can nest only one level deep. If there are multiple
-- values for a dimension, they are OR\'d together.
--
-- If you don\'t provide a @SERVICE@ filter, Cost Explorer defaults to EC2.
--
-- Cost category is also supported.
getReservationCoverage_filter :: Lens.Lens' GetReservationCoverage (Prelude.Maybe Expression)
getReservationCoverage_filter :: (Maybe Expression -> f (Maybe Expression))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_filter = (GetReservationCoverage -> Maybe Expression)
-> (GetReservationCoverage
    -> Maybe Expression -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe Expression)
     (Maybe Expression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe Expression
filter' :: Maybe Expression
$sel:filter':GetReservationCoverage' :: GetReservationCoverage -> Maybe Expression
filter'} -> Maybe Expression
filter') (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe Expression
a -> GetReservationCoverage
s {$sel:filter':GetReservationCoverage' :: Maybe Expression
filter' = Maybe Expression
a} :: GetReservationCoverage)

-- | The maximum number of objects that you returned for this request. If
-- more objects are available, in the response, Amazon Web Services
-- provides a NextPageToken value that you can use in a subsequent call to
-- get the next batch of objects.
getReservationCoverage_maxResults :: Lens.Lens' GetReservationCoverage (Prelude.Maybe Prelude.Natural)
getReservationCoverage_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_maxResults = (GetReservationCoverage -> Maybe Natural)
-> (GetReservationCoverage
    -> Maybe Natural -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetReservationCoverage' :: GetReservationCoverage -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe Natural
a -> GetReservationCoverage
s {$sel:maxResults:GetReservationCoverage' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetReservationCoverage)

-- | The value by which you want to sort the data.
--
-- The following values are supported for @Key@:
--
-- -   @OnDemandCost@
--
-- -   @CoverageHoursPercentage@
--
-- -   @OnDemandHours@
--
-- -   @ReservedHours@
--
-- -   @TotalRunningHours@
--
-- -   @CoverageNormalizedUnitsPercentage@
--
-- -   @OnDemandNormalizedUnits@
--
-- -   @ReservedNormalizedUnits@
--
-- -   @TotalRunningNormalizedUnits@
--
-- -   @Time@
--
-- Supported values for @SortOrder@ are @ASCENDING@ or @DESCENDING@.
getReservationCoverage_sortBy :: Lens.Lens' GetReservationCoverage (Prelude.Maybe SortDefinition)
getReservationCoverage_sortBy :: (Maybe SortDefinition -> f (Maybe SortDefinition))
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_sortBy = (GetReservationCoverage -> Maybe SortDefinition)
-> (GetReservationCoverage
    -> Maybe SortDefinition -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     (Maybe SortDefinition)
     (Maybe SortDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {Maybe SortDefinition
sortBy :: Maybe SortDefinition
$sel:sortBy:GetReservationCoverage' :: GetReservationCoverage -> Maybe SortDefinition
sortBy} -> Maybe SortDefinition
sortBy) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} Maybe SortDefinition
a -> GetReservationCoverage
s {$sel:sortBy:GetReservationCoverage' :: Maybe SortDefinition
sortBy = Maybe SortDefinition
a} :: GetReservationCoverage)

-- | The start and end dates of the period that you want to retrieve data
-- about reservation coverage for. You can retrieve data for a maximum of
-- 13 months: the last 12 months and the current month. 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@.
getReservationCoverage_timePeriod :: Lens.Lens' GetReservationCoverage DateInterval
getReservationCoverage_timePeriod :: (DateInterval -> f DateInterval)
-> GetReservationCoverage -> f GetReservationCoverage
getReservationCoverage_timePeriod = (GetReservationCoverage -> DateInterval)
-> (GetReservationCoverage
    -> DateInterval -> GetReservationCoverage)
-> Lens
     GetReservationCoverage
     GetReservationCoverage
     DateInterval
     DateInterval
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverage' {DateInterval
timePeriod :: DateInterval
$sel:timePeriod:GetReservationCoverage' :: GetReservationCoverage -> DateInterval
timePeriod} -> DateInterval
timePeriod) (\s :: GetReservationCoverage
s@GetReservationCoverage' {} DateInterval
a -> GetReservationCoverage
s {$sel:timePeriod:GetReservationCoverage' :: DateInterval
timePeriod = DateInterval
a} :: GetReservationCoverage)

instance Core.AWSRequest GetReservationCoverage where
  type
    AWSResponse GetReservationCoverage =
      GetReservationCoverageResponse
  request :: GetReservationCoverage -> Request GetReservationCoverage
request = Service -> GetReservationCoverage -> Request GetReservationCoverage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetReservationCoverage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReservationCoverage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetReservationCoverage))
-> Logger
-> Service
-> Proxy GetReservationCoverage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetReservationCoverage)))
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 Text
-> Maybe Coverage
-> Int
-> [CoverageByTime]
-> GetReservationCoverageResponse
GetReservationCoverageResponse'
            (Maybe Text
 -> Maybe Coverage
 -> Int
 -> [CoverageByTime]
 -> GetReservationCoverageResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Coverage
      -> Int -> [CoverageByTime] -> GetReservationCoverageResponse)
forall (f :: * -> *) a b. Functor 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 Coverage
   -> Int -> [CoverageByTime] -> GetReservationCoverageResponse)
-> Either String (Maybe Coverage)
-> Either
     String (Int -> [CoverageByTime] -> GetReservationCoverageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Coverage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Total")
            Either
  String (Int -> [CoverageByTime] -> GetReservationCoverageResponse)
-> Either String Int
-> Either
     String ([CoverageByTime] -> GetReservationCoverageResponse)
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))
            Either String ([CoverageByTime] -> GetReservationCoverageResponse)
-> Either String [CoverageByTime]
-> Either String GetReservationCoverageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [CoverageByTime])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CoveragesByTime"
                            Either String (Maybe [CoverageByTime])
-> [CoverageByTime] -> Either String [CoverageByTime]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [CoverageByTime]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable GetReservationCoverage

instance Prelude.NFData GetReservationCoverage

instance Core.ToHeaders GetReservationCoverage where
  toHeaders :: GetReservationCoverage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetReservationCoverage -> 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.GetReservationCoverage" ::
                          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 GetReservationCoverage where
  toJSON :: GetReservationCoverage -> Value
toJSON GetReservationCoverage' {Maybe Natural
Maybe [Text]
Maybe [GroupDefinition]
Maybe Text
Maybe Granularity
Maybe SortDefinition
Maybe Expression
DateInterval
timePeriod :: DateInterval
sortBy :: Maybe SortDefinition
maxResults :: Maybe Natural
filter' :: Maybe Expression
granularity :: Maybe Granularity
metrics :: Maybe [Text]
nextPageToken :: Maybe Text
groupBy :: Maybe [GroupDefinition]
$sel:timePeriod:GetReservationCoverage' :: GetReservationCoverage -> DateInterval
$sel:sortBy:GetReservationCoverage' :: GetReservationCoverage -> Maybe SortDefinition
$sel:maxResults:GetReservationCoverage' :: GetReservationCoverage -> Maybe Natural
$sel:filter':GetReservationCoverage' :: GetReservationCoverage -> Maybe Expression
$sel:granularity:GetReservationCoverage' :: GetReservationCoverage -> Maybe Granularity
$sel:metrics:GetReservationCoverage' :: GetReservationCoverage -> Maybe [Text]
$sel:nextPageToken:GetReservationCoverage' :: GetReservationCoverage -> Maybe Text
$sel:groupBy:GetReservationCoverage' :: GetReservationCoverage -> 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,
            (Text
"Granularity" Text -> Granularity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Granularity -> Pair) -> Maybe Granularity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Granularity
granularity,
            (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',
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"SortBy" Text -> SortDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortDefinition -> Pair) -> Maybe SortDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortDefinition
sortBy,
            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)
          ]
      )

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

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

-- | /See:/ 'newGetReservationCoverageResponse' smart constructor.
data GetReservationCoverageResponse = GetReservationCoverageResponse'
  { -- | 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.
    GetReservationCoverageResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The total amount of instance usage that a reservation covered.
    GetReservationCoverageResponse -> Maybe Coverage
total :: Prelude.Maybe Coverage,
    -- | The response's http status code.
    GetReservationCoverageResponse -> Int
httpStatus :: Prelude.Int,
    -- | The amount of time that your reservations covered.
    GetReservationCoverageResponse -> [CoverageByTime]
coveragesByTime :: [CoverageByTime]
  }
  deriving (GetReservationCoverageResponse
-> GetReservationCoverageResponse -> Bool
(GetReservationCoverageResponse
 -> GetReservationCoverageResponse -> Bool)
-> (GetReservationCoverageResponse
    -> GetReservationCoverageResponse -> Bool)
-> Eq GetReservationCoverageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetReservationCoverageResponse
-> GetReservationCoverageResponse -> Bool
$c/= :: GetReservationCoverageResponse
-> GetReservationCoverageResponse -> Bool
== :: GetReservationCoverageResponse
-> GetReservationCoverageResponse -> Bool
$c== :: GetReservationCoverageResponse
-> GetReservationCoverageResponse -> Bool
Prelude.Eq, ReadPrec [GetReservationCoverageResponse]
ReadPrec GetReservationCoverageResponse
Int -> ReadS GetReservationCoverageResponse
ReadS [GetReservationCoverageResponse]
(Int -> ReadS GetReservationCoverageResponse)
-> ReadS [GetReservationCoverageResponse]
-> ReadPrec GetReservationCoverageResponse
-> ReadPrec [GetReservationCoverageResponse]
-> Read GetReservationCoverageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetReservationCoverageResponse]
$creadListPrec :: ReadPrec [GetReservationCoverageResponse]
readPrec :: ReadPrec GetReservationCoverageResponse
$creadPrec :: ReadPrec GetReservationCoverageResponse
readList :: ReadS [GetReservationCoverageResponse]
$creadList :: ReadS [GetReservationCoverageResponse]
readsPrec :: Int -> ReadS GetReservationCoverageResponse
$creadsPrec :: Int -> ReadS GetReservationCoverageResponse
Prelude.Read, Int -> GetReservationCoverageResponse -> ShowS
[GetReservationCoverageResponse] -> ShowS
GetReservationCoverageResponse -> String
(Int -> GetReservationCoverageResponse -> ShowS)
-> (GetReservationCoverageResponse -> String)
-> ([GetReservationCoverageResponse] -> ShowS)
-> Show GetReservationCoverageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetReservationCoverageResponse] -> ShowS
$cshowList :: [GetReservationCoverageResponse] -> ShowS
show :: GetReservationCoverageResponse -> String
$cshow :: GetReservationCoverageResponse -> String
showsPrec :: Int -> GetReservationCoverageResponse -> ShowS
$cshowsPrec :: Int -> GetReservationCoverageResponse -> ShowS
Prelude.Show, (forall x.
 GetReservationCoverageResponse
 -> Rep GetReservationCoverageResponse x)
-> (forall x.
    Rep GetReservationCoverageResponse x
    -> GetReservationCoverageResponse)
-> Generic GetReservationCoverageResponse
forall x.
Rep GetReservationCoverageResponse x
-> GetReservationCoverageResponse
forall x.
GetReservationCoverageResponse
-> Rep GetReservationCoverageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetReservationCoverageResponse x
-> GetReservationCoverageResponse
$cfrom :: forall x.
GetReservationCoverageResponse
-> Rep GetReservationCoverageResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetReservationCoverageResponse' 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:
--
-- 'nextPageToken', 'getReservationCoverageResponse_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.
--
-- 'total', 'getReservationCoverageResponse_total' - The total amount of instance usage that a reservation covered.
--
-- 'httpStatus', 'getReservationCoverageResponse_httpStatus' - The response's http status code.
--
-- 'coveragesByTime', 'getReservationCoverageResponse_coveragesByTime' - The amount of time that your reservations covered.
newGetReservationCoverageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetReservationCoverageResponse
newGetReservationCoverageResponse :: Int -> GetReservationCoverageResponse
newGetReservationCoverageResponse Int
pHttpStatus_ =
  GetReservationCoverageResponse' :: Maybe Text
-> Maybe Coverage
-> Int
-> [CoverageByTime]
-> GetReservationCoverageResponse
GetReservationCoverageResponse'
    { $sel:nextPageToken:GetReservationCoverageResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:total:GetReservationCoverageResponse' :: Maybe Coverage
total = Maybe Coverage
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetReservationCoverageResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:coveragesByTime:GetReservationCoverageResponse' :: [CoverageByTime]
coveragesByTime = [CoverageByTime]
forall a. Monoid a => a
Prelude.mempty
    }

-- | 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.
getReservationCoverageResponse_nextPageToken :: Lens.Lens' GetReservationCoverageResponse (Prelude.Maybe Prelude.Text)
getReservationCoverageResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetReservationCoverageResponse
-> f GetReservationCoverageResponse
getReservationCoverageResponse_nextPageToken = (GetReservationCoverageResponse -> Maybe Text)
-> (GetReservationCoverageResponse
    -> Maybe Text -> GetReservationCoverageResponse)
-> Lens
     GetReservationCoverageResponse
     GetReservationCoverageResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverageResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetReservationCoverageResponse' :: GetReservationCoverageResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetReservationCoverageResponse
s@GetReservationCoverageResponse' {} Maybe Text
a -> GetReservationCoverageResponse
s {$sel:nextPageToken:GetReservationCoverageResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetReservationCoverageResponse)

-- | The total amount of instance usage that a reservation covered.
getReservationCoverageResponse_total :: Lens.Lens' GetReservationCoverageResponse (Prelude.Maybe Coverage)
getReservationCoverageResponse_total :: (Maybe Coverage -> f (Maybe Coverage))
-> GetReservationCoverageResponse
-> f GetReservationCoverageResponse
getReservationCoverageResponse_total = (GetReservationCoverageResponse -> Maybe Coverage)
-> (GetReservationCoverageResponse
    -> Maybe Coverage -> GetReservationCoverageResponse)
-> Lens
     GetReservationCoverageResponse
     GetReservationCoverageResponse
     (Maybe Coverage)
     (Maybe Coverage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverageResponse' {Maybe Coverage
total :: Maybe Coverage
$sel:total:GetReservationCoverageResponse' :: GetReservationCoverageResponse -> Maybe Coverage
total} -> Maybe Coverage
total) (\s :: GetReservationCoverageResponse
s@GetReservationCoverageResponse' {} Maybe Coverage
a -> GetReservationCoverageResponse
s {$sel:total:GetReservationCoverageResponse' :: Maybe Coverage
total = Maybe Coverage
a} :: GetReservationCoverageResponse)

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

-- | The amount of time that your reservations covered.
getReservationCoverageResponse_coveragesByTime :: Lens.Lens' GetReservationCoverageResponse [CoverageByTime]
getReservationCoverageResponse_coveragesByTime :: ([CoverageByTime] -> f [CoverageByTime])
-> GetReservationCoverageResponse
-> f GetReservationCoverageResponse
getReservationCoverageResponse_coveragesByTime = (GetReservationCoverageResponse -> [CoverageByTime])
-> (GetReservationCoverageResponse
    -> [CoverageByTime] -> GetReservationCoverageResponse)
-> Lens
     GetReservationCoverageResponse
     GetReservationCoverageResponse
     [CoverageByTime]
     [CoverageByTime]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetReservationCoverageResponse' {[CoverageByTime]
coveragesByTime :: [CoverageByTime]
$sel:coveragesByTime:GetReservationCoverageResponse' :: GetReservationCoverageResponse -> [CoverageByTime]
coveragesByTime} -> [CoverageByTime]
coveragesByTime) (\s :: GetReservationCoverageResponse
s@GetReservationCoverageResponse' {} [CoverageByTime]
a -> GetReservationCoverageResponse
s {$sel:coveragesByTime:GetReservationCoverageResponse' :: [CoverageByTime]
coveragesByTime = [CoverageByTime]
a} :: GetReservationCoverageResponse) (([CoverageByTime] -> f [CoverageByTime])
 -> GetReservationCoverageResponse
 -> f GetReservationCoverageResponse)
-> (([CoverageByTime] -> f [CoverageByTime])
    -> [CoverageByTime] -> f [CoverageByTime])
-> ([CoverageByTime] -> f [CoverageByTime])
-> GetReservationCoverageResponse
-> f GetReservationCoverageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CoverageByTime] -> f [CoverageByTime])
-> [CoverageByTime] -> f [CoverageByTime]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    GetReservationCoverageResponse