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

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

-- | List of field-level encryption profiles.
--
-- /See:/ 'newFieldLevelEncryptionProfileList' smart constructor.
data FieldLevelEncryptionProfileList = FieldLevelEncryptionProfileList'
  { -- | The field-level encryption profile items.
    FieldLevelEncryptionProfileList
-> Maybe [FieldLevelEncryptionProfileSummary]
items :: Prelude.Maybe [FieldLevelEncryptionProfileSummary],
    -- | 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 profiles where you left off.
    FieldLevelEncryptionProfileList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of field-level encryption profiles you want in the
    -- response body.
    FieldLevelEncryptionProfileList -> Int
maxItems :: Prelude.Int,
    -- | The number of field-level encryption profiles.
    FieldLevelEncryptionProfileList -> Int
quantity :: Prelude.Int
  }
  deriving (FieldLevelEncryptionProfileList
-> FieldLevelEncryptionProfileList -> Bool
(FieldLevelEncryptionProfileList
 -> FieldLevelEncryptionProfileList -> Bool)
-> (FieldLevelEncryptionProfileList
    -> FieldLevelEncryptionProfileList -> Bool)
-> Eq FieldLevelEncryptionProfileList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLevelEncryptionProfileList
-> FieldLevelEncryptionProfileList -> Bool
$c/= :: FieldLevelEncryptionProfileList
-> FieldLevelEncryptionProfileList -> Bool
== :: FieldLevelEncryptionProfileList
-> FieldLevelEncryptionProfileList -> Bool
$c== :: FieldLevelEncryptionProfileList
-> FieldLevelEncryptionProfileList -> Bool
Prelude.Eq, ReadPrec [FieldLevelEncryptionProfileList]
ReadPrec FieldLevelEncryptionProfileList
Int -> ReadS FieldLevelEncryptionProfileList
ReadS [FieldLevelEncryptionProfileList]
(Int -> ReadS FieldLevelEncryptionProfileList)
-> ReadS [FieldLevelEncryptionProfileList]
-> ReadPrec FieldLevelEncryptionProfileList
-> ReadPrec [FieldLevelEncryptionProfileList]
-> Read FieldLevelEncryptionProfileList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldLevelEncryptionProfileList]
$creadListPrec :: ReadPrec [FieldLevelEncryptionProfileList]
readPrec :: ReadPrec FieldLevelEncryptionProfileList
$creadPrec :: ReadPrec FieldLevelEncryptionProfileList
readList :: ReadS [FieldLevelEncryptionProfileList]
$creadList :: ReadS [FieldLevelEncryptionProfileList]
readsPrec :: Int -> ReadS FieldLevelEncryptionProfileList
$creadsPrec :: Int -> ReadS FieldLevelEncryptionProfileList
Prelude.Read, Int -> FieldLevelEncryptionProfileList -> ShowS
[FieldLevelEncryptionProfileList] -> ShowS
FieldLevelEncryptionProfileList -> String
(Int -> FieldLevelEncryptionProfileList -> ShowS)
-> (FieldLevelEncryptionProfileList -> String)
-> ([FieldLevelEncryptionProfileList] -> ShowS)
-> Show FieldLevelEncryptionProfileList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldLevelEncryptionProfileList] -> ShowS
$cshowList :: [FieldLevelEncryptionProfileList] -> ShowS
show :: FieldLevelEncryptionProfileList -> String
$cshow :: FieldLevelEncryptionProfileList -> String
showsPrec :: Int -> FieldLevelEncryptionProfileList -> ShowS
$cshowsPrec :: Int -> FieldLevelEncryptionProfileList -> ShowS
Prelude.Show, (forall x.
 FieldLevelEncryptionProfileList
 -> Rep FieldLevelEncryptionProfileList x)
-> (forall x.
    Rep FieldLevelEncryptionProfileList x
    -> FieldLevelEncryptionProfileList)
-> Generic FieldLevelEncryptionProfileList
forall x.
Rep FieldLevelEncryptionProfileList x
-> FieldLevelEncryptionProfileList
forall x.
FieldLevelEncryptionProfileList
-> Rep FieldLevelEncryptionProfileList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FieldLevelEncryptionProfileList x
-> FieldLevelEncryptionProfileList
$cfrom :: forall x.
FieldLevelEncryptionProfileList
-> Rep FieldLevelEncryptionProfileList x
Prelude.Generic)

-- |
-- Create a value of 'FieldLevelEncryptionProfileList' 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', 'fieldLevelEncryptionProfileList_items' - The field-level encryption profile items.
--
-- 'nextMarker', 'fieldLevelEncryptionProfileList_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 profiles where you left off.
--
-- 'maxItems', 'fieldLevelEncryptionProfileList_maxItems' - The maximum number of field-level encryption profiles you want in the
-- response body.
--
-- 'quantity', 'fieldLevelEncryptionProfileList_quantity' - The number of field-level encryption profiles.
newFieldLevelEncryptionProfileList ::
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'quantity'
  Prelude.Int ->
  FieldLevelEncryptionProfileList
newFieldLevelEncryptionProfileList :: Int -> Int -> FieldLevelEncryptionProfileList
newFieldLevelEncryptionProfileList
  Int
pMaxItems_
  Int
pQuantity_ =
    FieldLevelEncryptionProfileList' :: Maybe [FieldLevelEncryptionProfileSummary]
-> Maybe Text -> Int -> Int -> FieldLevelEncryptionProfileList
FieldLevelEncryptionProfileList'
      { $sel:items:FieldLevelEncryptionProfileList' :: Maybe [FieldLevelEncryptionProfileSummary]
items =
          Maybe [FieldLevelEncryptionProfileSummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:FieldLevelEncryptionProfileList' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxItems:FieldLevelEncryptionProfileList' :: Int
maxItems = Int
pMaxItems_,
        $sel:quantity:FieldLevelEncryptionProfileList' :: Int
quantity = Int
pQuantity_
      }

-- | The field-level encryption profile items.
fieldLevelEncryptionProfileList_items :: Lens.Lens' FieldLevelEncryptionProfileList (Prelude.Maybe [FieldLevelEncryptionProfileSummary])
fieldLevelEncryptionProfileList_items :: (Maybe [FieldLevelEncryptionProfileSummary]
 -> f (Maybe [FieldLevelEncryptionProfileSummary]))
-> FieldLevelEncryptionProfileList
-> f FieldLevelEncryptionProfileList
fieldLevelEncryptionProfileList_items = (FieldLevelEncryptionProfileList
 -> Maybe [FieldLevelEncryptionProfileSummary])
-> (FieldLevelEncryptionProfileList
    -> Maybe [FieldLevelEncryptionProfileSummary]
    -> FieldLevelEncryptionProfileList)
-> Lens
     FieldLevelEncryptionProfileList
     FieldLevelEncryptionProfileList
     (Maybe [FieldLevelEncryptionProfileSummary])
     (Maybe [FieldLevelEncryptionProfileSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileList' {Maybe [FieldLevelEncryptionProfileSummary]
items :: Maybe [FieldLevelEncryptionProfileSummary]
$sel:items:FieldLevelEncryptionProfileList' :: FieldLevelEncryptionProfileList
-> Maybe [FieldLevelEncryptionProfileSummary]
items} -> Maybe [FieldLevelEncryptionProfileSummary]
items) (\s :: FieldLevelEncryptionProfileList
s@FieldLevelEncryptionProfileList' {} Maybe [FieldLevelEncryptionProfileSummary]
a -> FieldLevelEncryptionProfileList
s {$sel:items:FieldLevelEncryptionProfileList' :: Maybe [FieldLevelEncryptionProfileSummary]
items = Maybe [FieldLevelEncryptionProfileSummary]
a} :: FieldLevelEncryptionProfileList) ((Maybe [FieldLevelEncryptionProfileSummary]
  -> f (Maybe [FieldLevelEncryptionProfileSummary]))
 -> FieldLevelEncryptionProfileList
 -> f FieldLevelEncryptionProfileList)
-> ((Maybe [FieldLevelEncryptionProfileSummary]
     -> f (Maybe [FieldLevelEncryptionProfileSummary]))
    -> Maybe [FieldLevelEncryptionProfileSummary]
    -> f (Maybe [FieldLevelEncryptionProfileSummary]))
-> (Maybe [FieldLevelEncryptionProfileSummary]
    -> f (Maybe [FieldLevelEncryptionProfileSummary]))
-> FieldLevelEncryptionProfileList
-> f FieldLevelEncryptionProfileList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
-> Iso
     (Maybe [FieldLevelEncryptionProfileSummary])
     (Maybe [FieldLevelEncryptionProfileSummary])
     (Maybe [FieldLevelEncryptionProfileSummary])
     (Maybe [FieldLevelEncryptionProfileSummary])
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
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
  [FieldLevelEncryptionProfileSummary]
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 profiles where you left off.
fieldLevelEncryptionProfileList_nextMarker :: Lens.Lens' FieldLevelEncryptionProfileList (Prelude.Maybe Prelude.Text)
fieldLevelEncryptionProfileList_nextMarker :: (Maybe Text -> f (Maybe Text))
-> FieldLevelEncryptionProfileList
-> f FieldLevelEncryptionProfileList
fieldLevelEncryptionProfileList_nextMarker = (FieldLevelEncryptionProfileList -> Maybe Text)
-> (FieldLevelEncryptionProfileList
    -> Maybe Text -> FieldLevelEncryptionProfileList)
-> Lens
     FieldLevelEncryptionProfileList
     FieldLevelEncryptionProfileList
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:FieldLevelEncryptionProfileList' :: FieldLevelEncryptionProfileList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: FieldLevelEncryptionProfileList
s@FieldLevelEncryptionProfileList' {} Maybe Text
a -> FieldLevelEncryptionProfileList
s {$sel:nextMarker:FieldLevelEncryptionProfileList' :: Maybe Text
nextMarker = Maybe Text
a} :: FieldLevelEncryptionProfileList)

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

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

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

instance
  Prelude.NFData
    FieldLevelEncryptionProfileList