{-# 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.ApplicationInsights.ListConfigurationHistory
-- 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)
--
-- Lists the INFO, WARN, and ERROR events for periodic configuration
-- updates performed by Application Insights. Examples of events
-- represented are:
--
-- -   INFO: creating a new alarm or updating an alarm threshold.
--
-- -   WARN: alarm not created due to insufficient data points used to
--     predict thresholds.
--
-- -   ERROR: alarm not created due to permission errors or exceeding
--     quotas.
module Amazonka.ApplicationInsights.ListConfigurationHistory
  ( -- * Creating a Request
    ListConfigurationHistory (..),
    newListConfigurationHistory,

    -- * Request Lenses
    listConfigurationHistory_resourceGroupName,
    listConfigurationHistory_startTime,
    listConfigurationHistory_eventStatus,
    listConfigurationHistory_nextToken,
    listConfigurationHistory_endTime,
    listConfigurationHistory_maxResults,

    -- * Destructuring the Response
    ListConfigurationHistoryResponse (..),
    newListConfigurationHistoryResponse,

    -- * Response Lenses
    listConfigurationHistoryResponse_nextToken,
    listConfigurationHistoryResponse_eventList,
    listConfigurationHistoryResponse_httpStatus,
  )
where

import Amazonka.ApplicationInsights.Types
import qualified Amazonka.Core as Core
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:/ 'newListConfigurationHistory' smart constructor.
data ListConfigurationHistory = ListConfigurationHistory'
  { -- | Resource group to which the application belongs.
    ListConfigurationHistory -> Maybe Text
resourceGroupName :: Prelude.Maybe Prelude.Text,
    -- | The start time of the event.
    ListConfigurationHistory -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The status of the configuration update event. Possible values include
    -- INFO, WARN, and ERROR.
    ListConfigurationHistory -> Maybe ConfigurationEventStatus
eventStatus :: Prelude.Maybe ConfigurationEventStatus,
    -- | The @NextToken@ value returned from a previous paginated
    -- @ListConfigurationHistory@ request where @MaxResults@ was used and the
    -- results exceeded the value of that parameter. Pagination continues from
    -- the end of the previous results that returned the @NextToken@ value.
    -- This value is @null@ when there are no more results to return.
    ListConfigurationHistory -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The end time of the event.
    ListConfigurationHistory -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of results returned by @ListConfigurationHistory@ in
    -- paginated output. When this parameter is used,
    -- @ListConfigurationHistory@ returns only @MaxResults@ in a single page
    -- along with a @NextToken@ response element. The remaining results of the
    -- initial request can be seen by sending another
    -- @ListConfigurationHistory@ request with the returned @NextToken@ value.
    -- If this parameter is not used, then @ListConfigurationHistory@ returns
    -- all results.
    ListConfigurationHistory -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListConfigurationHistory -> ListConfigurationHistory -> Bool
(ListConfigurationHistory -> ListConfigurationHistory -> Bool)
-> (ListConfigurationHistory -> ListConfigurationHistory -> Bool)
-> Eq ListConfigurationHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConfigurationHistory -> ListConfigurationHistory -> Bool
$c/= :: ListConfigurationHistory -> ListConfigurationHistory -> Bool
== :: ListConfigurationHistory -> ListConfigurationHistory -> Bool
$c== :: ListConfigurationHistory -> ListConfigurationHistory -> Bool
Prelude.Eq, ReadPrec [ListConfigurationHistory]
ReadPrec ListConfigurationHistory
Int -> ReadS ListConfigurationHistory
ReadS [ListConfigurationHistory]
(Int -> ReadS ListConfigurationHistory)
-> ReadS [ListConfigurationHistory]
-> ReadPrec ListConfigurationHistory
-> ReadPrec [ListConfigurationHistory]
-> Read ListConfigurationHistory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConfigurationHistory]
$creadListPrec :: ReadPrec [ListConfigurationHistory]
readPrec :: ReadPrec ListConfigurationHistory
$creadPrec :: ReadPrec ListConfigurationHistory
readList :: ReadS [ListConfigurationHistory]
$creadList :: ReadS [ListConfigurationHistory]
readsPrec :: Int -> ReadS ListConfigurationHistory
$creadsPrec :: Int -> ReadS ListConfigurationHistory
Prelude.Read, Int -> ListConfigurationHistory -> ShowS
[ListConfigurationHistory] -> ShowS
ListConfigurationHistory -> String
(Int -> ListConfigurationHistory -> ShowS)
-> (ListConfigurationHistory -> String)
-> ([ListConfigurationHistory] -> ShowS)
-> Show ListConfigurationHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConfigurationHistory] -> ShowS
$cshowList :: [ListConfigurationHistory] -> ShowS
show :: ListConfigurationHistory -> String
$cshow :: ListConfigurationHistory -> String
showsPrec :: Int -> ListConfigurationHistory -> ShowS
$cshowsPrec :: Int -> ListConfigurationHistory -> ShowS
Prelude.Show, (forall x.
 ListConfigurationHistory -> Rep ListConfigurationHistory x)
-> (forall x.
    Rep ListConfigurationHistory x -> ListConfigurationHistory)
-> Generic ListConfigurationHistory
forall x.
Rep ListConfigurationHistory x -> ListConfigurationHistory
forall x.
ListConfigurationHistory -> Rep ListConfigurationHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListConfigurationHistory x -> ListConfigurationHistory
$cfrom :: forall x.
ListConfigurationHistory -> Rep ListConfigurationHistory x
Prelude.Generic)

-- |
-- Create a value of 'ListConfigurationHistory' 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:
--
-- 'resourceGroupName', 'listConfigurationHistory_resourceGroupName' - Resource group to which the application belongs.
--
-- 'startTime', 'listConfigurationHistory_startTime' - The start time of the event.
--
-- 'eventStatus', 'listConfigurationHistory_eventStatus' - The status of the configuration update event. Possible values include
-- INFO, WARN, and ERROR.
--
-- 'nextToken', 'listConfigurationHistory_nextToken' - The @NextToken@ value returned from a previous paginated
-- @ListConfigurationHistory@ request where @MaxResults@ was used and the
-- results exceeded the value of that parameter. Pagination continues from
-- the end of the previous results that returned the @NextToken@ value.
-- This value is @null@ when there are no more results to return.
--
-- 'endTime', 'listConfigurationHistory_endTime' - The end time of the event.
--
-- 'maxResults', 'listConfigurationHistory_maxResults' - The maximum number of results returned by @ListConfigurationHistory@ in
-- paginated output. When this parameter is used,
-- @ListConfigurationHistory@ returns only @MaxResults@ in a single page
-- along with a @NextToken@ response element. The remaining results of the
-- initial request can be seen by sending another
-- @ListConfigurationHistory@ request with the returned @NextToken@ value.
-- If this parameter is not used, then @ListConfigurationHistory@ returns
-- all results.
newListConfigurationHistory ::
  ListConfigurationHistory
newListConfigurationHistory :: ListConfigurationHistory
newListConfigurationHistory =
  ListConfigurationHistory' :: Maybe Text
-> Maybe POSIX
-> Maybe ConfigurationEventStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> ListConfigurationHistory
ListConfigurationHistory'
    { $sel:resourceGroupName:ListConfigurationHistory' :: Maybe Text
resourceGroupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ListConfigurationHistory' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:eventStatus:ListConfigurationHistory' :: Maybe ConfigurationEventStatus
eventStatus = Maybe ConfigurationEventStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListConfigurationHistory' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ListConfigurationHistory' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListConfigurationHistory' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Resource group to which the application belongs.
listConfigurationHistory_resourceGroupName :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe Prelude.Text)
listConfigurationHistory_resourceGroupName :: (Maybe Text -> f (Maybe Text))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_resourceGroupName = (ListConfigurationHistory -> Maybe Text)
-> (ListConfigurationHistory
    -> Maybe Text -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe Text
resourceGroupName :: Maybe Text
$sel:resourceGroupName:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Text
resourceGroupName} -> Maybe Text
resourceGroupName) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe Text
a -> ListConfigurationHistory
s {$sel:resourceGroupName:ListConfigurationHistory' :: Maybe Text
resourceGroupName = Maybe Text
a} :: ListConfigurationHistory)

-- | The start time of the event.
listConfigurationHistory_startTime :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe Prelude.UTCTime)
listConfigurationHistory_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_startTime = (ListConfigurationHistory -> Maybe POSIX)
-> (ListConfigurationHistory
    -> Maybe POSIX -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe POSIX
a -> ListConfigurationHistory
s {$sel:startTime:ListConfigurationHistory' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ListConfigurationHistory) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListConfigurationHistory -> f ListConfigurationHistory)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListConfigurationHistory
-> f ListConfigurationHistory
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 status of the configuration update event. Possible values include
-- INFO, WARN, and ERROR.
listConfigurationHistory_eventStatus :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe ConfigurationEventStatus)
listConfigurationHistory_eventStatus :: (Maybe ConfigurationEventStatus
 -> f (Maybe ConfigurationEventStatus))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_eventStatus = (ListConfigurationHistory -> Maybe ConfigurationEventStatus)
-> (ListConfigurationHistory
    -> Maybe ConfigurationEventStatus -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe ConfigurationEventStatus)
     (Maybe ConfigurationEventStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe ConfigurationEventStatus
eventStatus :: Maybe ConfigurationEventStatus
$sel:eventStatus:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe ConfigurationEventStatus
eventStatus} -> Maybe ConfigurationEventStatus
eventStatus) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe ConfigurationEventStatus
a -> ListConfigurationHistory
s {$sel:eventStatus:ListConfigurationHistory' :: Maybe ConfigurationEventStatus
eventStatus = Maybe ConfigurationEventStatus
a} :: ListConfigurationHistory)

-- | The @NextToken@ value returned from a previous paginated
-- @ListConfigurationHistory@ request where @MaxResults@ was used and the
-- results exceeded the value of that parameter. Pagination continues from
-- the end of the previous results that returned the @NextToken@ value.
-- This value is @null@ when there are no more results to return.
listConfigurationHistory_nextToken :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe Prelude.Text)
listConfigurationHistory_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_nextToken = (ListConfigurationHistory -> Maybe Text)
-> (ListConfigurationHistory
    -> Maybe Text -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe Text
a -> ListConfigurationHistory
s {$sel:nextToken:ListConfigurationHistory' :: Maybe Text
nextToken = Maybe Text
a} :: ListConfigurationHistory)

-- | The end time of the event.
listConfigurationHistory_endTime :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe Prelude.UTCTime)
listConfigurationHistory_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_endTime = (ListConfigurationHistory -> Maybe POSIX)
-> (ListConfigurationHistory
    -> Maybe POSIX -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe POSIX
a -> ListConfigurationHistory
s {$sel:endTime:ListConfigurationHistory' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ListConfigurationHistory) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListConfigurationHistory -> f ListConfigurationHistory)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListConfigurationHistory
-> f ListConfigurationHistory
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 results returned by @ListConfigurationHistory@ in
-- paginated output. When this parameter is used,
-- @ListConfigurationHistory@ returns only @MaxResults@ in a single page
-- along with a @NextToken@ response element. The remaining results of the
-- initial request can be seen by sending another
-- @ListConfigurationHistory@ request with the returned @NextToken@ value.
-- If this parameter is not used, then @ListConfigurationHistory@ returns
-- all results.
listConfigurationHistory_maxResults :: Lens.Lens' ListConfigurationHistory (Prelude.Maybe Prelude.Natural)
listConfigurationHistory_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListConfigurationHistory -> f ListConfigurationHistory
listConfigurationHistory_maxResults = (ListConfigurationHistory -> Maybe Natural)
-> (ListConfigurationHistory
    -> Maybe Natural -> ListConfigurationHistory)
-> Lens
     ListConfigurationHistory
     ListConfigurationHistory
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistory' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListConfigurationHistory
s@ListConfigurationHistory' {} Maybe Natural
a -> ListConfigurationHistory
s {$sel:maxResults:ListConfigurationHistory' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListConfigurationHistory)

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

instance Prelude.NFData ListConfigurationHistory

instance Core.ToHeaders ListConfigurationHistory where
  toHeaders :: ListConfigurationHistory -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListConfigurationHistory -> 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
"EC2WindowsBarleyService.ListConfigurationHistory" ::
                          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 ListConfigurationHistory where
  toJSON :: ListConfigurationHistory -> Value
toJSON ListConfigurationHistory' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe ConfigurationEventStatus
maxResults :: Maybe Natural
endTime :: Maybe POSIX
nextToken :: Maybe Text
eventStatus :: Maybe ConfigurationEventStatus
startTime :: Maybe POSIX
resourceGroupName :: Maybe Text
$sel:maxResults:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Natural
$sel:endTime:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe POSIX
$sel:nextToken:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Text
$sel:eventStatus:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe ConfigurationEventStatus
$sel:startTime:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe POSIX
$sel:resourceGroupName:ListConfigurationHistory' :: ListConfigurationHistory -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ResourceGroupName" 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
resourceGroupName,
            (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
            (Text
"EventStatus" Text -> ConfigurationEventStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConfigurationEventStatus -> Pair)
-> Maybe ConfigurationEventStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationEventStatus
eventStatus,
            (Text
"NextToken" 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
nextToken,
            (Text
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime,
            (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
          ]
      )

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

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

-- | /See:/ 'newListConfigurationHistoryResponse' smart constructor.
data ListConfigurationHistoryResponse = ListConfigurationHistoryResponse'
  { -- | The @NextToken@ value to include in a future @ListConfigurationHistory@
    -- request. When the results of a @ListConfigurationHistory@ request exceed
    -- @MaxResults@, this value can be used to retrieve the next page of
    -- results. This value is @null@ when there are no more results to return.
    ListConfigurationHistoryResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of configuration events and their corresponding details.
    ListConfigurationHistoryResponse -> Maybe [ConfigurationEvent]
eventList :: Prelude.Maybe [ConfigurationEvent],
    -- | The response's http status code.
    ListConfigurationHistoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListConfigurationHistoryResponse
-> ListConfigurationHistoryResponse -> Bool
(ListConfigurationHistoryResponse
 -> ListConfigurationHistoryResponse -> Bool)
-> (ListConfigurationHistoryResponse
    -> ListConfigurationHistoryResponse -> Bool)
-> Eq ListConfigurationHistoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConfigurationHistoryResponse
-> ListConfigurationHistoryResponse -> Bool
$c/= :: ListConfigurationHistoryResponse
-> ListConfigurationHistoryResponse -> Bool
== :: ListConfigurationHistoryResponse
-> ListConfigurationHistoryResponse -> Bool
$c== :: ListConfigurationHistoryResponse
-> ListConfigurationHistoryResponse -> Bool
Prelude.Eq, ReadPrec [ListConfigurationHistoryResponse]
ReadPrec ListConfigurationHistoryResponse
Int -> ReadS ListConfigurationHistoryResponse
ReadS [ListConfigurationHistoryResponse]
(Int -> ReadS ListConfigurationHistoryResponse)
-> ReadS [ListConfigurationHistoryResponse]
-> ReadPrec ListConfigurationHistoryResponse
-> ReadPrec [ListConfigurationHistoryResponse]
-> Read ListConfigurationHistoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConfigurationHistoryResponse]
$creadListPrec :: ReadPrec [ListConfigurationHistoryResponse]
readPrec :: ReadPrec ListConfigurationHistoryResponse
$creadPrec :: ReadPrec ListConfigurationHistoryResponse
readList :: ReadS [ListConfigurationHistoryResponse]
$creadList :: ReadS [ListConfigurationHistoryResponse]
readsPrec :: Int -> ReadS ListConfigurationHistoryResponse
$creadsPrec :: Int -> ReadS ListConfigurationHistoryResponse
Prelude.Read, Int -> ListConfigurationHistoryResponse -> ShowS
[ListConfigurationHistoryResponse] -> ShowS
ListConfigurationHistoryResponse -> String
(Int -> ListConfigurationHistoryResponse -> ShowS)
-> (ListConfigurationHistoryResponse -> String)
-> ([ListConfigurationHistoryResponse] -> ShowS)
-> Show ListConfigurationHistoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConfigurationHistoryResponse] -> ShowS
$cshowList :: [ListConfigurationHistoryResponse] -> ShowS
show :: ListConfigurationHistoryResponse -> String
$cshow :: ListConfigurationHistoryResponse -> String
showsPrec :: Int -> ListConfigurationHistoryResponse -> ShowS
$cshowsPrec :: Int -> ListConfigurationHistoryResponse -> ShowS
Prelude.Show, (forall x.
 ListConfigurationHistoryResponse
 -> Rep ListConfigurationHistoryResponse x)
-> (forall x.
    Rep ListConfigurationHistoryResponse x
    -> ListConfigurationHistoryResponse)
-> Generic ListConfigurationHistoryResponse
forall x.
Rep ListConfigurationHistoryResponse x
-> ListConfigurationHistoryResponse
forall x.
ListConfigurationHistoryResponse
-> Rep ListConfigurationHistoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListConfigurationHistoryResponse x
-> ListConfigurationHistoryResponse
$cfrom :: forall x.
ListConfigurationHistoryResponse
-> Rep ListConfigurationHistoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListConfigurationHistoryResponse' 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:
--
-- 'nextToken', 'listConfigurationHistoryResponse_nextToken' - The @NextToken@ value to include in a future @ListConfigurationHistory@
-- request. When the results of a @ListConfigurationHistory@ request exceed
-- @MaxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
--
-- 'eventList', 'listConfigurationHistoryResponse_eventList' - The list of configuration events and their corresponding details.
--
-- 'httpStatus', 'listConfigurationHistoryResponse_httpStatus' - The response's http status code.
newListConfigurationHistoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListConfigurationHistoryResponse
newListConfigurationHistoryResponse :: Int -> ListConfigurationHistoryResponse
newListConfigurationHistoryResponse Int
pHttpStatus_ =
  ListConfigurationHistoryResponse' :: Maybe Text
-> Maybe [ConfigurationEvent]
-> Int
-> ListConfigurationHistoryResponse
ListConfigurationHistoryResponse'
    { $sel:nextToken:ListConfigurationHistoryResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventList:ListConfigurationHistoryResponse' :: Maybe [ConfigurationEvent]
eventList = Maybe [ConfigurationEvent]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListConfigurationHistoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @NextToken@ value to include in a future @ListConfigurationHistory@
-- request. When the results of a @ListConfigurationHistory@ request exceed
-- @MaxResults@, this value can be used to retrieve the next page of
-- results. This value is @null@ when there are no more results to return.
listConfigurationHistoryResponse_nextToken :: Lens.Lens' ListConfigurationHistoryResponse (Prelude.Maybe Prelude.Text)
listConfigurationHistoryResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConfigurationHistoryResponse
-> f ListConfigurationHistoryResponse
listConfigurationHistoryResponse_nextToken = (ListConfigurationHistoryResponse -> Maybe Text)
-> (ListConfigurationHistoryResponse
    -> Maybe Text -> ListConfigurationHistoryResponse)
-> Lens
     ListConfigurationHistoryResponse
     ListConfigurationHistoryResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistoryResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConfigurationHistoryResponse' :: ListConfigurationHistoryResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConfigurationHistoryResponse
s@ListConfigurationHistoryResponse' {} Maybe Text
a -> ListConfigurationHistoryResponse
s {$sel:nextToken:ListConfigurationHistoryResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListConfigurationHistoryResponse)

-- | The list of configuration events and their corresponding details.
listConfigurationHistoryResponse_eventList :: Lens.Lens' ListConfigurationHistoryResponse (Prelude.Maybe [ConfigurationEvent])
listConfigurationHistoryResponse_eventList :: (Maybe [ConfigurationEvent] -> f (Maybe [ConfigurationEvent]))
-> ListConfigurationHistoryResponse
-> f ListConfigurationHistoryResponse
listConfigurationHistoryResponse_eventList = (ListConfigurationHistoryResponse -> Maybe [ConfigurationEvent])
-> (ListConfigurationHistoryResponse
    -> Maybe [ConfigurationEvent] -> ListConfigurationHistoryResponse)
-> Lens
     ListConfigurationHistoryResponse
     ListConfigurationHistoryResponse
     (Maybe [ConfigurationEvent])
     (Maybe [ConfigurationEvent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationHistoryResponse' {Maybe [ConfigurationEvent]
eventList :: Maybe [ConfigurationEvent]
$sel:eventList:ListConfigurationHistoryResponse' :: ListConfigurationHistoryResponse -> Maybe [ConfigurationEvent]
eventList} -> Maybe [ConfigurationEvent]
eventList) (\s :: ListConfigurationHistoryResponse
s@ListConfigurationHistoryResponse' {} Maybe [ConfigurationEvent]
a -> ListConfigurationHistoryResponse
s {$sel:eventList:ListConfigurationHistoryResponse' :: Maybe [ConfigurationEvent]
eventList = Maybe [ConfigurationEvent]
a} :: ListConfigurationHistoryResponse) ((Maybe [ConfigurationEvent] -> f (Maybe [ConfigurationEvent]))
 -> ListConfigurationHistoryResponse
 -> f ListConfigurationHistoryResponse)
-> ((Maybe [ConfigurationEvent] -> f (Maybe [ConfigurationEvent]))
    -> Maybe [ConfigurationEvent] -> f (Maybe [ConfigurationEvent]))
-> (Maybe [ConfigurationEvent] -> f (Maybe [ConfigurationEvent]))
-> ListConfigurationHistoryResponse
-> f ListConfigurationHistoryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConfigurationEvent]
  [ConfigurationEvent]
  [ConfigurationEvent]
  [ConfigurationEvent]
-> Iso
     (Maybe [ConfigurationEvent])
     (Maybe [ConfigurationEvent])
     (Maybe [ConfigurationEvent])
     (Maybe [ConfigurationEvent])
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
  [ConfigurationEvent]
  [ConfigurationEvent]
  [ConfigurationEvent]
  [ConfigurationEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListConfigurationHistoryResponse