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

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

-- | The field-level encryption profile summary.
--
-- /See:/ 'newFieldLevelEncryptionProfileSummary' smart constructor.
data FieldLevelEncryptionProfileSummary = FieldLevelEncryptionProfileSummary'
  { -- | An optional comment for the field-level encryption profile summary. The
    -- comment cannot be longer than 128 characters.
    FieldLevelEncryptionProfileSummary -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | ID for the field-level encryption profile summary.
    FieldLevelEncryptionProfileSummary -> Text
id :: Prelude.Text,
    -- | The time when the the field-level encryption profile summary was last
    -- updated.
    FieldLevelEncryptionProfileSummary -> ISO8601
lastModifiedTime :: Core.ISO8601,
    -- | Name for the field-level encryption profile summary.
    FieldLevelEncryptionProfileSummary -> Text
name :: Prelude.Text,
    -- | A complex data type of encryption entities for the field-level
    -- encryption profile that include the public key ID, provider, and field
    -- patterns for specifying which fields to encrypt with this key.
    FieldLevelEncryptionProfileSummary -> EncryptionEntities
encryptionEntities :: EncryptionEntities
  }
  deriving (FieldLevelEncryptionProfileSummary
-> FieldLevelEncryptionProfileSummary -> Bool
(FieldLevelEncryptionProfileSummary
 -> FieldLevelEncryptionProfileSummary -> Bool)
-> (FieldLevelEncryptionProfileSummary
    -> FieldLevelEncryptionProfileSummary -> Bool)
-> Eq FieldLevelEncryptionProfileSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLevelEncryptionProfileSummary
-> FieldLevelEncryptionProfileSummary -> Bool
$c/= :: FieldLevelEncryptionProfileSummary
-> FieldLevelEncryptionProfileSummary -> Bool
== :: FieldLevelEncryptionProfileSummary
-> FieldLevelEncryptionProfileSummary -> Bool
$c== :: FieldLevelEncryptionProfileSummary
-> FieldLevelEncryptionProfileSummary -> Bool
Prelude.Eq, ReadPrec [FieldLevelEncryptionProfileSummary]
ReadPrec FieldLevelEncryptionProfileSummary
Int -> ReadS FieldLevelEncryptionProfileSummary
ReadS [FieldLevelEncryptionProfileSummary]
(Int -> ReadS FieldLevelEncryptionProfileSummary)
-> ReadS [FieldLevelEncryptionProfileSummary]
-> ReadPrec FieldLevelEncryptionProfileSummary
-> ReadPrec [FieldLevelEncryptionProfileSummary]
-> Read FieldLevelEncryptionProfileSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldLevelEncryptionProfileSummary]
$creadListPrec :: ReadPrec [FieldLevelEncryptionProfileSummary]
readPrec :: ReadPrec FieldLevelEncryptionProfileSummary
$creadPrec :: ReadPrec FieldLevelEncryptionProfileSummary
readList :: ReadS [FieldLevelEncryptionProfileSummary]
$creadList :: ReadS [FieldLevelEncryptionProfileSummary]
readsPrec :: Int -> ReadS FieldLevelEncryptionProfileSummary
$creadsPrec :: Int -> ReadS FieldLevelEncryptionProfileSummary
Prelude.Read, Int -> FieldLevelEncryptionProfileSummary -> ShowS
[FieldLevelEncryptionProfileSummary] -> ShowS
FieldLevelEncryptionProfileSummary -> String
(Int -> FieldLevelEncryptionProfileSummary -> ShowS)
-> (FieldLevelEncryptionProfileSummary -> String)
-> ([FieldLevelEncryptionProfileSummary] -> ShowS)
-> Show FieldLevelEncryptionProfileSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldLevelEncryptionProfileSummary] -> ShowS
$cshowList :: [FieldLevelEncryptionProfileSummary] -> ShowS
show :: FieldLevelEncryptionProfileSummary -> String
$cshow :: FieldLevelEncryptionProfileSummary -> String
showsPrec :: Int -> FieldLevelEncryptionProfileSummary -> ShowS
$cshowsPrec :: Int -> FieldLevelEncryptionProfileSummary -> ShowS
Prelude.Show, (forall x.
 FieldLevelEncryptionProfileSummary
 -> Rep FieldLevelEncryptionProfileSummary x)
-> (forall x.
    Rep FieldLevelEncryptionProfileSummary x
    -> FieldLevelEncryptionProfileSummary)
-> Generic FieldLevelEncryptionProfileSummary
forall x.
Rep FieldLevelEncryptionProfileSummary x
-> FieldLevelEncryptionProfileSummary
forall x.
FieldLevelEncryptionProfileSummary
-> Rep FieldLevelEncryptionProfileSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FieldLevelEncryptionProfileSummary x
-> FieldLevelEncryptionProfileSummary
$cfrom :: forall x.
FieldLevelEncryptionProfileSummary
-> Rep FieldLevelEncryptionProfileSummary x
Prelude.Generic)

-- |
-- Create a value of 'FieldLevelEncryptionProfileSummary' 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:
--
-- 'comment', 'fieldLevelEncryptionProfileSummary_comment' - An optional comment for the field-level encryption profile summary. The
-- comment cannot be longer than 128 characters.
--
-- 'id', 'fieldLevelEncryptionProfileSummary_id' - ID for the field-level encryption profile summary.
--
-- 'lastModifiedTime', 'fieldLevelEncryptionProfileSummary_lastModifiedTime' - The time when the the field-level encryption profile summary was last
-- updated.
--
-- 'name', 'fieldLevelEncryptionProfileSummary_name' - Name for the field-level encryption profile summary.
--
-- 'encryptionEntities', 'fieldLevelEncryptionProfileSummary_encryptionEntities' - A complex data type of encryption entities for the field-level
-- encryption profile that include the public key ID, provider, and field
-- patterns for specifying which fields to encrypt with this key.
newFieldLevelEncryptionProfileSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  -- | 'name'
  Prelude.Text ->
  -- | 'encryptionEntities'
  EncryptionEntities ->
  FieldLevelEncryptionProfileSummary
newFieldLevelEncryptionProfileSummary :: Text
-> UTCTime
-> Text
-> EncryptionEntities
-> FieldLevelEncryptionProfileSummary
newFieldLevelEncryptionProfileSummary
  Text
pId_
  UTCTime
pLastModifiedTime_
  Text
pName_
  EncryptionEntities
pEncryptionEntities_ =
    FieldLevelEncryptionProfileSummary' :: Maybe Text
-> Text
-> ISO8601
-> Text
-> EncryptionEntities
-> FieldLevelEncryptionProfileSummary
FieldLevelEncryptionProfileSummary'
      { $sel:comment:FieldLevelEncryptionProfileSummary' :: Maybe Text
comment =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:id:FieldLevelEncryptionProfileSummary' :: Text
id = Text
pId_,
        $sel:lastModifiedTime:FieldLevelEncryptionProfileSummary' :: ISO8601
lastModifiedTime =
          Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_,
        $sel:name:FieldLevelEncryptionProfileSummary' :: Text
name = Text
pName_,
        $sel:encryptionEntities:FieldLevelEncryptionProfileSummary' :: EncryptionEntities
encryptionEntities =
          EncryptionEntities
pEncryptionEntities_
      }

-- | An optional comment for the field-level encryption profile summary. The
-- comment cannot be longer than 128 characters.
fieldLevelEncryptionProfileSummary_comment :: Lens.Lens' FieldLevelEncryptionProfileSummary (Prelude.Maybe Prelude.Text)
fieldLevelEncryptionProfileSummary_comment :: (Maybe Text -> f (Maybe Text))
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
fieldLevelEncryptionProfileSummary_comment = (FieldLevelEncryptionProfileSummary -> Maybe Text)
-> (FieldLevelEncryptionProfileSummary
    -> Maybe Text -> FieldLevelEncryptionProfileSummary)
-> Lens
     FieldLevelEncryptionProfileSummary
     FieldLevelEncryptionProfileSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileSummary' {Maybe Text
comment :: Maybe Text
$sel:comment:FieldLevelEncryptionProfileSummary' :: FieldLevelEncryptionProfileSummary -> Maybe Text
comment} -> Maybe Text
comment) (\s :: FieldLevelEncryptionProfileSummary
s@FieldLevelEncryptionProfileSummary' {} Maybe Text
a -> FieldLevelEncryptionProfileSummary
s {$sel:comment:FieldLevelEncryptionProfileSummary' :: Maybe Text
comment = Maybe Text
a} :: FieldLevelEncryptionProfileSummary)

-- | ID for the field-level encryption profile summary.
fieldLevelEncryptionProfileSummary_id :: Lens.Lens' FieldLevelEncryptionProfileSummary Prelude.Text
fieldLevelEncryptionProfileSummary_id :: (Text -> f Text)
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
fieldLevelEncryptionProfileSummary_id = (FieldLevelEncryptionProfileSummary -> Text)
-> (FieldLevelEncryptionProfileSummary
    -> Text -> FieldLevelEncryptionProfileSummary)
-> Lens
     FieldLevelEncryptionProfileSummary
     FieldLevelEncryptionProfileSummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileSummary' {Text
id :: Text
$sel:id:FieldLevelEncryptionProfileSummary' :: FieldLevelEncryptionProfileSummary -> Text
id} -> Text
id) (\s :: FieldLevelEncryptionProfileSummary
s@FieldLevelEncryptionProfileSummary' {} Text
a -> FieldLevelEncryptionProfileSummary
s {$sel:id:FieldLevelEncryptionProfileSummary' :: Text
id = Text
a} :: FieldLevelEncryptionProfileSummary)

-- | The time when the the field-level encryption profile summary was last
-- updated.
fieldLevelEncryptionProfileSummary_lastModifiedTime :: Lens.Lens' FieldLevelEncryptionProfileSummary Prelude.UTCTime
fieldLevelEncryptionProfileSummary_lastModifiedTime :: (UTCTime -> f UTCTime)
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
fieldLevelEncryptionProfileSummary_lastModifiedTime = (FieldLevelEncryptionProfileSummary -> ISO8601)
-> (FieldLevelEncryptionProfileSummary
    -> ISO8601 -> FieldLevelEncryptionProfileSummary)
-> Lens
     FieldLevelEncryptionProfileSummary
     FieldLevelEncryptionProfileSummary
     ISO8601
     ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileSummary' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:FieldLevelEncryptionProfileSummary' :: FieldLevelEncryptionProfileSummary -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: FieldLevelEncryptionProfileSummary
s@FieldLevelEncryptionProfileSummary' {} ISO8601
a -> FieldLevelEncryptionProfileSummary
s {$sel:lastModifiedTime:FieldLevelEncryptionProfileSummary' :: ISO8601
lastModifiedTime = ISO8601
a} :: FieldLevelEncryptionProfileSummary) ((ISO8601 -> f ISO8601)
 -> FieldLevelEncryptionProfileSummary
 -> f FieldLevelEncryptionProfileSummary)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Name for the field-level encryption profile summary.
fieldLevelEncryptionProfileSummary_name :: Lens.Lens' FieldLevelEncryptionProfileSummary Prelude.Text
fieldLevelEncryptionProfileSummary_name :: (Text -> f Text)
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
fieldLevelEncryptionProfileSummary_name = (FieldLevelEncryptionProfileSummary -> Text)
-> (FieldLevelEncryptionProfileSummary
    -> Text -> FieldLevelEncryptionProfileSummary)
-> Lens
     FieldLevelEncryptionProfileSummary
     FieldLevelEncryptionProfileSummary
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileSummary' {Text
name :: Text
$sel:name:FieldLevelEncryptionProfileSummary' :: FieldLevelEncryptionProfileSummary -> Text
name} -> Text
name) (\s :: FieldLevelEncryptionProfileSummary
s@FieldLevelEncryptionProfileSummary' {} Text
a -> FieldLevelEncryptionProfileSummary
s {$sel:name:FieldLevelEncryptionProfileSummary' :: Text
name = Text
a} :: FieldLevelEncryptionProfileSummary)

-- | A complex data type of encryption entities for the field-level
-- encryption profile that include the public key ID, provider, and field
-- patterns for specifying which fields to encrypt with this key.
fieldLevelEncryptionProfileSummary_encryptionEntities :: Lens.Lens' FieldLevelEncryptionProfileSummary EncryptionEntities
fieldLevelEncryptionProfileSummary_encryptionEntities :: (EncryptionEntities -> f EncryptionEntities)
-> FieldLevelEncryptionProfileSummary
-> f FieldLevelEncryptionProfileSummary
fieldLevelEncryptionProfileSummary_encryptionEntities = (FieldLevelEncryptionProfileSummary -> EncryptionEntities)
-> (FieldLevelEncryptionProfileSummary
    -> EncryptionEntities -> FieldLevelEncryptionProfileSummary)
-> Lens
     FieldLevelEncryptionProfileSummary
     FieldLevelEncryptionProfileSummary
     EncryptionEntities
     EncryptionEntities
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfileSummary' {EncryptionEntities
encryptionEntities :: EncryptionEntities
$sel:encryptionEntities:FieldLevelEncryptionProfileSummary' :: FieldLevelEncryptionProfileSummary -> EncryptionEntities
encryptionEntities} -> EncryptionEntities
encryptionEntities) (\s :: FieldLevelEncryptionProfileSummary
s@FieldLevelEncryptionProfileSummary' {} EncryptionEntities
a -> FieldLevelEncryptionProfileSummary
s {$sel:encryptionEntities:FieldLevelEncryptionProfileSummary' :: EncryptionEntities
encryptionEntities = EncryptionEntities
a} :: FieldLevelEncryptionProfileSummary)

instance
  Core.FromXML
    FieldLevelEncryptionProfileSummary
  where
  parseXML :: [Node] -> Either String FieldLevelEncryptionProfileSummary
parseXML [Node]
x =
    Maybe Text
-> Text
-> ISO8601
-> Text
-> EncryptionEntities
-> FieldLevelEncryptionProfileSummary
FieldLevelEncryptionProfileSummary'
      (Maybe Text
 -> Text
 -> ISO8601
 -> Text
 -> EncryptionEntities
 -> FieldLevelEncryptionProfileSummary)
-> Either String (Maybe Text)
-> Either
     String
     (Text
      -> ISO8601
      -> Text
      -> EncryptionEntities
      -> FieldLevelEncryptionProfileSummary)
forall (f :: * -> *) a b. Functor 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
"Comment")
      Either
  String
  (Text
   -> ISO8601
   -> Text
   -> EncryptionEntities
   -> FieldLevelEncryptionProfileSummary)
-> Either String Text
-> Either
     String
     (ISO8601
      -> Text
      -> EncryptionEntities
      -> FieldLevelEncryptionProfileSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either
  String
  (ISO8601
   -> Text
   -> EncryptionEntities
   -> FieldLevelEncryptionProfileSummary)
-> Either String ISO8601
-> Either
     String
     (Text -> EncryptionEntities -> FieldLevelEncryptionProfileSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LastModifiedTime")
      Either
  String
  (Text -> EncryptionEntities -> FieldLevelEncryptionProfileSummary)
-> Either String Text
-> Either
     String (EncryptionEntities -> FieldLevelEncryptionProfileSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Name")
      Either
  String (EncryptionEntities -> FieldLevelEncryptionProfileSummary)
-> Either String EncryptionEntities
-> Either String FieldLevelEncryptionProfileSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String EncryptionEntities
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"EncryptionEntities")

instance
  Prelude.Hashable
    FieldLevelEncryptionProfileSummary

instance
  Prelude.NFData
    FieldLevelEncryptionProfileSummary