{-# 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.StreamingDistributionList
-- 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.StreamingDistributionList where

import Amazonka.CloudFront.Types.StreamingDistributionSummary
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A streaming distribution list.
--
-- /See:/ 'newStreamingDistributionList' smart constructor.
data StreamingDistributionList = StreamingDistributionList'
  { -- | A complex type that contains one @StreamingDistributionSummary@ element
    -- for each distribution that was created by the current account.
    StreamingDistributionList -> Maybe [StreamingDistributionSummary]
items :: Prelude.Maybe [StreamingDistributionSummary],
    -- | If @IsTruncated@ is @true@, this element is present and contains the
    -- value you can use for the @Marker@ request parameter to continue listing
    -- your RTMP distributions where they left off.
    StreamingDistributionList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The value you provided for the @Marker@ request parameter.
    StreamingDistributionList -> Text
marker :: Prelude.Text,
    -- | The value you provided for the @MaxItems@ request parameter.
    StreamingDistributionList -> Int
maxItems :: Prelude.Int,
    -- | A flag that indicates whether more streaming distributions remain to be
    -- listed. If your results were truncated, you can make a follow-up
    -- pagination request using the @Marker@ request parameter to retrieve more
    -- distributions in the list.
    StreamingDistributionList -> Bool
isTruncated :: Prelude.Bool,
    -- | The number of streaming distributions that were created by the current
    -- account.
    StreamingDistributionList -> Int
quantity :: Prelude.Int
  }
  deriving (StreamingDistributionList -> StreamingDistributionList -> Bool
(StreamingDistributionList -> StreamingDistributionList -> Bool)
-> (StreamingDistributionList -> StreamingDistributionList -> Bool)
-> Eq StreamingDistributionList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StreamingDistributionList -> StreamingDistributionList -> Bool
$c/= :: StreamingDistributionList -> StreamingDistributionList -> Bool
== :: StreamingDistributionList -> StreamingDistributionList -> Bool
$c== :: StreamingDistributionList -> StreamingDistributionList -> Bool
Prelude.Eq, ReadPrec [StreamingDistributionList]
ReadPrec StreamingDistributionList
Int -> ReadS StreamingDistributionList
ReadS [StreamingDistributionList]
(Int -> ReadS StreamingDistributionList)
-> ReadS [StreamingDistributionList]
-> ReadPrec StreamingDistributionList
-> ReadPrec [StreamingDistributionList]
-> Read StreamingDistributionList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StreamingDistributionList]
$creadListPrec :: ReadPrec [StreamingDistributionList]
readPrec :: ReadPrec StreamingDistributionList
$creadPrec :: ReadPrec StreamingDistributionList
readList :: ReadS [StreamingDistributionList]
$creadList :: ReadS [StreamingDistributionList]
readsPrec :: Int -> ReadS StreamingDistributionList
$creadsPrec :: Int -> ReadS StreamingDistributionList
Prelude.Read, Int -> StreamingDistributionList -> ShowS
[StreamingDistributionList] -> ShowS
StreamingDistributionList -> String
(Int -> StreamingDistributionList -> ShowS)
-> (StreamingDistributionList -> String)
-> ([StreamingDistributionList] -> ShowS)
-> Show StreamingDistributionList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StreamingDistributionList] -> ShowS
$cshowList :: [StreamingDistributionList] -> ShowS
show :: StreamingDistributionList -> String
$cshow :: StreamingDistributionList -> String
showsPrec :: Int -> StreamingDistributionList -> ShowS
$cshowsPrec :: Int -> StreamingDistributionList -> ShowS
Prelude.Show, (forall x.
 StreamingDistributionList -> Rep StreamingDistributionList x)
-> (forall x.
    Rep StreamingDistributionList x -> StreamingDistributionList)
-> Generic StreamingDistributionList
forall x.
Rep StreamingDistributionList x -> StreamingDistributionList
forall x.
StreamingDistributionList -> Rep StreamingDistributionList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StreamingDistributionList x -> StreamingDistributionList
$cfrom :: forall x.
StreamingDistributionList -> Rep StreamingDistributionList x
Prelude.Generic)

-- |
-- Create a value of 'StreamingDistributionList' 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', 'streamingDistributionList_items' - A complex type that contains one @StreamingDistributionSummary@ element
-- for each distribution that was created by the current account.
--
-- 'nextMarker', 'streamingDistributionList_nextMarker' - If @IsTruncated@ is @true@, this element is present and contains the
-- value you can use for the @Marker@ request parameter to continue listing
-- your RTMP distributions where they left off.
--
-- 'marker', 'streamingDistributionList_marker' - The value you provided for the @Marker@ request parameter.
--
-- 'maxItems', 'streamingDistributionList_maxItems' - The value you provided for the @MaxItems@ request parameter.
--
-- 'isTruncated', 'streamingDistributionList_isTruncated' - A flag that indicates whether more streaming distributions remain to be
-- listed. If your results were truncated, you can make a follow-up
-- pagination request using the @Marker@ request parameter to retrieve more
-- distributions in the list.
--
-- 'quantity', 'streamingDistributionList_quantity' - The number of streaming distributions that were created by the current
-- account.
newStreamingDistributionList ::
  -- | 'marker'
  Prelude.Text ->
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'isTruncated'
  Prelude.Bool ->
  -- | 'quantity'
  Prelude.Int ->
  StreamingDistributionList
newStreamingDistributionList :: Text -> Int -> Bool -> Int -> StreamingDistributionList
newStreamingDistributionList
  Text
pMarker_
  Int
pMaxItems_
  Bool
pIsTruncated_
  Int
pQuantity_ =
    StreamingDistributionList' :: Maybe [StreamingDistributionSummary]
-> Maybe Text
-> Text
-> Int
-> Bool
-> Int
-> StreamingDistributionList
StreamingDistributionList'
      { $sel:items:StreamingDistributionList' :: Maybe [StreamingDistributionSummary]
items = Maybe [StreamingDistributionSummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:StreamingDistributionList' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:marker:StreamingDistributionList' :: Text
marker = Text
pMarker_,
        $sel:maxItems:StreamingDistributionList' :: Int
maxItems = Int
pMaxItems_,
        $sel:isTruncated:StreamingDistributionList' :: Bool
isTruncated = Bool
pIsTruncated_,
        $sel:quantity:StreamingDistributionList' :: Int
quantity = Int
pQuantity_
      }

-- | A complex type that contains one @StreamingDistributionSummary@ element
-- for each distribution that was created by the current account.
streamingDistributionList_items :: Lens.Lens' StreamingDistributionList (Prelude.Maybe [StreamingDistributionSummary])
streamingDistributionList_items :: (Maybe [StreamingDistributionSummary]
 -> f (Maybe [StreamingDistributionSummary]))
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_items = (StreamingDistributionList -> Maybe [StreamingDistributionSummary])
-> (StreamingDistributionList
    -> Maybe [StreamingDistributionSummary]
    -> StreamingDistributionList)
-> Lens
     StreamingDistributionList
     StreamingDistributionList
     (Maybe [StreamingDistributionSummary])
     (Maybe [StreamingDistributionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Maybe [StreamingDistributionSummary]
items :: Maybe [StreamingDistributionSummary]
$sel:items:StreamingDistributionList' :: StreamingDistributionList -> Maybe [StreamingDistributionSummary]
items} -> Maybe [StreamingDistributionSummary]
items) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Maybe [StreamingDistributionSummary]
a -> StreamingDistributionList
s {$sel:items:StreamingDistributionList' :: Maybe [StreamingDistributionSummary]
items = Maybe [StreamingDistributionSummary]
a} :: StreamingDistributionList) ((Maybe [StreamingDistributionSummary]
  -> f (Maybe [StreamingDistributionSummary]))
 -> StreamingDistributionList -> f StreamingDistributionList)
-> ((Maybe [StreamingDistributionSummary]
     -> f (Maybe [StreamingDistributionSummary]))
    -> Maybe [StreamingDistributionSummary]
    -> f (Maybe [StreamingDistributionSummary]))
-> (Maybe [StreamingDistributionSummary]
    -> f (Maybe [StreamingDistributionSummary]))
-> StreamingDistributionList
-> f StreamingDistributionList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
-> Iso
     (Maybe [StreamingDistributionSummary])
     (Maybe [StreamingDistributionSummary])
     (Maybe [StreamingDistributionSummary])
     (Maybe [StreamingDistributionSummary])
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
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
  [StreamingDistributionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If @IsTruncated@ is @true@, this element is present and contains the
-- value you can use for the @Marker@ request parameter to continue listing
-- your RTMP distributions where they left off.
streamingDistributionList_nextMarker :: Lens.Lens' StreamingDistributionList (Prelude.Maybe Prelude.Text)
streamingDistributionList_nextMarker :: (Maybe Text -> f (Maybe Text))
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_nextMarker = (StreamingDistributionList -> Maybe Text)
-> (StreamingDistributionList
    -> Maybe Text -> StreamingDistributionList)
-> Lens
     StreamingDistributionList
     StreamingDistributionList
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:StreamingDistributionList' :: StreamingDistributionList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Maybe Text
a -> StreamingDistributionList
s {$sel:nextMarker:StreamingDistributionList' :: Maybe Text
nextMarker = Maybe Text
a} :: StreamingDistributionList)

-- | The value you provided for the @Marker@ request parameter.
streamingDistributionList_marker :: Lens.Lens' StreamingDistributionList Prelude.Text
streamingDistributionList_marker :: (Text -> f Text)
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_marker = (StreamingDistributionList -> Text)
-> (StreamingDistributionList -> Text -> StreamingDistributionList)
-> Lens
     StreamingDistributionList StreamingDistributionList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Text
marker :: Text
$sel:marker:StreamingDistributionList' :: StreamingDistributionList -> Text
marker} -> Text
marker) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Text
a -> StreamingDistributionList
s {$sel:marker:StreamingDistributionList' :: Text
marker = Text
a} :: StreamingDistributionList)

-- | The value you provided for the @MaxItems@ request parameter.
streamingDistributionList_maxItems :: Lens.Lens' StreamingDistributionList Prelude.Int
streamingDistributionList_maxItems :: (Int -> f Int)
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_maxItems = (StreamingDistributionList -> Int)
-> (StreamingDistributionList -> Int -> StreamingDistributionList)
-> Lens StreamingDistributionList StreamingDistributionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Int
maxItems :: Int
$sel:maxItems:StreamingDistributionList' :: StreamingDistributionList -> Int
maxItems} -> Int
maxItems) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Int
a -> StreamingDistributionList
s {$sel:maxItems:StreamingDistributionList' :: Int
maxItems = Int
a} :: StreamingDistributionList)

-- | A flag that indicates whether more streaming distributions remain to be
-- listed. If your results were truncated, you can make a follow-up
-- pagination request using the @Marker@ request parameter to retrieve more
-- distributions in the list.
streamingDistributionList_isTruncated :: Lens.Lens' StreamingDistributionList Prelude.Bool
streamingDistributionList_isTruncated :: (Bool -> f Bool)
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_isTruncated = (StreamingDistributionList -> Bool)
-> (StreamingDistributionList -> Bool -> StreamingDistributionList)
-> Lens
     StreamingDistributionList StreamingDistributionList Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Bool
isTruncated :: Bool
$sel:isTruncated:StreamingDistributionList' :: StreamingDistributionList -> Bool
isTruncated} -> Bool
isTruncated) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Bool
a -> StreamingDistributionList
s {$sel:isTruncated:StreamingDistributionList' :: Bool
isTruncated = Bool
a} :: StreamingDistributionList)

-- | The number of streaming distributions that were created by the current
-- account.
streamingDistributionList_quantity :: Lens.Lens' StreamingDistributionList Prelude.Int
streamingDistributionList_quantity :: (Int -> f Int)
-> StreamingDistributionList -> f StreamingDistributionList
streamingDistributionList_quantity = (StreamingDistributionList -> Int)
-> (StreamingDistributionList -> Int -> StreamingDistributionList)
-> Lens StreamingDistributionList StreamingDistributionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StreamingDistributionList' {Int
quantity :: Int
$sel:quantity:StreamingDistributionList' :: StreamingDistributionList -> Int
quantity} -> Int
quantity) (\s :: StreamingDistributionList
s@StreamingDistributionList' {} Int
a -> StreamingDistributionList
s {$sel:quantity:StreamingDistributionList' :: Int
quantity = Int
a} :: StreamingDistributionList)

instance Core.FromXML StreamingDistributionList where
  parseXML :: [Node] -> Either String StreamingDistributionList
parseXML [Node]
x =
    Maybe [StreamingDistributionSummary]
-> Maybe Text
-> Text
-> Int
-> Bool
-> Int
-> StreamingDistributionList
StreamingDistributionList'
      (Maybe [StreamingDistributionSummary]
 -> Maybe Text
 -> Text
 -> Int
 -> Bool
 -> Int
 -> StreamingDistributionList)
-> Either String (Maybe [StreamingDistributionSummary])
-> Either
     String
     (Maybe Text
      -> Text -> Int -> Bool -> Int -> StreamingDistributionList)
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 [StreamingDistributionSummary]))
-> Either String (Maybe [StreamingDistributionSummary])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [StreamingDistributionSummary])
-> [Node] -> Either String (Maybe [StreamingDistributionSummary])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may
                        (Text -> [Node] -> Either String [StreamingDistributionSummary]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"StreamingDistributionSummary")
                  )
      Either
  String
  (Maybe Text
   -> Text -> Int -> Bool -> Int -> StreamingDistributionList)
-> Either String (Maybe Text)
-> Either
     String (Text -> Int -> Bool -> Int -> StreamingDistributionList)
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 (Text -> Int -> Bool -> Int -> StreamingDistributionList)
-> Either String Text
-> Either String (Int -> Bool -> Int -> StreamingDistributionList)
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")
      Either String (Int -> Bool -> Int -> StreamingDistributionList)
-> Either String Int
-> Either String (Bool -> Int -> StreamingDistributionList)
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 -> Int -> StreamingDistributionList)
-> Either String Bool
-> Either String (Int -> StreamingDistributionList)
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 (Int -> StreamingDistributionList)
-> Either String Int -> Either String StreamingDistributionList
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
"Quantity")

instance Prelude.Hashable StreamingDistributionList

instance Prelude.NFData StreamingDistributionList