{-# 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-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)
module Amazonka.CloudFront.Types.RealtimeLogConfigs where

import Amazonka.CloudFront.Types.RealtimeLogConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RealtimeLogConfigs -> RealtimeLogConfigs -> Bool)
-> (RealtimeLogConfigs -> RealtimeLogConfigs -> Bool)
-> Eq RealtimeLogConfigs
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]
(Int -> ReadS RealtimeLogConfigs)
-> ReadS [RealtimeLogConfigs]
-> ReadPrec RealtimeLogConfigs
-> ReadPrec [RealtimeLogConfigs]
-> Read 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
(Int -> RealtimeLogConfigs -> ShowS)
-> (RealtimeLogConfigs -> String)
-> ([RealtimeLogConfigs] -> ShowS)
-> Show RealtimeLogConfigs
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. RealtimeLogConfigs -> Rep RealtimeLogConfigs x)
-> (forall x. Rep RealtimeLogConfigs x -> RealtimeLogConfigs)
-> Generic RealtimeLogConfigs
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' :: Maybe [RealtimeLogConfig]
-> Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs
RealtimeLogConfigs'
      { $sel:items:RealtimeLogConfigs' :: Maybe [RealtimeLogConfig]
items = Maybe [RealtimeLogConfig]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:RealtimeLogConfigs' :: Maybe Text
nextMarker = Maybe Text
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 :: (Maybe [RealtimeLogConfig] -> f (Maybe [RealtimeLogConfig]))
-> RealtimeLogConfigs -> f RealtimeLogConfigs
realtimeLogConfigs_items = (RealtimeLogConfigs -> Maybe [RealtimeLogConfig])
-> (RealtimeLogConfigs
    -> Maybe [RealtimeLogConfig] -> RealtimeLogConfigs)
-> Lens
     RealtimeLogConfigs
     RealtimeLogConfigs
     (Maybe [RealtimeLogConfig])
     (Maybe [RealtimeLogConfig])
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) ((Maybe [RealtimeLogConfig] -> f (Maybe [RealtimeLogConfig]))
 -> RealtimeLogConfigs -> f RealtimeLogConfigs)
-> ((Maybe [RealtimeLogConfig] -> f (Maybe [RealtimeLogConfig]))
    -> Maybe [RealtimeLogConfig] -> f (Maybe [RealtimeLogConfig]))
-> (Maybe [RealtimeLogConfig] -> f (Maybe [RealtimeLogConfig]))
-> RealtimeLogConfigs
-> f RealtimeLogConfigs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RealtimeLogConfig]
  [RealtimeLogConfig]
  [RealtimeLogConfig]
  [RealtimeLogConfig]
-> Iso
     (Maybe [RealtimeLogConfig])
     (Maybe [RealtimeLogConfig])
     (Maybe [RealtimeLogConfig])
     (Maybe [RealtimeLogConfig])
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
  [RealtimeLogConfig]
  [RealtimeLogConfig]
  [RealtimeLogConfig]
  [RealtimeLogConfig]
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 :: (Maybe Text -> f (Maybe Text))
-> RealtimeLogConfigs -> f RealtimeLogConfigs
realtimeLogConfigs_nextMarker = (RealtimeLogConfigs -> Maybe Text)
-> (RealtimeLogConfigs -> Maybe Text -> RealtimeLogConfigs)
-> Lens
     RealtimeLogConfigs RealtimeLogConfigs (Maybe Text) (Maybe Text)
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 :: (Int -> f Int) -> RealtimeLogConfigs -> f RealtimeLogConfigs
realtimeLogConfigs_maxItems = (RealtimeLogConfigs -> Int)
-> (RealtimeLogConfigs -> Int -> RealtimeLogConfigs)
-> Lens RealtimeLogConfigs RealtimeLogConfigs Int Int
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 :: (Bool -> f Bool) -> RealtimeLogConfigs -> f RealtimeLogConfigs
realtimeLogConfigs_isTruncated = (RealtimeLogConfigs -> Bool)
-> (RealtimeLogConfigs -> Bool -> RealtimeLogConfigs)
-> Lens RealtimeLogConfigs RealtimeLogConfigs Bool Bool
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 :: (Text -> f Text) -> RealtimeLogConfigs -> f RealtimeLogConfigs
realtimeLogConfigs_marker = (RealtimeLogConfigs -> Text)
-> (RealtimeLogConfigs -> Text -> RealtimeLogConfigs)
-> Lens RealtimeLogConfigs RealtimeLogConfigs Text Text
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 Core.FromXML RealtimeLogConfigs where
  parseXML :: [Node] -> Either String RealtimeLogConfigs
parseXML [Node]
x =
    Maybe [RealtimeLogConfig]
-> Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs
RealtimeLogConfigs'
      (Maybe [RealtimeLogConfig]
 -> Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs)
-> Either String (Maybe [RealtimeLogConfig])
-> Either
     String (Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Items" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [RealtimeLogConfig]))
-> Either String (Maybe [RealtimeLogConfig])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [RealtimeLogConfig])
-> [Node] -> Either String (Maybe [RealtimeLogConfig])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [RealtimeLogConfig]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String (Maybe Text -> Int -> Bool -> Text -> RealtimeLogConfigs)
-> Either String (Maybe Text)
-> Either String (Int -> Bool -> Text -> RealtimeLogConfigs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextMarker")
      Either String (Int -> Bool -> Text -> RealtimeLogConfigs)
-> Either String Int
-> Either String (Bool -> Text -> RealtimeLogConfigs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"MaxItems")
      Either String (Bool -> Text -> RealtimeLogConfigs)
-> Either String Bool -> Either String (Text -> RealtimeLogConfigs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"IsTruncated")
      Either String (Text -> RealtimeLogConfigs)
-> Either String Text -> Either String RealtimeLogConfigs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Marker")

instance Prelude.Hashable RealtimeLogConfigs

instance Prelude.NFData RealtimeLogConfigs