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

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

-- | List of field-level encrpytion configurations.
--
-- /See:/ 'newFieldLevelEncryptionList' smart constructor.
data FieldLevelEncryptionList = FieldLevelEncryptionList'
  { -- | An array of field-level encryption items.
    FieldLevelEncryptionList -> Maybe [FieldLevelEncryptionSummary]
items :: Prelude.Maybe [FieldLevelEncryptionSummary],
    -- | If there are more elements to be listed, this element is present and
    -- contains the value that you can use for the @Marker@ request parameter
    -- to continue listing your configurations where you left off.
    FieldLevelEncryptionList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of elements you want in the response body.
    FieldLevelEncryptionList -> Int
maxItems :: Prelude.Int,
    -- | The number of field-level encryption items.
    FieldLevelEncryptionList -> Int
quantity :: Prelude.Int
  }
  deriving (FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool
(FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool)
-> (FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool)
-> Eq FieldLevelEncryptionList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool
$c/= :: FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool
== :: FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool
$c== :: FieldLevelEncryptionList -> FieldLevelEncryptionList -> Bool
Prelude.Eq, ReadPrec [FieldLevelEncryptionList]
ReadPrec FieldLevelEncryptionList
Int -> ReadS FieldLevelEncryptionList
ReadS [FieldLevelEncryptionList]
(Int -> ReadS FieldLevelEncryptionList)
-> ReadS [FieldLevelEncryptionList]
-> ReadPrec FieldLevelEncryptionList
-> ReadPrec [FieldLevelEncryptionList]
-> Read FieldLevelEncryptionList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldLevelEncryptionList]
$creadListPrec :: ReadPrec [FieldLevelEncryptionList]
readPrec :: ReadPrec FieldLevelEncryptionList
$creadPrec :: ReadPrec FieldLevelEncryptionList
readList :: ReadS [FieldLevelEncryptionList]
$creadList :: ReadS [FieldLevelEncryptionList]
readsPrec :: Int -> ReadS FieldLevelEncryptionList
$creadsPrec :: Int -> ReadS FieldLevelEncryptionList
Prelude.Read, Int -> FieldLevelEncryptionList -> ShowS
[FieldLevelEncryptionList] -> ShowS
FieldLevelEncryptionList -> String
(Int -> FieldLevelEncryptionList -> ShowS)
-> (FieldLevelEncryptionList -> String)
-> ([FieldLevelEncryptionList] -> ShowS)
-> Show FieldLevelEncryptionList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldLevelEncryptionList] -> ShowS
$cshowList :: [FieldLevelEncryptionList] -> ShowS
show :: FieldLevelEncryptionList -> String
$cshow :: FieldLevelEncryptionList -> String
showsPrec :: Int -> FieldLevelEncryptionList -> ShowS
$cshowsPrec :: Int -> FieldLevelEncryptionList -> ShowS
Prelude.Show, (forall x.
 FieldLevelEncryptionList -> Rep FieldLevelEncryptionList x)
-> (forall x.
    Rep FieldLevelEncryptionList x -> FieldLevelEncryptionList)
-> Generic FieldLevelEncryptionList
forall x.
Rep FieldLevelEncryptionList x -> FieldLevelEncryptionList
forall x.
FieldLevelEncryptionList -> Rep FieldLevelEncryptionList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FieldLevelEncryptionList x -> FieldLevelEncryptionList
$cfrom :: forall x.
FieldLevelEncryptionList -> Rep FieldLevelEncryptionList x
Prelude.Generic)

-- |
-- Create a value of 'FieldLevelEncryptionList' 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', 'fieldLevelEncryptionList_items' - An array of field-level encryption items.
--
-- 'nextMarker', 'fieldLevelEncryptionList_nextMarker' - If there are more elements to be listed, this element is present and
-- contains the value that you can use for the @Marker@ request parameter
-- to continue listing your configurations where you left off.
--
-- 'maxItems', 'fieldLevelEncryptionList_maxItems' - The maximum number of elements you want in the response body.
--
-- 'quantity', 'fieldLevelEncryptionList_quantity' - The number of field-level encryption items.
newFieldLevelEncryptionList ::
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'quantity'
  Prelude.Int ->
  FieldLevelEncryptionList
newFieldLevelEncryptionList :: Int -> Int -> FieldLevelEncryptionList
newFieldLevelEncryptionList Int
pMaxItems_ Int
pQuantity_ =
  FieldLevelEncryptionList' :: Maybe [FieldLevelEncryptionSummary]
-> Maybe Text -> Int -> Int -> FieldLevelEncryptionList
FieldLevelEncryptionList'
    { $sel:items:FieldLevelEncryptionList' :: Maybe [FieldLevelEncryptionSummary]
items = Maybe [FieldLevelEncryptionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:FieldLevelEncryptionList' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:FieldLevelEncryptionList' :: Int
maxItems = Int
pMaxItems_,
      $sel:quantity:FieldLevelEncryptionList' :: Int
quantity = Int
pQuantity_
    }

-- | An array of field-level encryption items.
fieldLevelEncryptionList_items :: Lens.Lens' FieldLevelEncryptionList (Prelude.Maybe [FieldLevelEncryptionSummary])
fieldLevelEncryptionList_items :: (Maybe [FieldLevelEncryptionSummary]
 -> f (Maybe [FieldLevelEncryptionSummary]))
-> FieldLevelEncryptionList -> f FieldLevelEncryptionList
fieldLevelEncryptionList_items = (FieldLevelEncryptionList -> Maybe [FieldLevelEncryptionSummary])
-> (FieldLevelEncryptionList
    -> Maybe [FieldLevelEncryptionSummary] -> FieldLevelEncryptionList)
-> Lens
     FieldLevelEncryptionList
     FieldLevelEncryptionList
     (Maybe [FieldLevelEncryptionSummary])
     (Maybe [FieldLevelEncryptionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionList' {Maybe [FieldLevelEncryptionSummary]
items :: Maybe [FieldLevelEncryptionSummary]
$sel:items:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe [FieldLevelEncryptionSummary]
items} -> Maybe [FieldLevelEncryptionSummary]
items) (\s :: FieldLevelEncryptionList
s@FieldLevelEncryptionList' {} Maybe [FieldLevelEncryptionSummary]
a -> FieldLevelEncryptionList
s {$sel:items:FieldLevelEncryptionList' :: Maybe [FieldLevelEncryptionSummary]
items = Maybe [FieldLevelEncryptionSummary]
a} :: FieldLevelEncryptionList) ((Maybe [FieldLevelEncryptionSummary]
  -> f (Maybe [FieldLevelEncryptionSummary]))
 -> FieldLevelEncryptionList -> f FieldLevelEncryptionList)
-> ((Maybe [FieldLevelEncryptionSummary]
     -> f (Maybe [FieldLevelEncryptionSummary]))
    -> Maybe [FieldLevelEncryptionSummary]
    -> f (Maybe [FieldLevelEncryptionSummary]))
-> (Maybe [FieldLevelEncryptionSummary]
    -> f (Maybe [FieldLevelEncryptionSummary]))
-> FieldLevelEncryptionList
-> f FieldLevelEncryptionList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
-> Iso
     (Maybe [FieldLevelEncryptionSummary])
     (Maybe [FieldLevelEncryptionSummary])
     (Maybe [FieldLevelEncryptionSummary])
     (Maybe [FieldLevelEncryptionSummary])
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
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
  [FieldLevelEncryptionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If there are more elements to be listed, this element is present and
-- contains the value that you can use for the @Marker@ request parameter
-- to continue listing your configurations where you left off.
fieldLevelEncryptionList_nextMarker :: Lens.Lens' FieldLevelEncryptionList (Prelude.Maybe Prelude.Text)
fieldLevelEncryptionList_nextMarker :: (Maybe Text -> f (Maybe Text))
-> FieldLevelEncryptionList -> f FieldLevelEncryptionList
fieldLevelEncryptionList_nextMarker = (FieldLevelEncryptionList -> Maybe Text)
-> (FieldLevelEncryptionList
    -> Maybe Text -> FieldLevelEncryptionList)
-> Lens
     FieldLevelEncryptionList
     FieldLevelEncryptionList
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: FieldLevelEncryptionList
s@FieldLevelEncryptionList' {} Maybe Text
a -> FieldLevelEncryptionList
s {$sel:nextMarker:FieldLevelEncryptionList' :: Maybe Text
nextMarker = Maybe Text
a} :: FieldLevelEncryptionList)

-- | The maximum number of elements you want in the response body.
fieldLevelEncryptionList_maxItems :: Lens.Lens' FieldLevelEncryptionList Prelude.Int
fieldLevelEncryptionList_maxItems :: (Int -> f Int)
-> FieldLevelEncryptionList -> f FieldLevelEncryptionList
fieldLevelEncryptionList_maxItems = (FieldLevelEncryptionList -> Int)
-> (FieldLevelEncryptionList -> Int -> FieldLevelEncryptionList)
-> Lens FieldLevelEncryptionList FieldLevelEncryptionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionList' {Int
maxItems :: Int
$sel:maxItems:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
maxItems} -> Int
maxItems) (\s :: FieldLevelEncryptionList
s@FieldLevelEncryptionList' {} Int
a -> FieldLevelEncryptionList
s {$sel:maxItems:FieldLevelEncryptionList' :: Int
maxItems = Int
a} :: FieldLevelEncryptionList)

-- | The number of field-level encryption items.
fieldLevelEncryptionList_quantity :: Lens.Lens' FieldLevelEncryptionList Prelude.Int
fieldLevelEncryptionList_quantity :: (Int -> f Int)
-> FieldLevelEncryptionList -> f FieldLevelEncryptionList
fieldLevelEncryptionList_quantity = (FieldLevelEncryptionList -> Int)
-> (FieldLevelEncryptionList -> Int -> FieldLevelEncryptionList)
-> Lens FieldLevelEncryptionList FieldLevelEncryptionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionList' {Int
quantity :: Int
$sel:quantity:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
quantity} -> Int
quantity) (\s :: FieldLevelEncryptionList
s@FieldLevelEncryptionList' {} Int
a -> FieldLevelEncryptionList
s {$sel:quantity:FieldLevelEncryptionList' :: Int
quantity = Int
a} :: FieldLevelEncryptionList)

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

instance Prelude.NFData FieldLevelEncryptionList