{-# 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.Pinpoint.GetApplicationDateRangeKpi
-- 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 (queries) pre-aggregated data for a standard metric that
-- applies to an application.
module Amazonka.Pinpoint.GetApplicationDateRangeKpi
  ( -- * Creating a Request
    GetApplicationDateRangeKpi (..),
    newGetApplicationDateRangeKpi,

    -- * Request Lenses
    getApplicationDateRangeKpi_startTime,
    getApplicationDateRangeKpi_nextToken,
    getApplicationDateRangeKpi_endTime,
    getApplicationDateRangeKpi_pageSize,
    getApplicationDateRangeKpi_applicationId,
    getApplicationDateRangeKpi_kpiName,

    -- * Destructuring the Response
    GetApplicationDateRangeKpiResponse (..),
    newGetApplicationDateRangeKpiResponse,

    -- * Response Lenses
    getApplicationDateRangeKpiResponse_httpStatus,
    getApplicationDateRangeKpiResponse_applicationDateRangeKpiResponse,
  )
where

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

-- | /See:/ 'newGetApplicationDateRangeKpi' smart constructor.
data GetApplicationDateRangeKpi = GetApplicationDateRangeKpi'
  { -- | The first date and time to retrieve data for, as part of an inclusive
    -- date range that filters the query results. This value should be in
    -- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
    -- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
    -- should also be fewer than 90 days from the current day.
    GetApplicationDateRangeKpi -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The string that specifies which page of results to return in a paginated
    -- response. This parameter is not supported for application, campaign, and
    -- journey metrics.
    GetApplicationDateRangeKpi -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The last date and time to retrieve data for, as part of an inclusive
    -- date range that filters the query results. This value should be in
    -- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
    -- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
    GetApplicationDateRangeKpi -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of items to include in each page of a paginated
    -- response. This parameter is not supported for application, campaign, and
    -- journey metrics.
    GetApplicationDateRangeKpi -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetApplicationDateRangeKpi -> Text
applicationId :: Prelude.Text,
    -- | The name of the metric, also referred to as a /key performance indicator
    -- (KPI)/, to retrieve data for. This value describes the associated metric
    -- and consists of two or more terms, which are comprised of lowercase
    -- alphanumeric characters, separated by a hyphen. Examples are
    -- email-open-rate and successful-delivery-rate. For a list of valid
    -- values, see the
    -- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
    GetApplicationDateRangeKpi -> Text
kpiName :: Prelude.Text
  }
  deriving (GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool
(GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool)
-> (GetApplicationDateRangeKpi
    -> GetApplicationDateRangeKpi -> Bool)
-> Eq GetApplicationDateRangeKpi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool
$c/= :: GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool
== :: GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool
$c== :: GetApplicationDateRangeKpi -> GetApplicationDateRangeKpi -> Bool
Prelude.Eq, ReadPrec [GetApplicationDateRangeKpi]
ReadPrec GetApplicationDateRangeKpi
Int -> ReadS GetApplicationDateRangeKpi
ReadS [GetApplicationDateRangeKpi]
(Int -> ReadS GetApplicationDateRangeKpi)
-> ReadS [GetApplicationDateRangeKpi]
-> ReadPrec GetApplicationDateRangeKpi
-> ReadPrec [GetApplicationDateRangeKpi]
-> Read GetApplicationDateRangeKpi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationDateRangeKpi]
$creadListPrec :: ReadPrec [GetApplicationDateRangeKpi]
readPrec :: ReadPrec GetApplicationDateRangeKpi
$creadPrec :: ReadPrec GetApplicationDateRangeKpi
readList :: ReadS [GetApplicationDateRangeKpi]
$creadList :: ReadS [GetApplicationDateRangeKpi]
readsPrec :: Int -> ReadS GetApplicationDateRangeKpi
$creadsPrec :: Int -> ReadS GetApplicationDateRangeKpi
Prelude.Read, Int -> GetApplicationDateRangeKpi -> ShowS
[GetApplicationDateRangeKpi] -> ShowS
GetApplicationDateRangeKpi -> String
(Int -> GetApplicationDateRangeKpi -> ShowS)
-> (GetApplicationDateRangeKpi -> String)
-> ([GetApplicationDateRangeKpi] -> ShowS)
-> Show GetApplicationDateRangeKpi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationDateRangeKpi] -> ShowS
$cshowList :: [GetApplicationDateRangeKpi] -> ShowS
show :: GetApplicationDateRangeKpi -> String
$cshow :: GetApplicationDateRangeKpi -> String
showsPrec :: Int -> GetApplicationDateRangeKpi -> ShowS
$cshowsPrec :: Int -> GetApplicationDateRangeKpi -> ShowS
Prelude.Show, (forall x.
 GetApplicationDateRangeKpi -> Rep GetApplicationDateRangeKpi x)
-> (forall x.
    Rep GetApplicationDateRangeKpi x -> GetApplicationDateRangeKpi)
-> Generic GetApplicationDateRangeKpi
forall x.
Rep GetApplicationDateRangeKpi x -> GetApplicationDateRangeKpi
forall x.
GetApplicationDateRangeKpi -> Rep GetApplicationDateRangeKpi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationDateRangeKpi x -> GetApplicationDateRangeKpi
$cfrom :: forall x.
GetApplicationDateRangeKpi -> Rep GetApplicationDateRangeKpi x
Prelude.Generic)

-- |
-- Create a value of 'GetApplicationDateRangeKpi' 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:
--
-- 'startTime', 'getApplicationDateRangeKpi_startTime' - The first date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
-- should also be fewer than 90 days from the current day.
--
-- 'nextToken', 'getApplicationDateRangeKpi_nextToken' - The string that specifies which page of results to return in a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
--
-- 'endTime', 'getApplicationDateRangeKpi_endTime' - The last date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
--
-- 'pageSize', 'getApplicationDateRangeKpi_pageSize' - The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
--
-- 'applicationId', 'getApplicationDateRangeKpi_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'kpiName', 'getApplicationDateRangeKpi_kpiName' - The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, to retrieve data for. This value describes the associated metric
-- and consists of two or more terms, which are comprised of lowercase
-- alphanumeric characters, separated by a hyphen. Examples are
-- email-open-rate and successful-delivery-rate. For a list of valid
-- values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
newGetApplicationDateRangeKpi ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'kpiName'
  Prelude.Text ->
  GetApplicationDateRangeKpi
newGetApplicationDateRangeKpi :: Text -> Text -> GetApplicationDateRangeKpi
newGetApplicationDateRangeKpi
  Text
pApplicationId_
  Text
pKpiName_ =
    GetApplicationDateRangeKpi' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Text
-> Text
-> GetApplicationDateRangeKpi
GetApplicationDateRangeKpi'
      { $sel:startTime:GetApplicationDateRangeKpi' :: Maybe POSIX
startTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetApplicationDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:endTime:GetApplicationDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:pageSize:GetApplicationDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:GetApplicationDateRangeKpi' :: Text
applicationId = Text
pApplicationId_,
        $sel:kpiName:GetApplicationDateRangeKpi' :: Text
kpiName = Text
pKpiName_
      }

-- | The first date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
-- should also be fewer than 90 days from the current day.
getApplicationDateRangeKpi_startTime :: Lens.Lens' GetApplicationDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getApplicationDateRangeKpi_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_startTime = (GetApplicationDateRangeKpi -> Maybe POSIX)
-> (GetApplicationDateRangeKpi
    -> Maybe POSIX -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi
     GetApplicationDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Maybe POSIX
a -> GetApplicationDateRangeKpi
s {$sel:startTime:GetApplicationDateRangeKpi' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetApplicationDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetApplicationDateRangeKpi
-> f GetApplicationDateRangeKpi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The string that specifies which page of results to return in a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
getApplicationDateRangeKpi_nextToken :: Lens.Lens' GetApplicationDateRangeKpi (Prelude.Maybe Prelude.Text)
getApplicationDateRangeKpi_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_nextToken = (GetApplicationDateRangeKpi -> Maybe Text)
-> (GetApplicationDateRangeKpi
    -> Maybe Text -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi
     GetApplicationDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Maybe Text
a -> GetApplicationDateRangeKpi
s {$sel:nextToken:GetApplicationDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
a} :: GetApplicationDateRangeKpi)

-- | The last date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
getApplicationDateRangeKpi_endTime :: Lens.Lens' GetApplicationDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getApplicationDateRangeKpi_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_endTime = (GetApplicationDateRangeKpi -> Maybe POSIX)
-> (GetApplicationDateRangeKpi
    -> Maybe POSIX -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi
     GetApplicationDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Maybe POSIX
a -> GetApplicationDateRangeKpi
s {$sel:endTime:GetApplicationDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetApplicationDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetApplicationDateRangeKpi
-> f GetApplicationDateRangeKpi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
getApplicationDateRangeKpi_pageSize :: Lens.Lens' GetApplicationDateRangeKpi (Prelude.Maybe Prelude.Text)
getApplicationDateRangeKpi_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_pageSize = (GetApplicationDateRangeKpi -> Maybe Text)
-> (GetApplicationDateRangeKpi
    -> Maybe Text -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi
     GetApplicationDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Maybe Text
a -> GetApplicationDateRangeKpi
s {$sel:pageSize:GetApplicationDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
a} :: GetApplicationDateRangeKpi)

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getApplicationDateRangeKpi_applicationId :: Lens.Lens' GetApplicationDateRangeKpi Prelude.Text
getApplicationDateRangeKpi_applicationId :: (Text -> f Text)
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_applicationId = (GetApplicationDateRangeKpi -> Text)
-> (GetApplicationDateRangeKpi
    -> Text -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi GetApplicationDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Text
applicationId :: Text
$sel:applicationId:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
applicationId} -> Text
applicationId) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Text
a -> GetApplicationDateRangeKpi
s {$sel:applicationId:GetApplicationDateRangeKpi' :: Text
applicationId = Text
a} :: GetApplicationDateRangeKpi)

-- | The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, to retrieve data for. This value describes the associated metric
-- and consists of two or more terms, which are comprised of lowercase
-- alphanumeric characters, separated by a hyphen. Examples are
-- email-open-rate and successful-delivery-rate. For a list of valid
-- values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
getApplicationDateRangeKpi_kpiName :: Lens.Lens' GetApplicationDateRangeKpi Prelude.Text
getApplicationDateRangeKpi_kpiName :: (Text -> f Text)
-> GetApplicationDateRangeKpi -> f GetApplicationDateRangeKpi
getApplicationDateRangeKpi_kpiName = (GetApplicationDateRangeKpi -> Text)
-> (GetApplicationDateRangeKpi
    -> Text -> GetApplicationDateRangeKpi)
-> Lens
     GetApplicationDateRangeKpi GetApplicationDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpi' {Text
kpiName :: Text
$sel:kpiName:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
kpiName} -> Text
kpiName) (\s :: GetApplicationDateRangeKpi
s@GetApplicationDateRangeKpi' {} Text
a -> GetApplicationDateRangeKpi
s {$sel:kpiName:GetApplicationDateRangeKpi' :: Text
kpiName = Text
a} :: GetApplicationDateRangeKpi)

instance Core.AWSRequest GetApplicationDateRangeKpi where
  type
    AWSResponse GetApplicationDateRangeKpi =
      GetApplicationDateRangeKpiResponse
  request :: GetApplicationDateRangeKpi -> Request GetApplicationDateRangeKpi
request = Service
-> GetApplicationDateRangeKpi -> Request GetApplicationDateRangeKpi
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetApplicationDateRangeKpi
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetApplicationDateRangeKpi)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetApplicationDateRangeKpi))
-> Logger
-> Service
-> Proxy GetApplicationDateRangeKpi
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetApplicationDateRangeKpi)))
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 ->
          Int
-> ApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse
GetApplicationDateRangeKpiResponse'
            (Int
 -> ApplicationDateRangeKpiResponse
 -> GetApplicationDateRangeKpiResponse)
-> Either String Int
-> Either
     String
     (ApplicationDateRangeKpiResponse
      -> GetApplicationDateRangeKpiResponse)
forall (f :: * -> *) a b. Functor 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
  (ApplicationDateRangeKpiResponse
   -> GetApplicationDateRangeKpiResponse)
-> Either String ApplicationDateRangeKpiResponse
-> Either String GetApplicationDateRangeKpiResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ApplicationDateRangeKpiResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetApplicationDateRangeKpi

instance Prelude.NFData GetApplicationDateRangeKpi

instance Core.ToHeaders GetApplicationDateRangeKpi where
  toHeaders :: GetApplicationDateRangeKpi -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetApplicationDateRangeKpi -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetApplicationDateRangeKpi where
  toPath :: GetApplicationDateRangeKpi -> ByteString
toPath GetApplicationDateRangeKpi' {Maybe Text
Maybe POSIX
Text
kpiName :: Text
applicationId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:kpiName:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
$sel:applicationId:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
$sel:pageSize:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
$sel:endTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
$sel:startTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/kpis/daterange/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
kpiName
      ]

instance Core.ToQuery GetApplicationDateRangeKpi where
  toQuery :: GetApplicationDateRangeKpi -> QueryString
toQuery GetApplicationDateRangeKpi' {Maybe Text
Maybe POSIX
Text
kpiName :: Text
applicationId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:kpiName:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
$sel:applicationId:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Text
$sel:pageSize:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
$sel:endTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe Text
$sel:startTime:GetApplicationDateRangeKpi' :: GetApplicationDateRangeKpi -> Maybe POSIX
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"start-time" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
startTime,
        ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"end-time" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
endTime,
        ByteString
"page-size" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageSize
      ]

-- | /See:/ 'newGetApplicationDateRangeKpiResponse' smart constructor.
data GetApplicationDateRangeKpiResponse = GetApplicationDateRangeKpiResponse'
  { -- | The response's http status code.
    GetApplicationDateRangeKpiResponse -> Int
httpStatus :: Prelude.Int,
    GetApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse :: ApplicationDateRangeKpiResponse
  }
  deriving (GetApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse -> Bool
(GetApplicationDateRangeKpiResponse
 -> GetApplicationDateRangeKpiResponse -> Bool)
-> (GetApplicationDateRangeKpiResponse
    -> GetApplicationDateRangeKpiResponse -> Bool)
-> Eq GetApplicationDateRangeKpiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse -> Bool
$c/= :: GetApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse -> Bool
== :: GetApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse -> Bool
$c== :: GetApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse -> Bool
Prelude.Eq, ReadPrec [GetApplicationDateRangeKpiResponse]
ReadPrec GetApplicationDateRangeKpiResponse
Int -> ReadS GetApplicationDateRangeKpiResponse
ReadS [GetApplicationDateRangeKpiResponse]
(Int -> ReadS GetApplicationDateRangeKpiResponse)
-> ReadS [GetApplicationDateRangeKpiResponse]
-> ReadPrec GetApplicationDateRangeKpiResponse
-> ReadPrec [GetApplicationDateRangeKpiResponse]
-> Read GetApplicationDateRangeKpiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationDateRangeKpiResponse]
$creadListPrec :: ReadPrec [GetApplicationDateRangeKpiResponse]
readPrec :: ReadPrec GetApplicationDateRangeKpiResponse
$creadPrec :: ReadPrec GetApplicationDateRangeKpiResponse
readList :: ReadS [GetApplicationDateRangeKpiResponse]
$creadList :: ReadS [GetApplicationDateRangeKpiResponse]
readsPrec :: Int -> ReadS GetApplicationDateRangeKpiResponse
$creadsPrec :: Int -> ReadS GetApplicationDateRangeKpiResponse
Prelude.Read, Int -> GetApplicationDateRangeKpiResponse -> ShowS
[GetApplicationDateRangeKpiResponse] -> ShowS
GetApplicationDateRangeKpiResponse -> String
(Int -> GetApplicationDateRangeKpiResponse -> ShowS)
-> (GetApplicationDateRangeKpiResponse -> String)
-> ([GetApplicationDateRangeKpiResponse] -> ShowS)
-> Show GetApplicationDateRangeKpiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationDateRangeKpiResponse] -> ShowS
$cshowList :: [GetApplicationDateRangeKpiResponse] -> ShowS
show :: GetApplicationDateRangeKpiResponse -> String
$cshow :: GetApplicationDateRangeKpiResponse -> String
showsPrec :: Int -> GetApplicationDateRangeKpiResponse -> ShowS
$cshowsPrec :: Int -> GetApplicationDateRangeKpiResponse -> ShowS
Prelude.Show, (forall x.
 GetApplicationDateRangeKpiResponse
 -> Rep GetApplicationDateRangeKpiResponse x)
-> (forall x.
    Rep GetApplicationDateRangeKpiResponse x
    -> GetApplicationDateRangeKpiResponse)
-> Generic GetApplicationDateRangeKpiResponse
forall x.
Rep GetApplicationDateRangeKpiResponse x
-> GetApplicationDateRangeKpiResponse
forall x.
GetApplicationDateRangeKpiResponse
-> Rep GetApplicationDateRangeKpiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationDateRangeKpiResponse x
-> GetApplicationDateRangeKpiResponse
$cfrom :: forall x.
GetApplicationDateRangeKpiResponse
-> Rep GetApplicationDateRangeKpiResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetApplicationDateRangeKpiResponse' 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:
--
-- 'httpStatus', 'getApplicationDateRangeKpiResponse_httpStatus' - The response's http status code.
--
-- 'applicationDateRangeKpiResponse', 'getApplicationDateRangeKpiResponse_applicationDateRangeKpiResponse' - Undocumented member.
newGetApplicationDateRangeKpiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'applicationDateRangeKpiResponse'
  ApplicationDateRangeKpiResponse ->
  GetApplicationDateRangeKpiResponse
newGetApplicationDateRangeKpiResponse :: Int
-> ApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse
newGetApplicationDateRangeKpiResponse
  Int
pHttpStatus_
  ApplicationDateRangeKpiResponse
pApplicationDateRangeKpiResponse_ =
    GetApplicationDateRangeKpiResponse' :: Int
-> ApplicationDateRangeKpiResponse
-> GetApplicationDateRangeKpiResponse
GetApplicationDateRangeKpiResponse'
      { $sel:httpStatus:GetApplicationDateRangeKpiResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:applicationDateRangeKpiResponse:GetApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse =
          ApplicationDateRangeKpiResponse
pApplicationDateRangeKpiResponse_
      }

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

-- | Undocumented member.
getApplicationDateRangeKpiResponse_applicationDateRangeKpiResponse :: Lens.Lens' GetApplicationDateRangeKpiResponse ApplicationDateRangeKpiResponse
getApplicationDateRangeKpiResponse_applicationDateRangeKpiResponse :: (ApplicationDateRangeKpiResponse
 -> f ApplicationDateRangeKpiResponse)
-> GetApplicationDateRangeKpiResponse
-> f GetApplicationDateRangeKpiResponse
getApplicationDateRangeKpiResponse_applicationDateRangeKpiResponse = (GetApplicationDateRangeKpiResponse
 -> ApplicationDateRangeKpiResponse)
-> (GetApplicationDateRangeKpiResponse
    -> ApplicationDateRangeKpiResponse
    -> GetApplicationDateRangeKpiResponse)
-> Lens
     GetApplicationDateRangeKpiResponse
     GetApplicationDateRangeKpiResponse
     ApplicationDateRangeKpiResponse
     ApplicationDateRangeKpiResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationDateRangeKpiResponse' {ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse :: ApplicationDateRangeKpiResponse
$sel:applicationDateRangeKpiResponse:GetApplicationDateRangeKpiResponse' :: GetApplicationDateRangeKpiResponse
-> ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse} -> ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse) (\s :: GetApplicationDateRangeKpiResponse
s@GetApplicationDateRangeKpiResponse' {} ApplicationDateRangeKpiResponse
a -> GetApplicationDateRangeKpiResponse
s {$sel:applicationDateRangeKpiResponse:GetApplicationDateRangeKpiResponse' :: ApplicationDateRangeKpiResponse
applicationDateRangeKpiResponse = ApplicationDateRangeKpiResponse
a} :: GetApplicationDateRangeKpiResponse)

instance
  Prelude.NFData
    GetApplicationDateRangeKpiResponse