{-# 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.ServiceCatalog.ListRecordHistory
-- 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 specified requests or all performed requests.
--
-- This operation returns paginated results.
module Amazonka.ServiceCatalog.ListRecordHistory
  ( -- * Creating a Request
    ListRecordHistory (..),
    newListRecordHistory,

    -- * Request Lenses
    listRecordHistory_searchFilter,
    listRecordHistory_acceptLanguage,
    listRecordHistory_accessLevelFilter,
    listRecordHistory_pageToken,
    listRecordHistory_pageSize,

    -- * Destructuring the Response
    ListRecordHistoryResponse (..),
    newListRecordHistoryResponse,

    -- * Response Lenses
    listRecordHistoryResponse_nextPageToken,
    listRecordHistoryResponse_recordDetails,
    listRecordHistoryResponse_httpStatus,
  )
where

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
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newListRecordHistory' smart constructor.
data ListRecordHistory = ListRecordHistory'
  { -- | The search filter to scope the results.
    ListRecordHistory -> Maybe ListRecordHistorySearchFilter
searchFilter :: Prelude.Maybe ListRecordHistorySearchFilter,
    -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    ListRecordHistory -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The access level to use to obtain results. The default is @User@.
    ListRecordHistory -> Maybe AccessLevelFilter
accessLevelFilter :: Prelude.Maybe AccessLevelFilter,
    -- | The page token for the next set of results. To retrieve the first set of
    -- results, use null.
    ListRecordHistory -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return with this call.
    ListRecordHistory -> Maybe Natural
pageSize :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListRecordHistory -> ListRecordHistory -> Bool
(ListRecordHistory -> ListRecordHistory -> Bool)
-> (ListRecordHistory -> ListRecordHistory -> Bool)
-> Eq ListRecordHistory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecordHistory -> ListRecordHistory -> Bool
$c/= :: ListRecordHistory -> ListRecordHistory -> Bool
== :: ListRecordHistory -> ListRecordHistory -> Bool
$c== :: ListRecordHistory -> ListRecordHistory -> Bool
Prelude.Eq, ReadPrec [ListRecordHistory]
ReadPrec ListRecordHistory
Int -> ReadS ListRecordHistory
ReadS [ListRecordHistory]
(Int -> ReadS ListRecordHistory)
-> ReadS [ListRecordHistory]
-> ReadPrec ListRecordHistory
-> ReadPrec [ListRecordHistory]
-> Read ListRecordHistory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecordHistory]
$creadListPrec :: ReadPrec [ListRecordHistory]
readPrec :: ReadPrec ListRecordHistory
$creadPrec :: ReadPrec ListRecordHistory
readList :: ReadS [ListRecordHistory]
$creadList :: ReadS [ListRecordHistory]
readsPrec :: Int -> ReadS ListRecordHistory
$creadsPrec :: Int -> ReadS ListRecordHistory
Prelude.Read, Int -> ListRecordHistory -> ShowS
[ListRecordHistory] -> ShowS
ListRecordHistory -> String
(Int -> ListRecordHistory -> ShowS)
-> (ListRecordHistory -> String)
-> ([ListRecordHistory] -> ShowS)
-> Show ListRecordHistory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecordHistory] -> ShowS
$cshowList :: [ListRecordHistory] -> ShowS
show :: ListRecordHistory -> String
$cshow :: ListRecordHistory -> String
showsPrec :: Int -> ListRecordHistory -> ShowS
$cshowsPrec :: Int -> ListRecordHistory -> ShowS
Prelude.Show, (forall x. ListRecordHistory -> Rep ListRecordHistory x)
-> (forall x. Rep ListRecordHistory x -> ListRecordHistory)
-> Generic ListRecordHistory
forall x. Rep ListRecordHistory x -> ListRecordHistory
forall x. ListRecordHistory -> Rep ListRecordHistory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRecordHistory x -> ListRecordHistory
$cfrom :: forall x. ListRecordHistory -> Rep ListRecordHistory x
Prelude.Generic)

-- |
-- Create a value of 'ListRecordHistory' 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:
--
-- 'searchFilter', 'listRecordHistory_searchFilter' - The search filter to scope the results.
--
-- 'acceptLanguage', 'listRecordHistory_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'accessLevelFilter', 'listRecordHistory_accessLevelFilter' - The access level to use to obtain results. The default is @User@.
--
-- 'pageToken', 'listRecordHistory_pageToken' - The page token for the next set of results. To retrieve the first set of
-- results, use null.
--
-- 'pageSize', 'listRecordHistory_pageSize' - The maximum number of items to return with this call.
newListRecordHistory ::
  ListRecordHistory
newListRecordHistory :: ListRecordHistory
newListRecordHistory =
  ListRecordHistory' :: Maybe ListRecordHistorySearchFilter
-> Maybe Text
-> Maybe AccessLevelFilter
-> Maybe Text
-> Maybe Natural
-> ListRecordHistory
ListRecordHistory'
    { $sel:searchFilter:ListRecordHistory' :: Maybe ListRecordHistorySearchFilter
searchFilter = Maybe ListRecordHistorySearchFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptLanguage:ListRecordHistory' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessLevelFilter:ListRecordHistory' :: Maybe AccessLevelFilter
accessLevelFilter = Maybe AccessLevelFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:ListRecordHistory' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:ListRecordHistory' :: Maybe Natural
pageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The search filter to scope the results.
listRecordHistory_searchFilter :: Lens.Lens' ListRecordHistory (Prelude.Maybe ListRecordHistorySearchFilter)
listRecordHistory_searchFilter :: (Maybe ListRecordHistorySearchFilter
 -> f (Maybe ListRecordHistorySearchFilter))
-> ListRecordHistory -> f ListRecordHistory
listRecordHistory_searchFilter = (ListRecordHistory -> Maybe ListRecordHistorySearchFilter)
-> (ListRecordHistory
    -> Maybe ListRecordHistorySearchFilter -> ListRecordHistory)
-> Lens
     ListRecordHistory
     ListRecordHistory
     (Maybe ListRecordHistorySearchFilter)
     (Maybe ListRecordHistorySearchFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistory' {Maybe ListRecordHistorySearchFilter
searchFilter :: Maybe ListRecordHistorySearchFilter
$sel:searchFilter:ListRecordHistory' :: ListRecordHistory -> Maybe ListRecordHistorySearchFilter
searchFilter} -> Maybe ListRecordHistorySearchFilter
searchFilter) (\s :: ListRecordHistory
s@ListRecordHistory' {} Maybe ListRecordHistorySearchFilter
a -> ListRecordHistory
s {$sel:searchFilter:ListRecordHistory' :: Maybe ListRecordHistorySearchFilter
searchFilter = Maybe ListRecordHistorySearchFilter
a} :: ListRecordHistory)

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
listRecordHistory_acceptLanguage :: Lens.Lens' ListRecordHistory (Prelude.Maybe Prelude.Text)
listRecordHistory_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> ListRecordHistory -> f ListRecordHistory
listRecordHistory_acceptLanguage = (ListRecordHistory -> Maybe Text)
-> (ListRecordHistory -> Maybe Text -> ListRecordHistory)
-> Lens
     ListRecordHistory ListRecordHistory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistory' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:ListRecordHistory' :: ListRecordHistory -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: ListRecordHistory
s@ListRecordHistory' {} Maybe Text
a -> ListRecordHistory
s {$sel:acceptLanguage:ListRecordHistory' :: Maybe Text
acceptLanguage = Maybe Text
a} :: ListRecordHistory)

-- | The access level to use to obtain results. The default is @User@.
listRecordHistory_accessLevelFilter :: Lens.Lens' ListRecordHistory (Prelude.Maybe AccessLevelFilter)
listRecordHistory_accessLevelFilter :: (Maybe AccessLevelFilter -> f (Maybe AccessLevelFilter))
-> ListRecordHistory -> f ListRecordHistory
listRecordHistory_accessLevelFilter = (ListRecordHistory -> Maybe AccessLevelFilter)
-> (ListRecordHistory
    -> Maybe AccessLevelFilter -> ListRecordHistory)
-> Lens
     ListRecordHistory
     ListRecordHistory
     (Maybe AccessLevelFilter)
     (Maybe AccessLevelFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistory' {Maybe AccessLevelFilter
accessLevelFilter :: Maybe AccessLevelFilter
$sel:accessLevelFilter:ListRecordHistory' :: ListRecordHistory -> Maybe AccessLevelFilter
accessLevelFilter} -> Maybe AccessLevelFilter
accessLevelFilter) (\s :: ListRecordHistory
s@ListRecordHistory' {} Maybe AccessLevelFilter
a -> ListRecordHistory
s {$sel:accessLevelFilter:ListRecordHistory' :: Maybe AccessLevelFilter
accessLevelFilter = Maybe AccessLevelFilter
a} :: ListRecordHistory)

-- | The page token for the next set of results. To retrieve the first set of
-- results, use null.
listRecordHistory_pageToken :: Lens.Lens' ListRecordHistory (Prelude.Maybe Prelude.Text)
listRecordHistory_pageToken :: (Maybe Text -> f (Maybe Text))
-> ListRecordHistory -> f ListRecordHistory
listRecordHistory_pageToken = (ListRecordHistory -> Maybe Text)
-> (ListRecordHistory -> Maybe Text -> ListRecordHistory)
-> Lens
     ListRecordHistory ListRecordHistory (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistory' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:ListRecordHistory' :: ListRecordHistory -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: ListRecordHistory
s@ListRecordHistory' {} Maybe Text
a -> ListRecordHistory
s {$sel:pageToken:ListRecordHistory' :: Maybe Text
pageToken = Maybe Text
a} :: ListRecordHistory)

-- | The maximum number of items to return with this call.
listRecordHistory_pageSize :: Lens.Lens' ListRecordHistory (Prelude.Maybe Prelude.Natural)
listRecordHistory_pageSize :: (Maybe Natural -> f (Maybe Natural))
-> ListRecordHistory -> f ListRecordHistory
listRecordHistory_pageSize = (ListRecordHistory -> Maybe Natural)
-> (ListRecordHistory -> Maybe Natural -> ListRecordHistory)
-> Lens
     ListRecordHistory ListRecordHistory (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistory' {Maybe Natural
pageSize :: Maybe Natural
$sel:pageSize:ListRecordHistory' :: ListRecordHistory -> Maybe Natural
pageSize} -> Maybe Natural
pageSize) (\s :: ListRecordHistory
s@ListRecordHistory' {} Maybe Natural
a -> ListRecordHistory
s {$sel:pageSize:ListRecordHistory' :: Maybe Natural
pageSize = Maybe Natural
a} :: ListRecordHistory)

instance Core.AWSPager ListRecordHistory where
  page :: ListRecordHistory
-> AWSResponse ListRecordHistory -> Maybe ListRecordHistory
page ListRecordHistory
rq AWSResponse ListRecordHistory
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecordHistory
ListRecordHistoryResponse
rs
            ListRecordHistoryResponse
-> Getting (First Text) ListRecordHistoryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecordHistoryResponse
-> Const (First Text) ListRecordHistoryResponse
Lens' ListRecordHistoryResponse (Maybe Text)
listRecordHistoryResponse_nextPageToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecordHistoryResponse
 -> Const (First Text) ListRecordHistoryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecordHistoryResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecordHistory
forall a. Maybe a
Prelude.Nothing
    | Maybe [RecordDetail] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecordHistory
ListRecordHistoryResponse
rs
            ListRecordHistoryResponse
-> Getting
     (First [RecordDetail]) ListRecordHistoryResponse [RecordDetail]
-> Maybe [RecordDetail]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RecordDetail]
 -> Const (First [RecordDetail]) (Maybe [RecordDetail]))
-> ListRecordHistoryResponse
-> Const (First [RecordDetail]) ListRecordHistoryResponse
Lens' ListRecordHistoryResponse (Maybe [RecordDetail])
listRecordHistoryResponse_recordDetails
              ((Maybe [RecordDetail]
  -> Const (First [RecordDetail]) (Maybe [RecordDetail]))
 -> ListRecordHistoryResponse
 -> Const (First [RecordDetail]) ListRecordHistoryResponse)
-> (([RecordDetail] -> Const (First [RecordDetail]) [RecordDetail])
    -> Maybe [RecordDetail]
    -> Const (First [RecordDetail]) (Maybe [RecordDetail]))
-> Getting
     (First [RecordDetail]) ListRecordHistoryResponse [RecordDetail]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RecordDetail] -> Const (First [RecordDetail]) [RecordDetail])
-> Maybe [RecordDetail]
-> Const (First [RecordDetail]) (Maybe [RecordDetail])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecordHistory
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRecordHistory -> Maybe ListRecordHistory
forall a. a -> Maybe a
Prelude.Just (ListRecordHistory -> Maybe ListRecordHistory)
-> ListRecordHistory -> Maybe ListRecordHistory
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRecordHistory
rq
          ListRecordHistory
-> (ListRecordHistory -> ListRecordHistory) -> ListRecordHistory
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRecordHistory -> Identity ListRecordHistory
Lens ListRecordHistory ListRecordHistory (Maybe Text) (Maybe Text)
listRecordHistory_pageToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRecordHistory -> Identity ListRecordHistory)
-> Maybe Text -> ListRecordHistory -> ListRecordHistory
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRecordHistory
ListRecordHistoryResponse
rs
          ListRecordHistoryResponse
-> Getting (First Text) ListRecordHistoryResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecordHistoryResponse
-> Const (First Text) ListRecordHistoryResponse
Lens' ListRecordHistoryResponse (Maybe Text)
listRecordHistoryResponse_nextPageToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecordHistoryResponse
 -> Const (First Text) ListRecordHistoryResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecordHistoryResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

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

instance Prelude.NFData ListRecordHistory

instance Core.ToHeaders ListRecordHistory where
  toHeaders :: ListRecordHistory -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRecordHistory -> 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
"AWS242ServiceCatalogService.ListRecordHistory" ::
                          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 ListRecordHistory where
  toJSON :: ListRecordHistory -> Value
toJSON ListRecordHistory' {Maybe Natural
Maybe Text
Maybe AccessLevelFilter
Maybe ListRecordHistorySearchFilter
pageSize :: Maybe Natural
pageToken :: Maybe Text
accessLevelFilter :: Maybe AccessLevelFilter
acceptLanguage :: Maybe Text
searchFilter :: Maybe ListRecordHistorySearchFilter
$sel:pageSize:ListRecordHistory' :: ListRecordHistory -> Maybe Natural
$sel:pageToken:ListRecordHistory' :: ListRecordHistory -> Maybe Text
$sel:accessLevelFilter:ListRecordHistory' :: ListRecordHistory -> Maybe AccessLevelFilter
$sel:acceptLanguage:ListRecordHistory' :: ListRecordHistory -> Maybe Text
$sel:searchFilter:ListRecordHistory' :: ListRecordHistory -> Maybe ListRecordHistorySearchFilter
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SearchFilter" Text -> ListRecordHistorySearchFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ListRecordHistorySearchFilter -> Pair)
-> Maybe ListRecordHistorySearchFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ListRecordHistorySearchFilter
searchFilter,
            (Text
"AcceptLanguage" 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
acceptLanguage,
            (Text
"AccessLevelFilter" Text -> AccessLevelFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AccessLevelFilter -> Pair)
-> Maybe AccessLevelFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AccessLevelFilter
accessLevelFilter,
            (Text
"PageToken" 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
pageToken,
            (Text
"PageSize" 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
pageSize
          ]
      )

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

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

-- | /See:/ 'newListRecordHistoryResponse' smart constructor.
data ListRecordHistoryResponse = ListRecordHistoryResponse'
  { -- | The page token to use to retrieve the next set of results. If there are
    -- no additional results, this value is null.
    ListRecordHistoryResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The records, in reverse chronological order.
    ListRecordHistoryResponse -> Maybe [RecordDetail]
recordDetails :: Prelude.Maybe [RecordDetail],
    -- | The response's http status code.
    ListRecordHistoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool
(ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool)
-> (ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool)
-> Eq ListRecordHistoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool
$c/= :: ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool
== :: ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool
$c== :: ListRecordHistoryResponse -> ListRecordHistoryResponse -> Bool
Prelude.Eq, ReadPrec [ListRecordHistoryResponse]
ReadPrec ListRecordHistoryResponse
Int -> ReadS ListRecordHistoryResponse
ReadS [ListRecordHistoryResponse]
(Int -> ReadS ListRecordHistoryResponse)
-> ReadS [ListRecordHistoryResponse]
-> ReadPrec ListRecordHistoryResponse
-> ReadPrec [ListRecordHistoryResponse]
-> Read ListRecordHistoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecordHistoryResponse]
$creadListPrec :: ReadPrec [ListRecordHistoryResponse]
readPrec :: ReadPrec ListRecordHistoryResponse
$creadPrec :: ReadPrec ListRecordHistoryResponse
readList :: ReadS [ListRecordHistoryResponse]
$creadList :: ReadS [ListRecordHistoryResponse]
readsPrec :: Int -> ReadS ListRecordHistoryResponse
$creadsPrec :: Int -> ReadS ListRecordHistoryResponse
Prelude.Read, Int -> ListRecordHistoryResponse -> ShowS
[ListRecordHistoryResponse] -> ShowS
ListRecordHistoryResponse -> String
(Int -> ListRecordHistoryResponse -> ShowS)
-> (ListRecordHistoryResponse -> String)
-> ([ListRecordHistoryResponse] -> ShowS)
-> Show ListRecordHistoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecordHistoryResponse] -> ShowS
$cshowList :: [ListRecordHistoryResponse] -> ShowS
show :: ListRecordHistoryResponse -> String
$cshow :: ListRecordHistoryResponse -> String
showsPrec :: Int -> ListRecordHistoryResponse -> ShowS
$cshowsPrec :: Int -> ListRecordHistoryResponse -> ShowS
Prelude.Show, (forall x.
 ListRecordHistoryResponse -> Rep ListRecordHistoryResponse x)
-> (forall x.
    Rep ListRecordHistoryResponse x -> ListRecordHistoryResponse)
-> Generic ListRecordHistoryResponse
forall x.
Rep ListRecordHistoryResponse x -> ListRecordHistoryResponse
forall x.
ListRecordHistoryResponse -> Rep ListRecordHistoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRecordHistoryResponse x -> ListRecordHistoryResponse
$cfrom :: forall x.
ListRecordHistoryResponse -> Rep ListRecordHistoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRecordHistoryResponse' 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', 'listRecordHistoryResponse_nextPageToken' - The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
--
-- 'recordDetails', 'listRecordHistoryResponse_recordDetails' - The records, in reverse chronological order.
--
-- 'httpStatus', 'listRecordHistoryResponse_httpStatus' - The response's http status code.
newListRecordHistoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRecordHistoryResponse
newListRecordHistoryResponse :: Int -> ListRecordHistoryResponse
newListRecordHistoryResponse Int
pHttpStatus_ =
  ListRecordHistoryResponse' :: Maybe Text
-> Maybe [RecordDetail] -> Int -> ListRecordHistoryResponse
ListRecordHistoryResponse'
    { $sel:nextPageToken:ListRecordHistoryResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recordDetails:ListRecordHistoryResponse' :: Maybe [RecordDetail]
recordDetails = Maybe [RecordDetail]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRecordHistoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The page token to use to retrieve the next set of results. If there are
-- no additional results, this value is null.
listRecordHistoryResponse_nextPageToken :: Lens.Lens' ListRecordHistoryResponse (Prelude.Maybe Prelude.Text)
listRecordHistoryResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListRecordHistoryResponse -> f ListRecordHistoryResponse
listRecordHistoryResponse_nextPageToken = (ListRecordHistoryResponse -> Maybe Text)
-> (ListRecordHistoryResponse
    -> Maybe Text -> ListRecordHistoryResponse)
-> Lens' ListRecordHistoryResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistoryResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListRecordHistoryResponse' :: ListRecordHistoryResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListRecordHistoryResponse
s@ListRecordHistoryResponse' {} Maybe Text
a -> ListRecordHistoryResponse
s {$sel:nextPageToken:ListRecordHistoryResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListRecordHistoryResponse)

-- | The records, in reverse chronological order.
listRecordHistoryResponse_recordDetails :: Lens.Lens' ListRecordHistoryResponse (Prelude.Maybe [RecordDetail])
listRecordHistoryResponse_recordDetails :: (Maybe [RecordDetail] -> f (Maybe [RecordDetail]))
-> ListRecordHistoryResponse -> f ListRecordHistoryResponse
listRecordHistoryResponse_recordDetails = (ListRecordHistoryResponse -> Maybe [RecordDetail])
-> (ListRecordHistoryResponse
    -> Maybe [RecordDetail] -> ListRecordHistoryResponse)
-> Lens' ListRecordHistoryResponse (Maybe [RecordDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecordHistoryResponse' {Maybe [RecordDetail]
recordDetails :: Maybe [RecordDetail]
$sel:recordDetails:ListRecordHistoryResponse' :: ListRecordHistoryResponse -> Maybe [RecordDetail]
recordDetails} -> Maybe [RecordDetail]
recordDetails) (\s :: ListRecordHistoryResponse
s@ListRecordHistoryResponse' {} Maybe [RecordDetail]
a -> ListRecordHistoryResponse
s {$sel:recordDetails:ListRecordHistoryResponse' :: Maybe [RecordDetail]
recordDetails = Maybe [RecordDetail]
a} :: ListRecordHistoryResponse) ((Maybe [RecordDetail] -> f (Maybe [RecordDetail]))
 -> ListRecordHistoryResponse -> f ListRecordHistoryResponse)
-> ((Maybe [RecordDetail] -> f (Maybe [RecordDetail]))
    -> Maybe [RecordDetail] -> f (Maybe [RecordDetail]))
-> (Maybe [RecordDetail] -> f (Maybe [RecordDetail]))
-> ListRecordHistoryResponse
-> f ListRecordHistoryResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RecordDetail] [RecordDetail] [RecordDetail] [RecordDetail]
-> Iso
     (Maybe [RecordDetail])
     (Maybe [RecordDetail])
     (Maybe [RecordDetail])
     (Maybe [RecordDetail])
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 [RecordDetail] [RecordDetail] [RecordDetail] [RecordDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListRecordHistoryResponse