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

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 distribution IDs.
--
-- /See:/ 'newDistributionIdList' smart constructor.
data DistributionIdList = DistributionIdList'
  { -- | Contains the distribution IDs in the list.
    DistributionIdList -> Maybe [Text]
items :: Prelude.Maybe [Prelude.Text],
    -- | Contains the value that you should use in the @Marker@ field of a
    -- subsequent request to continue listing distribution IDs where you left
    -- off.
    DistributionIdList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The value provided in the @Marker@ request field.
    DistributionIdList -> Text
marker :: Prelude.Text,
    -- | The maximum number of distribution IDs requested.
    DistributionIdList -> Int
maxItems :: Prelude.Int,
    -- | A flag that indicates whether more distribution IDs remain to be listed.
    -- If your results were truncated, you can make a subsequent request using
    -- the @Marker@ request field to retrieve more distribution IDs in the
    -- list.
    DistributionIdList -> Bool
isTruncated :: Prelude.Bool,
    -- | The total number of distribution IDs returned in the response.
    DistributionIdList -> Int
quantity :: Prelude.Int
  }
  deriving (DistributionIdList -> DistributionIdList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistributionIdList -> DistributionIdList -> Bool
$c/= :: DistributionIdList -> DistributionIdList -> Bool
== :: DistributionIdList -> DistributionIdList -> Bool
$c== :: DistributionIdList -> DistributionIdList -> Bool
Prelude.Eq, ReadPrec [DistributionIdList]
ReadPrec DistributionIdList
Int -> ReadS DistributionIdList
ReadS [DistributionIdList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DistributionIdList]
$creadListPrec :: ReadPrec [DistributionIdList]
readPrec :: ReadPrec DistributionIdList
$creadPrec :: ReadPrec DistributionIdList
readList :: ReadS [DistributionIdList]
$creadList :: ReadS [DistributionIdList]
readsPrec :: Int -> ReadS DistributionIdList
$creadsPrec :: Int -> ReadS DistributionIdList
Prelude.Read, Int -> DistributionIdList -> ShowS
[DistributionIdList] -> ShowS
DistributionIdList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistributionIdList] -> ShowS
$cshowList :: [DistributionIdList] -> ShowS
show :: DistributionIdList -> String
$cshow :: DistributionIdList -> String
showsPrec :: Int -> DistributionIdList -> ShowS
$cshowsPrec :: Int -> DistributionIdList -> ShowS
Prelude.Show, forall x. Rep DistributionIdList x -> DistributionIdList
forall x. DistributionIdList -> Rep DistributionIdList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DistributionIdList x -> DistributionIdList
$cfrom :: forall x. DistributionIdList -> Rep DistributionIdList x
Prelude.Generic)

-- |
-- Create a value of 'DistributionIdList' 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', 'distributionIdList_items' - Contains the distribution IDs in the list.
--
-- 'nextMarker', 'distributionIdList_nextMarker' - Contains the value that you should use in the @Marker@ field of a
-- subsequent request to continue listing distribution IDs where you left
-- off.
--
-- 'marker', 'distributionIdList_marker' - The value provided in the @Marker@ request field.
--
-- 'maxItems', 'distributionIdList_maxItems' - The maximum number of distribution IDs requested.
--
-- 'isTruncated', 'distributionIdList_isTruncated' - A flag that indicates whether more distribution IDs remain to be listed.
-- If your results were truncated, you can make a subsequent request using
-- the @Marker@ request field to retrieve more distribution IDs in the
-- list.
--
-- 'quantity', 'distributionIdList_quantity' - The total number of distribution IDs returned in the response.
newDistributionIdList ::
  -- | 'marker'
  Prelude.Text ->
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'isTruncated'
  Prelude.Bool ->
  -- | 'quantity'
  Prelude.Int ->
  DistributionIdList
newDistributionIdList :: Text -> Int -> Bool -> Int -> DistributionIdList
newDistributionIdList
  Text
pMarker_
  Int
pMaxItems_
  Bool
pIsTruncated_
  Int
pQuantity_ =
    DistributionIdList'
      { $sel:items:DistributionIdList' :: Maybe [Text]
items = forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:DistributionIdList' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
        $sel:marker:DistributionIdList' :: Text
marker = Text
pMarker_,
        $sel:maxItems:DistributionIdList' :: Int
maxItems = Int
pMaxItems_,
        $sel:isTruncated:DistributionIdList' :: Bool
isTruncated = Bool
pIsTruncated_,
        $sel:quantity:DistributionIdList' :: Int
quantity = Int
pQuantity_
      }

-- | Contains the distribution IDs in the list.
distributionIdList_items :: Lens.Lens' DistributionIdList (Prelude.Maybe [Prelude.Text])
distributionIdList_items :: Lens' DistributionIdList (Maybe [Text])
distributionIdList_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Maybe [Text]
items :: Maybe [Text]
$sel:items:DistributionIdList' :: DistributionIdList -> Maybe [Text]
items} -> Maybe [Text]
items) (\s :: DistributionIdList
s@DistributionIdList' {} Maybe [Text]
a -> DistributionIdList
s {$sel:items:DistributionIdList' :: Maybe [Text]
items = Maybe [Text]
a} :: DistributionIdList) 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

-- | Contains the value that you should use in the @Marker@ field of a
-- subsequent request to continue listing distribution IDs where you left
-- off.
distributionIdList_nextMarker :: Lens.Lens' DistributionIdList (Prelude.Maybe Prelude.Text)
distributionIdList_nextMarker :: Lens' DistributionIdList (Maybe Text)
distributionIdList_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:DistributionIdList' :: DistributionIdList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: DistributionIdList
s@DistributionIdList' {} Maybe Text
a -> DistributionIdList
s {$sel:nextMarker:DistributionIdList' :: Maybe Text
nextMarker = Maybe Text
a} :: DistributionIdList)

-- | The value provided in the @Marker@ request field.
distributionIdList_marker :: Lens.Lens' DistributionIdList Prelude.Text
distributionIdList_marker :: Lens' DistributionIdList Text
distributionIdList_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Text
marker :: Text
$sel:marker:DistributionIdList' :: DistributionIdList -> Text
marker} -> Text
marker) (\s :: DistributionIdList
s@DistributionIdList' {} Text
a -> DistributionIdList
s {$sel:marker:DistributionIdList' :: Text
marker = Text
a} :: DistributionIdList)

-- | The maximum number of distribution IDs requested.
distributionIdList_maxItems :: Lens.Lens' DistributionIdList Prelude.Int
distributionIdList_maxItems :: Lens' DistributionIdList Int
distributionIdList_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Int
maxItems :: Int
$sel:maxItems:DistributionIdList' :: DistributionIdList -> Int
maxItems} -> Int
maxItems) (\s :: DistributionIdList
s@DistributionIdList' {} Int
a -> DistributionIdList
s {$sel:maxItems:DistributionIdList' :: Int
maxItems = Int
a} :: DistributionIdList)

-- | A flag that indicates whether more distribution IDs remain to be listed.
-- If your results were truncated, you can make a subsequent request using
-- the @Marker@ request field to retrieve more distribution IDs in the
-- list.
distributionIdList_isTruncated :: Lens.Lens' DistributionIdList Prelude.Bool
distributionIdList_isTruncated :: Lens' DistributionIdList Bool
distributionIdList_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Bool
isTruncated :: Bool
$sel:isTruncated:DistributionIdList' :: DistributionIdList -> Bool
isTruncated} -> Bool
isTruncated) (\s :: DistributionIdList
s@DistributionIdList' {} Bool
a -> DistributionIdList
s {$sel:isTruncated:DistributionIdList' :: Bool
isTruncated = Bool
a} :: DistributionIdList)

-- | The total number of distribution IDs returned in the response.
distributionIdList_quantity :: Lens.Lens' DistributionIdList Prelude.Int
distributionIdList_quantity :: Lens' DistributionIdList Int
distributionIdList_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionIdList' {Int
quantity :: Int
$sel:quantity:DistributionIdList' :: DistributionIdList -> Int
quantity} -> Int
quantity) (\s :: DistributionIdList
s@DistributionIdList' {} Int
a -> DistributionIdList
s {$sel:quantity:DistributionIdList' :: Int
quantity = Int
a} :: DistributionIdList)

instance Data.FromXML DistributionIdList where
  parseXML :: [Node] -> Either String DistributionIdList
parseXML [Node]
x =
    Maybe [Text]
-> Maybe Text -> Text -> Int -> Bool -> Int -> DistributionIdList
DistributionIdList'
      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
"DistributionId")
                  )
      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
"Marker")
      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
"Quantity")

instance Prelude.Hashable DistributionIdList where
  hashWithSalt :: Int -> DistributionIdList -> Int
hashWithSalt Int
_salt DistributionIdList' {Bool
Int
Maybe [Text]
Maybe Text
Text
quantity :: Int
isTruncated :: Bool
maxItems :: Int
marker :: Text
nextMarker :: Maybe Text
items :: Maybe [Text]
$sel:quantity:DistributionIdList' :: DistributionIdList -> Int
$sel:isTruncated:DistributionIdList' :: DistributionIdList -> Bool
$sel:maxItems:DistributionIdList' :: DistributionIdList -> Int
$sel:marker:DistributionIdList' :: DistributionIdList -> Text
$sel:nextMarker:DistributionIdList' :: DistributionIdList -> Maybe Text
$sel:items:DistributionIdList' :: DistributionIdList -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
marker
      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` Int
quantity

instance Prelude.NFData DistributionIdList where
  rnf :: DistributionIdList -> ()
rnf DistributionIdList' {Bool
Int
Maybe [Text]
Maybe Text
Text
quantity :: Int
isTruncated :: Bool
maxItems :: Int
marker :: Text
nextMarker :: Maybe Text
items :: Maybe [Text]
$sel:quantity:DistributionIdList' :: DistributionIdList -> Int
$sel:isTruncated:DistributionIdList' :: DistributionIdList -> Bool
$sel:maxItems:DistributionIdList' :: DistributionIdList -> Int
$sel:marker:DistributionIdList' :: DistributionIdList -> Text
$sel:nextMarker:DistributionIdList' :: DistributionIdList -> Maybe Text
$sel:items:DistributionIdList' :: DistributionIdList -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
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 Text
marker
      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 Int
quantity