{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:marker:ListRealtimeLogConfigs' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListRealtimeLogConfigs' :: Maybe Text
maxItems = 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 :: Lens' ListRealtimeLogConfigs (Maybe Text)
listRealtimeLogConfigs_marker = 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 :: Lens' ListRealtimeLogConfigs (Maybe Text)
listRealtimeLogConfigs_maxItems = 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 :: (Service -> Service)
-> ListRealtimeLogConfigs -> Request ListRealtimeLogConfigs
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListRealtimeLogConfigs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRealtimeLogConfigs)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe RealtimeLogConfigs -> Int -> ListRealtimeLogConfigsResponse
ListRealtimeLogConfigsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListRealtimeLogConfigs where
  hashWithSalt :: Int -> ListRealtimeLogConfigs -> Int
hashWithSalt Int
_salt ListRealtimeLogConfigs' {Maybe Text
maxItems :: Maybe Text
marker :: Maybe Text
$sel:maxItems:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
$sel:marker:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxItems

instance Prelude.NFData ListRealtimeLogConfigs where
  rnf :: ListRealtimeLogConfigs -> ()
rnf ListRealtimeLogConfigs' {Maybe Text
maxItems :: Maybe Text
marker :: Maybe Text
$sel:maxItems:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
$sel:marker:ListRealtimeLogConfigs' :: ListRealtimeLogConfigs -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxItems

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

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

instance Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Marker" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
marker,
        ByteString
"MaxItems" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: 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
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]
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
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.
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'
    { $sel:realtimeLogConfigs:ListRealtimeLogConfigsResponse' :: Maybe RealtimeLogConfigs
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 :: Lens' ListRealtimeLogConfigsResponse (Maybe RealtimeLogConfigs)
listRealtimeLogConfigsResponse_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 :: Lens' ListRealtimeLogConfigsResponse Int
listRealtimeLogConfigsResponse_httpStatus = 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
  where
  rnf :: ListRealtimeLogConfigsResponse -> ()
rnf ListRealtimeLogConfigsResponse' {Int
Maybe RealtimeLogConfigs
httpStatus :: Int
realtimeLogConfigs :: Maybe RealtimeLogConfigs
$sel:httpStatus:ListRealtimeLogConfigsResponse' :: ListRealtimeLogConfigsResponse -> Int
$sel:realtimeLogConfigs:ListRealtimeLogConfigsResponse' :: ListRealtimeLogConfigsResponse -> Maybe RealtimeLogConfigs
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RealtimeLogConfigs
realtimeLogConfigs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus