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

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

-- | A list of aliases (also called CNAMEs) and the CloudFront distributions
-- and Amazon Web Services accounts that they are associated with. In the
-- list, the distribution and account IDs are partially hidden, which
-- allows you to identify the distributions and accounts that you own, but
-- helps to protect the information of ones that you don’t own.
--
-- /See:/ 'newConflictingAliasesList' smart constructor.
data ConflictingAliasesList = ConflictingAliasesList'
  { -- | The number of conflicting aliases returned in the response.
    ConflictingAliasesList -> Maybe Int
quantity :: Prelude.Maybe Prelude.Int,
    -- | Contains the conflicting aliases in the list.
    ConflictingAliasesList -> Maybe [ConflictingAlias]
items :: Prelude.Maybe [ConflictingAlias],
    -- | The maximum number of conflicting aliases requested.
    ConflictingAliasesList -> Maybe Int
maxItems :: Prelude.Maybe Prelude.Int,
    -- | 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 conflicting
    -- aliases where you left off.
    ConflictingAliasesList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text
  }
  deriving (ConflictingAliasesList -> ConflictingAliasesList -> Bool
(ConflictingAliasesList -> ConflictingAliasesList -> Bool)
-> (ConflictingAliasesList -> ConflictingAliasesList -> Bool)
-> Eq ConflictingAliasesList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConflictingAliasesList -> ConflictingAliasesList -> Bool
$c/= :: ConflictingAliasesList -> ConflictingAliasesList -> Bool
== :: ConflictingAliasesList -> ConflictingAliasesList -> Bool
$c== :: ConflictingAliasesList -> ConflictingAliasesList -> Bool
Prelude.Eq, ReadPrec [ConflictingAliasesList]
ReadPrec ConflictingAliasesList
Int -> ReadS ConflictingAliasesList
ReadS [ConflictingAliasesList]
(Int -> ReadS ConflictingAliasesList)
-> ReadS [ConflictingAliasesList]
-> ReadPrec ConflictingAliasesList
-> ReadPrec [ConflictingAliasesList]
-> Read ConflictingAliasesList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConflictingAliasesList]
$creadListPrec :: ReadPrec [ConflictingAliasesList]
readPrec :: ReadPrec ConflictingAliasesList
$creadPrec :: ReadPrec ConflictingAliasesList
readList :: ReadS [ConflictingAliasesList]
$creadList :: ReadS [ConflictingAliasesList]
readsPrec :: Int -> ReadS ConflictingAliasesList
$creadsPrec :: Int -> ReadS ConflictingAliasesList
Prelude.Read, Int -> ConflictingAliasesList -> ShowS
[ConflictingAliasesList] -> ShowS
ConflictingAliasesList -> String
(Int -> ConflictingAliasesList -> ShowS)
-> (ConflictingAliasesList -> String)
-> ([ConflictingAliasesList] -> ShowS)
-> Show ConflictingAliasesList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConflictingAliasesList] -> ShowS
$cshowList :: [ConflictingAliasesList] -> ShowS
show :: ConflictingAliasesList -> String
$cshow :: ConflictingAliasesList -> String
showsPrec :: Int -> ConflictingAliasesList -> ShowS
$cshowsPrec :: Int -> ConflictingAliasesList -> ShowS
Prelude.Show, (forall x. ConflictingAliasesList -> Rep ConflictingAliasesList x)
-> (forall x.
    Rep ConflictingAliasesList x -> ConflictingAliasesList)
-> Generic ConflictingAliasesList
forall x. Rep ConflictingAliasesList x -> ConflictingAliasesList
forall x. ConflictingAliasesList -> Rep ConflictingAliasesList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConflictingAliasesList x -> ConflictingAliasesList
$cfrom :: forall x. ConflictingAliasesList -> Rep ConflictingAliasesList x
Prelude.Generic)

-- |
-- Create a value of 'ConflictingAliasesList' 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:
--
-- 'quantity', 'conflictingAliasesList_quantity' - The number of conflicting aliases returned in the response.
--
-- 'items', 'conflictingAliasesList_items' - Contains the conflicting aliases in the list.
--
-- 'maxItems', 'conflictingAliasesList_maxItems' - The maximum number of conflicting aliases requested.
--
-- 'nextMarker', 'conflictingAliasesList_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 conflicting
-- aliases where you left off.
newConflictingAliasesList ::
  ConflictingAliasesList
newConflictingAliasesList :: ConflictingAliasesList
newConflictingAliasesList =
  ConflictingAliasesList' :: Maybe Int
-> Maybe [ConflictingAlias]
-> Maybe Int
-> Maybe Text
-> ConflictingAliasesList
ConflictingAliasesList'
    { $sel:quantity:ConflictingAliasesList' :: Maybe Int
quantity = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:items:ConflictingAliasesList' :: Maybe [ConflictingAlias]
items = Maybe [ConflictingAlias]
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ConflictingAliasesList' :: Maybe Int
maxItems = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ConflictingAliasesList' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of conflicting aliases returned in the response.
conflictingAliasesList_quantity :: Lens.Lens' ConflictingAliasesList (Prelude.Maybe Prelude.Int)
conflictingAliasesList_quantity :: (Maybe Int -> f (Maybe Int))
-> ConflictingAliasesList -> f ConflictingAliasesList
conflictingAliasesList_quantity = (ConflictingAliasesList -> Maybe Int)
-> (ConflictingAliasesList -> Maybe Int -> ConflictingAliasesList)
-> Lens
     ConflictingAliasesList
     ConflictingAliasesList
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAliasesList' {Maybe Int
quantity :: Maybe Int
$sel:quantity:ConflictingAliasesList' :: ConflictingAliasesList -> Maybe Int
quantity} -> Maybe Int
quantity) (\s :: ConflictingAliasesList
s@ConflictingAliasesList' {} Maybe Int
a -> ConflictingAliasesList
s {$sel:quantity:ConflictingAliasesList' :: Maybe Int
quantity = Maybe Int
a} :: ConflictingAliasesList)

-- | Contains the conflicting aliases in the list.
conflictingAliasesList_items :: Lens.Lens' ConflictingAliasesList (Prelude.Maybe [ConflictingAlias])
conflictingAliasesList_items :: (Maybe [ConflictingAlias] -> f (Maybe [ConflictingAlias]))
-> ConflictingAliasesList -> f ConflictingAliasesList
conflictingAliasesList_items = (ConflictingAliasesList -> Maybe [ConflictingAlias])
-> (ConflictingAliasesList
    -> Maybe [ConflictingAlias] -> ConflictingAliasesList)
-> Lens
     ConflictingAliasesList
     ConflictingAliasesList
     (Maybe [ConflictingAlias])
     (Maybe [ConflictingAlias])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAliasesList' {Maybe [ConflictingAlias]
items :: Maybe [ConflictingAlias]
$sel:items:ConflictingAliasesList' :: ConflictingAliasesList -> Maybe [ConflictingAlias]
items} -> Maybe [ConflictingAlias]
items) (\s :: ConflictingAliasesList
s@ConflictingAliasesList' {} Maybe [ConflictingAlias]
a -> ConflictingAliasesList
s {$sel:items:ConflictingAliasesList' :: Maybe [ConflictingAlias]
items = Maybe [ConflictingAlias]
a} :: ConflictingAliasesList) ((Maybe [ConflictingAlias] -> f (Maybe [ConflictingAlias]))
 -> ConflictingAliasesList -> f ConflictingAliasesList)
-> ((Maybe [ConflictingAlias] -> f (Maybe [ConflictingAlias]))
    -> Maybe [ConflictingAlias] -> f (Maybe [ConflictingAlias]))
-> (Maybe [ConflictingAlias] -> f (Maybe [ConflictingAlias]))
-> ConflictingAliasesList
-> f ConflictingAliasesList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConflictingAlias]
  [ConflictingAlias]
  [ConflictingAlias]
  [ConflictingAlias]
-> Iso
     (Maybe [ConflictingAlias])
     (Maybe [ConflictingAlias])
     (Maybe [ConflictingAlias])
     (Maybe [ConflictingAlias])
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
  [ConflictingAlias]
  [ConflictingAlias]
  [ConflictingAlias]
  [ConflictingAlias]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of conflicting aliases requested.
conflictingAliasesList_maxItems :: Lens.Lens' ConflictingAliasesList (Prelude.Maybe Prelude.Int)
conflictingAliasesList_maxItems :: (Maybe Int -> f (Maybe Int))
-> ConflictingAliasesList -> f ConflictingAliasesList
conflictingAliasesList_maxItems = (ConflictingAliasesList -> Maybe Int)
-> (ConflictingAliasesList -> Maybe Int -> ConflictingAliasesList)
-> Lens
     ConflictingAliasesList
     ConflictingAliasesList
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAliasesList' {Maybe Int
maxItems :: Maybe Int
$sel:maxItems:ConflictingAliasesList' :: ConflictingAliasesList -> Maybe Int
maxItems} -> Maybe Int
maxItems) (\s :: ConflictingAliasesList
s@ConflictingAliasesList' {} Maybe Int
a -> ConflictingAliasesList
s {$sel:maxItems:ConflictingAliasesList' :: Maybe Int
maxItems = Maybe Int
a} :: ConflictingAliasesList)

-- | 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 conflicting
-- aliases where you left off.
conflictingAliasesList_nextMarker :: Lens.Lens' ConflictingAliasesList (Prelude.Maybe Prelude.Text)
conflictingAliasesList_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ConflictingAliasesList -> f ConflictingAliasesList
conflictingAliasesList_nextMarker = (ConflictingAliasesList -> Maybe Text)
-> (ConflictingAliasesList -> Maybe Text -> ConflictingAliasesList)
-> Lens
     ConflictingAliasesList
     ConflictingAliasesList
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConflictingAliasesList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ConflictingAliasesList' :: ConflictingAliasesList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ConflictingAliasesList
s@ConflictingAliasesList' {} Maybe Text
a -> ConflictingAliasesList
s {$sel:nextMarker:ConflictingAliasesList' :: Maybe Text
nextMarker = Maybe Text
a} :: ConflictingAliasesList)

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

instance Prelude.Hashable ConflictingAliasesList

instance Prelude.NFData ConflictingAliasesList