{-# 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.CloudFront.ListRealtimeLogConfigs
-- 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)
--
-- Gets a list of real-time log configurations.
--
-- You can optionally specify the maximum number of items to receive in the
-- response. If the total number of items in the list exceeds the maximum
-- that you specify, or the default maximum, the response is paginated. To
-- get the next page of items, send a subsequent request that specifies the
-- @NextMarker@ value from the current response as the @Marker@ value in
-- the subsequent request.
module Amazonka.CloudFront.ListRealtimeLogConfigs
  ( -- * Creating a Request
    ListRealtimeLogConfigs (..),
    newListRealtimeLogConfigs,

    -- * Request Lenses
    listRealtimeLogConfigs_marker,
    listRealtimeLogConfigs_maxItems,

    -- * Destructuring the Response
    ListRealtimeLogConfigsResponse (..),
    newListRealtimeLogConfigsResponse,

    -- * Response Lenses
    listRealtimeLogConfigsResponse_realtimeLogConfigs,
    listRealtimeLogConfigsResponse_httpStatus,
  )
where

import Amazonka.CloudFront.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:/ 'newListRealtimeLogConfigs' smart constructor.
data ListRealtimeLogConfigs = ListRealtimeLogConfigs'
  { -- | Use this field when paginating results to indicate where to begin in
    -- your list of real-time log configurations. The response includes
    -- real-time log configurations in the list that occur after the marker. To
    -- get the next page of the list, set this field’s value to the value of
    -- @NextMarker@ from the current page’s response.
    ListRealtimeLogConfigs -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of real-time log configurations that you want in the
    -- response.
    ListRealtimeLogConfigs -> Maybe Text
maxItems :: Prelude.Maybe Prelude.Text
  }
  deriving (ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool
(ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool)
-> (ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool)
-> Eq ListRealtimeLogConfigs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool
$c/= :: ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool
== :: ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool
$c== :: ListRealtimeLogConfigs -> ListRealtimeLogConfigs -> Bool
Prelude.Eq, ReadPrec [ListRealtimeLogConfigs]
ReadPrec ListRealtimeLogConfigs
Int -> ReadS ListRealtimeLogConfigs
ReadS [ListRealtimeLogConfigs]
(Int -> ReadS ListRealtimeLogConfigs)
-> ReadS [ListRealtimeLogConfigs]
-> ReadPrec ListRealtimeLogConfigs
-> ReadPrec [ListRealtimeLogConfigs]
-> Read ListRealtimeLogConfigs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRealtimeLogConfigs]
$creadListPrec :: ReadPrec [ListRealtimeLogConfigs]
readPrec :: ReadPrec ListRealtimeLogConfigs
$creadPrec :: ReadPrec ListRealtimeLogConfigs
readList :: ReadS [ListRealtimeLogConfigs]
$creadList :: ReadS [ListRealtimeLogConfigs]
readsPrec :: Int -> ReadS ListRealtimeLogConfigs
$creadsPrec :: Int -> ReadS ListRealtimeLogConfigs
Prelude.Read, Int -> ListRealtimeLogConfigs -> ShowS
[ListRealtimeLogConfigs] -> ShowS
ListRealtimeLogConfigs -> String
(Int -> ListRealtimeLogConfigs -> ShowS)
-> (ListRealtimeLogConfigs -> String)
-> ([ListRealtimeLogConfigs] -> ShowS)
-> Show ListRealtimeLogConfigs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRealtimeLogConfigs] -> ShowS
$cshowList :: [ListRealtimeLogConfigs] -> ShowS
show :: ListRealtimeLogConfigs -> String
$cshow :: ListRealtimeLogConfigs -> String
showsPrec :: Int -> ListRealtimeLogConfigs -> ShowS
$cshowsPrec :: Int -> ListRealtimeLogConfigs -> ShowS
Prelude.Show, (forall x. ListRealtimeLogConfigs -> Rep ListRealtimeLogConfigs x)
-> (forall x.
    Rep ListRealtimeLogConfigs x -> ListRealtimeLogConfigs)
-> Generic ListRealtimeLogConfigs
forall x. Rep ListRealtimeLogConfigs x -> ListRealtimeLogConfigs
forall x. ListRealtimeLogConfigs -> Rep ListRealtimeLogConfigs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRealtimeLogConfigs x -> ListRealtimeLogConfigs
$cfrom :: forall x. ListRealtimeLogConfigs -> Rep ListRealtimeLogConfigs x
Prelude.Generic)

-- |
-- Create a value of 'ListRealtimeLogConfigs' 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:
--
-- 'marker', 'listRealtimeLogConfigs_marker' - Use this field when paginating results to indicate where to begin in
-- your list of real-time log configurations. The response includes
-- real-time log configurations in the list that occur after the marker. To
-- get the next page of the list, set this field’s value to the value of
-- @NextMarker@ from the current page’s response.
--
-- 'maxItems', 'listRealtimeLogConfigs_maxItems' - The maximum number of real-time log configurations that you want in the
-- response.
newListRealtimeLogConfigs ::
  ListRealtimeLogConfigs
newListRealtimeLogConfigs :: ListRealtimeLogConfigs
newListRealtimeLogConfigs =
  ListRealtimeLogConfigs' :: Maybe Text -> Maybe Text -> ListRealtimeLogConfigs
ListRealtimeLogConfigs'
    { $sel:marker:ListRealtimeLogConfigs' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListRealtimeLogConfigs' :: Maybe Text
maxItems = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Use this field when paginating results to indicate where to begin in
-- your list of real-time log configurations. The response includes
-- real-time log configurations in the list that occur after the marker. To
-- get the next page of the list, set this field’s value to the value of
-- @NextMarker@ from the current page’s response.
listRealtimeLogConfigs_marker :: Lens.Lens' ListRealtimeLogConfigs (Prelude.Maybe Prelude.Text)
listRealtimeLogConfigs_marker :: (Maybe Text -> f (Maybe Text))
-> ListRealtimeLogConfigs -> f ListRealtimeLogConfigs
listRealtimeLogConfigs_marker = (ListRealtimeLogConfigs -> Maybe Text)
-> (ListRealtimeLogConfigs -> Maybe Text -> ListRealtimeLogConfigs)
-> Lens
     ListRealtimeLogConfigs
     ListRealtimeLogConfigs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRealtimeLogConfigs' {Maybe Text
marker :: Maybe Text
$sel:marker:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListRealtimeLogConfigs
s@ListRealtimeLogConfigs' {} Maybe Text
a -> ListRealtimeLogConfigs
s {$sel:marker:ListRealtimeLogConfigs' :: Maybe Text
marker = Maybe Text
a} :: ListRealtimeLogConfigs)

-- | The maximum number of real-time log configurations that you want in the
-- response.
listRealtimeLogConfigs_maxItems :: Lens.Lens' ListRealtimeLogConfigs (Prelude.Maybe Prelude.Text)
listRealtimeLogConfigs_maxItems :: (Maybe Text -> f (Maybe Text))
-> ListRealtimeLogConfigs -> f ListRealtimeLogConfigs
listRealtimeLogConfigs_maxItems = (ListRealtimeLogConfigs -> Maybe Text)
-> (ListRealtimeLogConfigs -> Maybe Text -> ListRealtimeLogConfigs)
-> Lens
     ListRealtimeLogConfigs
     ListRealtimeLogConfigs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRealtimeLogConfigs' {Maybe Text
maxItems :: Maybe Text
$sel:maxItems:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
maxItems} -> Maybe Text
maxItems) (\s :: ListRealtimeLogConfigs
s@ListRealtimeLogConfigs' {} Maybe Text
a -> ListRealtimeLogConfigs
s {$sel:maxItems:ListRealtimeLogConfigs' :: Maybe Text
maxItems = Maybe Text
a} :: ListRealtimeLogConfigs)

instance Core.AWSRequest ListRealtimeLogConfigs where
  type
    AWSResponse ListRealtimeLogConfigs =
      ListRealtimeLogConfigsResponse
  request :: ListRealtimeLogConfigs -> Request ListRealtimeLogConfigs
request = Service -> ListRealtimeLogConfigs -> Request ListRealtimeLogConfigs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRealtimeLogConfigs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRealtimeLogConfigs)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse ListRealtimeLogConfigs))
-> Logger
-> Service
-> Proxy ListRealtimeLogConfigs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRealtimeLogConfigs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe RealtimeLogConfigs -> Int -> ListRealtimeLogConfigsResponse
ListRealtimeLogConfigsResponse'
            (Maybe RealtimeLogConfigs -> Int -> ListRealtimeLogConfigsResponse)
-> Either String (Maybe RealtimeLogConfigs)
-> Either String (Int -> ListRealtimeLogConfigsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe RealtimeLogConfigs)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
            Either String (Int -> ListRealtimeLogConfigsResponse)
-> Either String Int
-> Either String ListRealtimeLogConfigsResponse
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 ListRealtimeLogConfigs

instance Prelude.NFData ListRealtimeLogConfigs

instance Core.ToHeaders ListRealtimeLogConfigs where
  toHeaders :: ListRealtimeLogConfigs -> ResponseHeaders
toHeaders = ResponseHeaders -> ListRealtimeLogConfigs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListRealtimeLogConfigs where
  toPath :: ListRealtimeLogConfigs -> ByteString
toPath =
    ByteString -> ListRealtimeLogConfigs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2020-05-31/realtime-log-config"

instance Core.ToQuery ListRealtimeLogConfigs where
  toQuery :: ListRealtimeLogConfigs -> QueryString
toQuery ListRealtimeLogConfigs' {Maybe Text
maxItems :: Maybe Text
marker :: Maybe Text
$sel:maxItems:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
$sel:marker:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxItems" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxItems
      ]

-- | /See:/ 'newListRealtimeLogConfigsResponse' smart constructor.
data ListRealtimeLogConfigsResponse = ListRealtimeLogConfigsResponse'
  { -- | A list of real-time log configurations.
    ListRealtimeLogConfigsResponse -> Maybe RealtimeLogConfigs
realtimeLogConfigs :: Prelude.Maybe RealtimeLogConfigs,
    -- | The response's http status code.
    ListRealtimeLogConfigsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRealtimeLogConfigsResponse
-> ListRealtimeLogConfigsResponse -> Bool
(ListRealtimeLogConfigsResponse
 -> ListRealtimeLogConfigsResponse -> Bool)
-> (ListRealtimeLogConfigsResponse
    -> ListRealtimeLogConfigsResponse -> Bool)
-> Eq ListRealtimeLogConfigsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRealtimeLogConfigsResponse
-> ListRealtimeLogConfigsResponse -> Bool
$c/= :: ListRealtimeLogConfigsResponse
-> ListRealtimeLogConfigsResponse -> Bool
== :: ListRealtimeLogConfigsResponse
-> ListRealtimeLogConfigsResponse -> Bool
$c== :: ListRealtimeLogConfigsResponse
-> ListRealtimeLogConfigsResponse -> Bool
Prelude.Eq, ReadPrec [ListRealtimeLogConfigsResponse]
ReadPrec ListRealtimeLogConfigsResponse
Int -> ReadS ListRealtimeLogConfigsResponse
ReadS [ListRealtimeLogConfigsResponse]
(Int -> ReadS ListRealtimeLogConfigsResponse)
-> ReadS [ListRealtimeLogConfigsResponse]
-> ReadPrec ListRealtimeLogConfigsResponse
-> ReadPrec [ListRealtimeLogConfigsResponse]
-> Read ListRealtimeLogConfigsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRealtimeLogConfigsResponse]
$creadListPrec :: ReadPrec [ListRealtimeLogConfigsResponse]
readPrec :: ReadPrec ListRealtimeLogConfigsResponse
$creadPrec :: ReadPrec ListRealtimeLogConfigsResponse
readList :: ReadS [ListRealtimeLogConfigsResponse]
$creadList :: ReadS [ListRealtimeLogConfigsResponse]
readsPrec :: Int -> ReadS ListRealtimeLogConfigsResponse
$creadsPrec :: Int -> ReadS ListRealtimeLogConfigsResponse
Prelude.Read, Int -> ListRealtimeLogConfigsResponse -> ShowS
[ListRealtimeLogConfigsResponse] -> ShowS
ListRealtimeLogConfigsResponse -> String
(Int -> ListRealtimeLogConfigsResponse -> ShowS)
-> (ListRealtimeLogConfigsResponse -> String)
-> ([ListRealtimeLogConfigsResponse] -> ShowS)
-> Show ListRealtimeLogConfigsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRealtimeLogConfigsResponse] -> ShowS
$cshowList :: [ListRealtimeLogConfigsResponse] -> ShowS
show :: ListRealtimeLogConfigsResponse -> String
$cshow :: ListRealtimeLogConfigsResponse -> String
showsPrec :: Int -> ListRealtimeLogConfigsResponse -> ShowS
$cshowsPrec :: Int -> ListRealtimeLogConfigsResponse -> ShowS
Prelude.Show, (forall x.
 ListRealtimeLogConfigsResponse
 -> Rep ListRealtimeLogConfigsResponse x)
-> (forall x.
    Rep ListRealtimeLogConfigsResponse x
    -> ListRealtimeLogConfigsResponse)
-> Generic ListRealtimeLogConfigsResponse
forall x.
Rep ListRealtimeLogConfigsResponse x
-> ListRealtimeLogConfigsResponse
forall x.
ListRealtimeLogConfigsResponse
-> Rep ListRealtimeLogConfigsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRealtimeLogConfigsResponse x
-> ListRealtimeLogConfigsResponse
$cfrom :: forall x.
ListRealtimeLogConfigsResponse
-> Rep ListRealtimeLogConfigsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRealtimeLogConfigsResponse' 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:
--
-- 'realtimeLogConfigs', 'listRealtimeLogConfigsResponse_realtimeLogConfigs' - A list of real-time log configurations.
--
-- 'httpStatus', 'listRealtimeLogConfigsResponse_httpStatus' - The response's http status code.
newListRealtimeLogConfigsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRealtimeLogConfigsResponse
newListRealtimeLogConfigsResponse :: Int -> ListRealtimeLogConfigsResponse
newListRealtimeLogConfigsResponse Int
pHttpStatus_ =
  ListRealtimeLogConfigsResponse' :: Maybe RealtimeLogConfigs -> Int -> ListRealtimeLogConfigsResponse
ListRealtimeLogConfigsResponse'
    { $sel:realtimeLogConfigs:ListRealtimeLogConfigsResponse' :: Maybe RealtimeLogConfigs
realtimeLogConfigs =
        Maybe RealtimeLogConfigs
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRealtimeLogConfigsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of real-time log configurations.
listRealtimeLogConfigsResponse_realtimeLogConfigs :: Lens.Lens' ListRealtimeLogConfigsResponse (Prelude.Maybe RealtimeLogConfigs)
listRealtimeLogConfigsResponse_realtimeLogConfigs :: (Maybe RealtimeLogConfigs -> f (Maybe RealtimeLogConfigs))
-> ListRealtimeLogConfigsResponse
-> f ListRealtimeLogConfigsResponse
listRealtimeLogConfigsResponse_realtimeLogConfigs = (ListRealtimeLogConfigsResponse -> Maybe RealtimeLogConfigs)
-> (ListRealtimeLogConfigsResponse
    -> Maybe RealtimeLogConfigs -> ListRealtimeLogConfigsResponse)
-> Lens
     ListRealtimeLogConfigsResponse
     ListRealtimeLogConfigsResponse
     (Maybe RealtimeLogConfigs)
     (Maybe RealtimeLogConfigs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRealtimeLogConfigsResponse' {Maybe RealtimeLogConfigs
realtimeLogConfigs :: Maybe RealtimeLogConfigs
$sel:realtimeLogConfigs:ListRealtimeLogConfigsResponse' :: ListRealtimeLogConfigsResponse -> Maybe RealtimeLogConfigs
realtimeLogConfigs} -> Maybe RealtimeLogConfigs
realtimeLogConfigs) (\s :: ListRealtimeLogConfigsResponse
s@ListRealtimeLogConfigsResponse' {} Maybe RealtimeLogConfigs
a -> ListRealtimeLogConfigsResponse
s {$sel:realtimeLogConfigs:ListRealtimeLogConfigsResponse' :: Maybe RealtimeLogConfigs
realtimeLogConfigs = Maybe RealtimeLogConfigs
a} :: ListRealtimeLogConfigsResponse)

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

instance
  Prelude.NFData
    ListRealtimeLogConfigsResponse