{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.RealtimeLogConfigs
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFront.Types.RealtimeLogConfigs where

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

-- | A list of real-time log configurations.
--
-- /See:/ 'newRealtimeLogConfigs' smart constructor.
data RealtimeLogConfigs = RealtimeLogConfigs'
  { -- | Contains the list of real-time log configurations.
    RealtimeLogConfigs -> Maybe [RealtimeLogConfig]
items :: Prelude.Maybe [RealtimeLogConfig],
    -- | If there are more items in the list than are in this response, this
    -- element is present. It contains the value that you should use in the
    -- @Marker@ field of a subsequent request to continue listing real-time log
    -- configurations where you left off.
    RealtimeLogConfigs -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of real-time log configurations requested.
    RealtimeLogConfigs -> Int
maxItems :: Prelude.Int,
    -- | A flag that indicates whether there are more real-time log
    -- configurations than are contained in this list.
    RealtimeLogConfigs -> Bool
isTruncated :: Prelude.Bool,
    -- | This parameter indicates where this list of real-time log configurations
    -- begins. This list includes real-time log configurations that occur after
    -- the marker.
    RealtimeLogConfigs -> Text
marker :: Prelude.Text
  }
  deriving (RealtimeLogConfigs -> RealtimeLogConfigs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RealtimeLogConfigs -> RealtimeLogConfigs -> Bool
$c/= :: RealtimeLogConfigs -> RealtimeLogConfigs -> Bool
== :: RealtimeLogConfigs -> RealtimeLogConfigs -> Bool
$c== :: RealtimeLogConfigs -> RealtimeLogConfigs -> Bool
Prelude.Eq, ReadPrec [RealtimeLogConfigs]
ReadPrec RealtimeLogConfigs
Int -> ReadS RealtimeLogConfigs
ReadS [RealtimeLogConfigs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RealtimeLogConfigs]
$creadListPrec :: ReadPrec [RealtimeLogConfigs]
readPrec :: ReadPrec RealtimeLogConfigs
$creadPrec :: ReadPrec RealtimeLogConfigs
readList :: ReadS [RealtimeLogConfigs]
$creadList :: ReadS [RealtimeLogConfigs]
readsPrec :: Int -> ReadS RealtimeLogConfigs
$creadsPrec :: Int -> ReadS RealtimeLogConfigs
Prelude.Read, Int -> RealtimeLogConfigs -> ShowS
[RealtimeLogConfigs] -> ShowS
RealtimeLogConfigs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RealtimeLogConfigs] -> ShowS
$cshowList :: [RealtimeLogConfigs] -> ShowS
show :: RealtimeLogConfigs -> String
$cshow :: RealtimeLogConfigs -> String
showsPrec :: Int -> RealtimeLogConfigs -> ShowS
$cshowsPrec :: Int -> RealtimeLogConfigs -> ShowS
Prelude.Show, forall x. Rep RealtimeLogConfigs x -> RealtimeLogConfigs
forall x. RealtimeLogConfigs -> Rep RealtimeLogConfigs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RealtimeLogConfigs x -> RealtimeLogConfigs
$cfrom :: forall x. RealtimeLogConfigs -> Rep RealtimeLogConfigs x
Prelude.Generic)

-- |
-- Create a value of 'RealtimeLogConfigs' 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:
--
-- 'items', 'realtimeLogConfigs_items' - Contains the list of real-time log configurations.
--
-- 'nextMarker', 'realtimeLogConfigs_nextMarker' - If there are more items in the list than are in this response, this
-- element is present. It contains the value that you should use in the
-- @Marker@ field of a subsequent request to continue listing real-time log
-- configurations where you left off.
--
-- 'maxItems', 'realtimeLogConfigs_maxItems' - The maximum number of real-time log configurations requested.
--
-- 'isTruncated', 'realtimeLogConfigs_isTruncated' - A flag that indicates whether there are more real-time log
-- configurations than are contained in this list.
--
-- 'marker', 'realtimeLogConfigs_marker' - This parameter indicates where this list of real-time log configurations
-- begins. This list includes real-time log configurations that occur after
-- the marker.
newRealtimeLogConfigs ::
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'isTruncated'
  Prelude.Bool ->
  -- | 'marker'
  Prelude.Text ->
  RealtimeLogConfigs
newRealtimeLogConfigs :: Int -> Bool -> Text -> RealtimeLogConfigs
newRealtimeLogConfigs
  Int
pMaxItems_
  Bool
pIsTruncated_
  Text
pMarker_ =
    RealtimeLogConfigs'
      { $sel:items:RealtimeLogConfigs' :: Maybe [RealtimeLogConfig]
items = forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:RealtimeLogConfigs' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
        $sel:maxItems:RealtimeLogConfigs' :: Int
maxItems = Int
pMaxItems_,
        $sel:isTruncated:RealtimeLogConfigs' :: Bool
isTruncated = Bool
pIsTruncated_,
        $sel:marker:RealtimeLogConfigs' :: Text
marker = Text
pMarker_
      }

-- | Contains the list of real-time log configurations.
realtimeLogConfigs_items :: Lens.Lens' RealtimeLogConfigs (Prelude.Maybe [RealtimeLogConfig])
realtimeLogConfigs_items :: Lens' RealtimeLogConfigs (Maybe [RealtimeLogConfig])
realtimeLogConfigs_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfigs' {Maybe [RealtimeLogConfig]
items :: Maybe [RealtimeLogConfig]
$sel:items:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe [RealtimeLogConfig]
items} -> Maybe [RealtimeLogConfig]
items) (\s :: RealtimeLogConfigs
s@RealtimeLogConfigs' {} Maybe [RealtimeLogConfig]
a -> RealtimeLogConfigs
s {$sel:items:RealtimeLogConfigs' :: Maybe [RealtimeLogConfig]
items = Maybe [RealtimeLogConfig]
a} :: RealtimeLogConfigs) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If there are more items in the list than are in this response, this
-- element is present. It contains the value that you should use in the
-- @Marker@ field of a subsequent request to continue listing real-time log
-- configurations where you left off.
realtimeLogConfigs_nextMarker :: Lens.Lens' RealtimeLogConfigs (Prelude.Maybe Prelude.Text)
realtimeLogConfigs_nextMarker :: Lens' RealtimeLogConfigs (Maybe Text)
realtimeLogConfigs_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfigs' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: RealtimeLogConfigs
s@RealtimeLogConfigs' {} Maybe Text
a -> RealtimeLogConfigs
s {$sel:nextMarker:RealtimeLogConfigs' :: Maybe Text
nextMarker = Maybe Text
a} :: RealtimeLogConfigs)

-- | The maximum number of real-time log configurations requested.
realtimeLogConfigs_maxItems :: Lens.Lens' RealtimeLogConfigs Prelude.Int
realtimeLogConfigs_maxItems :: Lens' RealtimeLogConfigs Int
realtimeLogConfigs_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfigs' {Int
maxItems :: Int
$sel:maxItems:RealtimeLogConfigs' :: RealtimeLogConfigs -> Int
maxItems} -> Int
maxItems) (\s :: RealtimeLogConfigs
s@RealtimeLogConfigs' {} Int
a -> RealtimeLogConfigs
s {$sel:maxItems:RealtimeLogConfigs' :: Int
maxItems = Int
a} :: RealtimeLogConfigs)

-- | A flag that indicates whether there are more real-time log
-- configurations than are contained in this list.
realtimeLogConfigs_isTruncated :: Lens.Lens' RealtimeLogConfigs Prelude.Bool
realtimeLogConfigs_isTruncated :: Lens' RealtimeLogConfigs Bool
realtimeLogConfigs_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfigs' {Bool
isTruncated :: Bool
$sel:isTruncated:RealtimeLogConfigs' :: RealtimeLogConfigs -> Bool
isTruncated} -> Bool
isTruncated) (\s :: RealtimeLogConfigs
s@RealtimeLogConfigs' {} Bool
a -> RealtimeLogConfigs
s {$sel:isTruncated:RealtimeLogConfigs' :: Bool
isTruncated = Bool
a} :: RealtimeLogConfigs)

-- | This parameter indicates where this list of real-time log configurations
-- begins. This list includes real-time log configurations that occur after
-- the marker.
realtimeLogConfigs_marker :: Lens.Lens' RealtimeLogConfigs Prelude.Text
realtimeLogConfigs_marker :: Lens' RealtimeLogConfigs Text
realtimeLogConfigs_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RealtimeLogConfigs' {Text
marker :: Text
$sel:marker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Text
marker} -> Text
marker) (\s :: RealtimeLogConfigs
s@RealtimeLogConfigs' {} Text
a -> RealtimeLogConfigs
s {$sel:marker:RealtimeLogConfigs' :: Text
marker = Text
a} :: RealtimeLogConfigs)

instance Data.FromXML RealtimeLogConfigs where
  parseXML :: [Node] -> Either String RealtimeLogConfigs
parseXML [Node]
x =
    Maybe [RealtimeLogConfig]
-> Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs
RealtimeLogConfigs'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Items"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextMarker")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"MaxItems")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"IsTruncated")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Marker")

instance Prelude.Hashable RealtimeLogConfigs where
  hashWithSalt :: Int -> RealtimeLogConfigs -> Int
hashWithSalt Int
_salt RealtimeLogConfigs' {Bool
Int
Maybe [RealtimeLogConfig]
Maybe Text
Text
marker :: Text
isTruncated :: Bool
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [RealtimeLogConfig]
$sel:marker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Text
$sel:isTruncated:RealtimeLogConfigs' :: RealtimeLogConfigs -> Bool
$sel:maxItems:RealtimeLogConfigs' :: RealtimeLogConfigs -> Int
$sel:nextMarker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe Text
$sel:items:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe [RealtimeLogConfig]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [RealtimeLogConfig]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
isTruncated
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
marker

instance Prelude.NFData RealtimeLogConfigs where
  rnf :: RealtimeLogConfigs -> ()
rnf RealtimeLogConfigs' {Bool
Int
Maybe [RealtimeLogConfig]
Maybe Text
Text
marker :: Text
isTruncated :: Bool
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [RealtimeLogConfig]
$sel:marker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Text
$sel:isTruncated:RealtimeLogConfigs' :: RealtimeLogConfigs -> Bool
$sel:maxItems:RealtimeLogConfigs' :: RealtimeLogConfigs -> Int
$sel:nextMarker:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe Text
$sel:items:RealtimeLogConfigs' :: RealtimeLogConfigs -> Maybe [RealtimeLogConfig]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [RealtimeLogConfig]
items
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
isTruncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
marker