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

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

-- | A complex data type for field-level encryption profiles.
--
-- /See:/ 'newFieldLevelEncryptionProfile' smart constructor.
data FieldLevelEncryptionProfile = FieldLevelEncryptionProfile'
  { -- | The ID for a field-level encryption profile configuration which includes
    -- a set of profiles that specify certain selected data fields to be
    -- encrypted by specific public keys.
    FieldLevelEncryptionProfile -> Text
id :: Prelude.Text,
    -- | The last time the field-level encryption profile was updated.
    FieldLevelEncryptionProfile -> ISO8601
lastModifiedTime :: Core.ISO8601,
    -- | A complex data type that includes the profile name and the encryption
    -- entities for the field-level encryption profile.
    FieldLevelEncryptionProfile -> FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig :: FieldLevelEncryptionProfileConfig
  }
  deriving (FieldLevelEncryptionProfile -> FieldLevelEncryptionProfile -> Bool
(FieldLevelEncryptionProfile
 -> FieldLevelEncryptionProfile -> Bool)
-> (FieldLevelEncryptionProfile
    -> FieldLevelEncryptionProfile -> Bool)
-> Eq FieldLevelEncryptionProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLevelEncryptionProfile -> FieldLevelEncryptionProfile -> Bool
$c/= :: FieldLevelEncryptionProfile -> FieldLevelEncryptionProfile -> Bool
== :: FieldLevelEncryptionProfile -> FieldLevelEncryptionProfile -> Bool
$c== :: FieldLevelEncryptionProfile -> FieldLevelEncryptionProfile -> Bool
Prelude.Eq, ReadPrec [FieldLevelEncryptionProfile]
ReadPrec FieldLevelEncryptionProfile
Int -> ReadS FieldLevelEncryptionProfile
ReadS [FieldLevelEncryptionProfile]
(Int -> ReadS FieldLevelEncryptionProfile)
-> ReadS [FieldLevelEncryptionProfile]
-> ReadPrec FieldLevelEncryptionProfile
-> ReadPrec [FieldLevelEncryptionProfile]
-> Read FieldLevelEncryptionProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldLevelEncryptionProfile]
$creadListPrec :: ReadPrec [FieldLevelEncryptionProfile]
readPrec :: ReadPrec FieldLevelEncryptionProfile
$creadPrec :: ReadPrec FieldLevelEncryptionProfile
readList :: ReadS [FieldLevelEncryptionProfile]
$creadList :: ReadS [FieldLevelEncryptionProfile]
readsPrec :: Int -> ReadS FieldLevelEncryptionProfile
$creadsPrec :: Int -> ReadS FieldLevelEncryptionProfile
Prelude.Read, Int -> FieldLevelEncryptionProfile -> ShowS
[FieldLevelEncryptionProfile] -> ShowS
FieldLevelEncryptionProfile -> String
(Int -> FieldLevelEncryptionProfile -> ShowS)
-> (FieldLevelEncryptionProfile -> String)
-> ([FieldLevelEncryptionProfile] -> ShowS)
-> Show FieldLevelEncryptionProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldLevelEncryptionProfile] -> ShowS
$cshowList :: [FieldLevelEncryptionProfile] -> ShowS
show :: FieldLevelEncryptionProfile -> String
$cshow :: FieldLevelEncryptionProfile -> String
showsPrec :: Int -> FieldLevelEncryptionProfile -> ShowS
$cshowsPrec :: Int -> FieldLevelEncryptionProfile -> ShowS
Prelude.Show, (forall x.
 FieldLevelEncryptionProfile -> Rep FieldLevelEncryptionProfile x)
-> (forall x.
    Rep FieldLevelEncryptionProfile x -> FieldLevelEncryptionProfile)
-> Generic FieldLevelEncryptionProfile
forall x.
Rep FieldLevelEncryptionProfile x -> FieldLevelEncryptionProfile
forall x.
FieldLevelEncryptionProfile -> Rep FieldLevelEncryptionProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FieldLevelEncryptionProfile x -> FieldLevelEncryptionProfile
$cfrom :: forall x.
FieldLevelEncryptionProfile -> Rep FieldLevelEncryptionProfile x
Prelude.Generic)

-- |
-- Create a value of 'FieldLevelEncryptionProfile' 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:
--
-- 'id', 'fieldLevelEncryptionProfile_id' - The ID for a field-level encryption profile configuration which includes
-- a set of profiles that specify certain selected data fields to be
-- encrypted by specific public keys.
--
-- 'lastModifiedTime', 'fieldLevelEncryptionProfile_lastModifiedTime' - The last time the field-level encryption profile was updated.
--
-- 'fieldLevelEncryptionProfileConfig', 'fieldLevelEncryptionProfile_fieldLevelEncryptionProfileConfig' - A complex data type that includes the profile name and the encryption
-- entities for the field-level encryption profile.
newFieldLevelEncryptionProfile ::
  -- | 'id'
  Prelude.Text ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  -- | 'fieldLevelEncryptionProfileConfig'
  FieldLevelEncryptionProfileConfig ->
  FieldLevelEncryptionProfile
newFieldLevelEncryptionProfile :: Text
-> UTCTime
-> FieldLevelEncryptionProfileConfig
-> FieldLevelEncryptionProfile
newFieldLevelEncryptionProfile
  Text
pId_
  UTCTime
pLastModifiedTime_
  FieldLevelEncryptionProfileConfig
pFieldLevelEncryptionProfileConfig_ =
    FieldLevelEncryptionProfile' :: Text
-> ISO8601
-> FieldLevelEncryptionProfileConfig
-> FieldLevelEncryptionProfile
FieldLevelEncryptionProfile'
      { $sel:id:FieldLevelEncryptionProfile' :: Text
id = Text
pId_,
        $sel:lastModifiedTime:FieldLevelEncryptionProfile' :: 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:fieldLevelEncryptionProfileConfig:FieldLevelEncryptionProfile' :: FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig =
          FieldLevelEncryptionProfileConfig
pFieldLevelEncryptionProfileConfig_
      }

-- | The ID for a field-level encryption profile configuration which includes
-- a set of profiles that specify certain selected data fields to be
-- encrypted by specific public keys.
fieldLevelEncryptionProfile_id :: Lens.Lens' FieldLevelEncryptionProfile Prelude.Text
fieldLevelEncryptionProfile_id :: (Text -> f Text)
-> FieldLevelEncryptionProfile -> f FieldLevelEncryptionProfile
fieldLevelEncryptionProfile_id = (FieldLevelEncryptionProfile -> Text)
-> (FieldLevelEncryptionProfile
    -> Text -> FieldLevelEncryptionProfile)
-> Lens
     FieldLevelEncryptionProfile FieldLevelEncryptionProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfile' {Text
id :: Text
$sel:id:FieldLevelEncryptionProfile' :: FieldLevelEncryptionProfile -> Text
id} -> Text
id) (\s :: FieldLevelEncryptionProfile
s@FieldLevelEncryptionProfile' {} Text
a -> FieldLevelEncryptionProfile
s {$sel:id:FieldLevelEncryptionProfile' :: Text
id = Text
a} :: FieldLevelEncryptionProfile)

-- | The last time the field-level encryption profile was updated.
fieldLevelEncryptionProfile_lastModifiedTime :: Lens.Lens' FieldLevelEncryptionProfile Prelude.UTCTime
fieldLevelEncryptionProfile_lastModifiedTime :: (UTCTime -> f UTCTime)
-> FieldLevelEncryptionProfile -> f FieldLevelEncryptionProfile
fieldLevelEncryptionProfile_lastModifiedTime = (FieldLevelEncryptionProfile -> ISO8601)
-> (FieldLevelEncryptionProfile
    -> ISO8601 -> FieldLevelEncryptionProfile)
-> Lens
     FieldLevelEncryptionProfile
     FieldLevelEncryptionProfile
     ISO8601
     ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfile' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:FieldLevelEncryptionProfile' :: FieldLevelEncryptionProfile -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: FieldLevelEncryptionProfile
s@FieldLevelEncryptionProfile' {} ISO8601
a -> FieldLevelEncryptionProfile
s {$sel:lastModifiedTime:FieldLevelEncryptionProfile' :: ISO8601
lastModifiedTime = ISO8601
a} :: FieldLevelEncryptionProfile) ((ISO8601 -> f ISO8601)
 -> FieldLevelEncryptionProfile -> f FieldLevelEncryptionProfile)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> FieldLevelEncryptionProfile
-> f FieldLevelEncryptionProfile
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

-- | A complex data type that includes the profile name and the encryption
-- entities for the field-level encryption profile.
fieldLevelEncryptionProfile_fieldLevelEncryptionProfileConfig :: Lens.Lens' FieldLevelEncryptionProfile FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfile_fieldLevelEncryptionProfileConfig :: (FieldLevelEncryptionProfileConfig
 -> f FieldLevelEncryptionProfileConfig)
-> FieldLevelEncryptionProfile -> f FieldLevelEncryptionProfile
fieldLevelEncryptionProfile_fieldLevelEncryptionProfileConfig = (FieldLevelEncryptionProfile -> FieldLevelEncryptionProfileConfig)
-> (FieldLevelEncryptionProfile
    -> FieldLevelEncryptionProfileConfig
    -> FieldLevelEncryptionProfile)
-> Lens
     FieldLevelEncryptionProfile
     FieldLevelEncryptionProfile
     FieldLevelEncryptionProfileConfig
     FieldLevelEncryptionProfileConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionProfile' {FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig :: FieldLevelEncryptionProfileConfig
$sel:fieldLevelEncryptionProfileConfig:FieldLevelEncryptionProfile' :: FieldLevelEncryptionProfile -> FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig} -> FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig) (\s :: FieldLevelEncryptionProfile
s@FieldLevelEncryptionProfile' {} FieldLevelEncryptionProfileConfig
a -> FieldLevelEncryptionProfile
s {$sel:fieldLevelEncryptionProfileConfig:FieldLevelEncryptionProfile' :: FieldLevelEncryptionProfileConfig
fieldLevelEncryptionProfileConfig = FieldLevelEncryptionProfileConfig
a} :: FieldLevelEncryptionProfile)

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

instance Prelude.Hashable FieldLevelEncryptionProfile

instance Prelude.NFData FieldLevelEncryptionProfile