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

import Amazonka.CloudFront.Types.FieldLevelEncryptionSummary
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

-- | 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
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]
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
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.
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'
    { $sel:items:FieldLevelEncryptionList' :: Maybe [FieldLevelEncryptionSummary]
items = forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:FieldLevelEncryptionList' :: Maybe Text
nextMarker = 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 :: Lens'
  FieldLevelEncryptionList (Maybe [FieldLevelEncryptionSummary])
fieldLevelEncryptionList_items = 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) 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

-- | 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 :: Lens' FieldLevelEncryptionList (Maybe Text)
fieldLevelEncryptionList_nextMarker = 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 :: Lens' FieldLevelEncryptionList Int
fieldLevelEncryptionList_maxItems = 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 :: Lens' FieldLevelEncryptionList Int
fieldLevelEncryptionList_quantity = 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 Data.FromXML FieldLevelEncryptionList where
  parseXML :: [Node] -> Either String FieldLevelEncryptionList
parseXML [Node]
x =
    Maybe [FieldLevelEncryptionSummary]
-> Maybe Text -> Int -> Int -> FieldLevelEncryptionList
FieldLevelEncryptionList'
      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
"FieldLevelEncryptionSummary")
                  )
      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
"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
"Quantity")

instance Prelude.Hashable FieldLevelEncryptionList where
  hashWithSalt :: Int -> FieldLevelEncryptionList -> Int
hashWithSalt Int
_salt FieldLevelEncryptionList' {Int
Maybe [FieldLevelEncryptionSummary]
Maybe Text
quantity :: Int
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [FieldLevelEncryptionSummary]
$sel:quantity:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
$sel:maxItems:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
$sel:nextMarker:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe Text
$sel:items:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe [FieldLevelEncryptionSummary]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FieldLevelEncryptionSummary]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity

instance Prelude.NFData FieldLevelEncryptionList where
  rnf :: FieldLevelEncryptionList -> ()
rnf FieldLevelEncryptionList' {Int
Maybe [FieldLevelEncryptionSummary]
Maybe Text
quantity :: Int
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [FieldLevelEncryptionSummary]
$sel:quantity:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
$sel:maxItems:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Int
$sel:nextMarker:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe Text
$sel:items:FieldLevelEncryptionList' :: FieldLevelEncryptionList -> Maybe [FieldLevelEncryptionSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [FieldLevelEncryptionSummary]
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 Int
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
quantity