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

import Amazonka.CloudFront.Types.ContentTypeProfileConfig
import Amazonka.CloudFront.Types.QueryArgProfileConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A summary of a field-level encryption item.
--
-- /See:/ 'newFieldLevelEncryptionSummary' smart constructor.
data FieldLevelEncryptionSummary = FieldLevelEncryptionSummary'
  { -- | A summary of a query argument-profile mapping.
    FieldLevelEncryptionSummary -> Maybe QueryArgProfileConfig
queryArgProfileConfig :: Prelude.Maybe QueryArgProfileConfig,
    -- | A summary of a content type-profile mapping.
    FieldLevelEncryptionSummary -> Maybe ContentTypeProfileConfig
contentTypeProfileConfig :: Prelude.Maybe ContentTypeProfileConfig,
    -- | An optional comment about the field-level encryption item. The comment
    -- cannot be longer than 128 characters.
    FieldLevelEncryptionSummary -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of a field-level encryption item.
    FieldLevelEncryptionSummary -> Text
id :: Prelude.Text,
    -- | The last time that the summary of field-level encryption items was
    -- modified.
    FieldLevelEncryptionSummary -> ISO8601
lastModifiedTime :: Core.ISO8601
  }
  deriving (FieldLevelEncryptionSummary -> FieldLevelEncryptionSummary -> Bool
(FieldLevelEncryptionSummary
 -> FieldLevelEncryptionSummary -> Bool)
-> (FieldLevelEncryptionSummary
    -> FieldLevelEncryptionSummary -> Bool)
-> Eq FieldLevelEncryptionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldLevelEncryptionSummary -> FieldLevelEncryptionSummary -> Bool
$c/= :: FieldLevelEncryptionSummary -> FieldLevelEncryptionSummary -> Bool
== :: FieldLevelEncryptionSummary -> FieldLevelEncryptionSummary -> Bool
$c== :: FieldLevelEncryptionSummary -> FieldLevelEncryptionSummary -> Bool
Prelude.Eq, ReadPrec [FieldLevelEncryptionSummary]
ReadPrec FieldLevelEncryptionSummary
Int -> ReadS FieldLevelEncryptionSummary
ReadS [FieldLevelEncryptionSummary]
(Int -> ReadS FieldLevelEncryptionSummary)
-> ReadS [FieldLevelEncryptionSummary]
-> ReadPrec FieldLevelEncryptionSummary
-> ReadPrec [FieldLevelEncryptionSummary]
-> Read FieldLevelEncryptionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldLevelEncryptionSummary]
$creadListPrec :: ReadPrec [FieldLevelEncryptionSummary]
readPrec :: ReadPrec FieldLevelEncryptionSummary
$creadPrec :: ReadPrec FieldLevelEncryptionSummary
readList :: ReadS [FieldLevelEncryptionSummary]
$creadList :: ReadS [FieldLevelEncryptionSummary]
readsPrec :: Int -> ReadS FieldLevelEncryptionSummary
$creadsPrec :: Int -> ReadS FieldLevelEncryptionSummary
Prelude.Read, Int -> FieldLevelEncryptionSummary -> ShowS
[FieldLevelEncryptionSummary] -> ShowS
FieldLevelEncryptionSummary -> String
(Int -> FieldLevelEncryptionSummary -> ShowS)
-> (FieldLevelEncryptionSummary -> String)
-> ([FieldLevelEncryptionSummary] -> ShowS)
-> Show FieldLevelEncryptionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldLevelEncryptionSummary] -> ShowS
$cshowList :: [FieldLevelEncryptionSummary] -> ShowS
show :: FieldLevelEncryptionSummary -> String
$cshow :: FieldLevelEncryptionSummary -> String
showsPrec :: Int -> FieldLevelEncryptionSummary -> ShowS
$cshowsPrec :: Int -> FieldLevelEncryptionSummary -> ShowS
Prelude.Show, (forall x.
 FieldLevelEncryptionSummary -> Rep FieldLevelEncryptionSummary x)
-> (forall x.
    Rep FieldLevelEncryptionSummary x -> FieldLevelEncryptionSummary)
-> Generic FieldLevelEncryptionSummary
forall x.
Rep FieldLevelEncryptionSummary x -> FieldLevelEncryptionSummary
forall x.
FieldLevelEncryptionSummary -> Rep FieldLevelEncryptionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FieldLevelEncryptionSummary x -> FieldLevelEncryptionSummary
$cfrom :: forall x.
FieldLevelEncryptionSummary -> Rep FieldLevelEncryptionSummary x
Prelude.Generic)

-- |
-- Create a value of 'FieldLevelEncryptionSummary' 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:
--
-- 'queryArgProfileConfig', 'fieldLevelEncryptionSummary_queryArgProfileConfig' - A summary of a query argument-profile mapping.
--
-- 'contentTypeProfileConfig', 'fieldLevelEncryptionSummary_contentTypeProfileConfig' - A summary of a content type-profile mapping.
--
-- 'comment', 'fieldLevelEncryptionSummary_comment' - An optional comment about the field-level encryption item. The comment
-- cannot be longer than 128 characters.
--
-- 'id', 'fieldLevelEncryptionSummary_id' - The unique ID of a field-level encryption item.
--
-- 'lastModifiedTime', 'fieldLevelEncryptionSummary_lastModifiedTime' - The last time that the summary of field-level encryption items was
-- modified.
newFieldLevelEncryptionSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  FieldLevelEncryptionSummary
newFieldLevelEncryptionSummary :: Text -> UTCTime -> FieldLevelEncryptionSummary
newFieldLevelEncryptionSummary
  Text
pId_
  UTCTime
pLastModifiedTime_ =
    FieldLevelEncryptionSummary' :: Maybe QueryArgProfileConfig
-> Maybe ContentTypeProfileConfig
-> Maybe Text
-> Text
-> ISO8601
-> FieldLevelEncryptionSummary
FieldLevelEncryptionSummary'
      { $sel:queryArgProfileConfig:FieldLevelEncryptionSummary' :: Maybe QueryArgProfileConfig
queryArgProfileConfig =
          Maybe QueryArgProfileConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:contentTypeProfileConfig:FieldLevelEncryptionSummary' :: Maybe ContentTypeProfileConfig
contentTypeProfileConfig = Maybe ContentTypeProfileConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:comment:FieldLevelEncryptionSummary' :: Maybe Text
comment = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:id:FieldLevelEncryptionSummary' :: Text
id = Text
pId_,
        $sel:lastModifiedTime:FieldLevelEncryptionSummary' :: 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_
      }

-- | A summary of a query argument-profile mapping.
fieldLevelEncryptionSummary_queryArgProfileConfig :: Lens.Lens' FieldLevelEncryptionSummary (Prelude.Maybe QueryArgProfileConfig)
fieldLevelEncryptionSummary_queryArgProfileConfig :: (Maybe QueryArgProfileConfig -> f (Maybe QueryArgProfileConfig))
-> FieldLevelEncryptionSummary -> f FieldLevelEncryptionSummary
fieldLevelEncryptionSummary_queryArgProfileConfig = (FieldLevelEncryptionSummary -> Maybe QueryArgProfileConfig)
-> (FieldLevelEncryptionSummary
    -> Maybe QueryArgProfileConfig -> FieldLevelEncryptionSummary)
-> Lens
     FieldLevelEncryptionSummary
     FieldLevelEncryptionSummary
     (Maybe QueryArgProfileConfig)
     (Maybe QueryArgProfileConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionSummary' {Maybe QueryArgProfileConfig
queryArgProfileConfig :: Maybe QueryArgProfileConfig
$sel:queryArgProfileConfig:FieldLevelEncryptionSummary' :: FieldLevelEncryptionSummary -> Maybe QueryArgProfileConfig
queryArgProfileConfig} -> Maybe QueryArgProfileConfig
queryArgProfileConfig) (\s :: FieldLevelEncryptionSummary
s@FieldLevelEncryptionSummary' {} Maybe QueryArgProfileConfig
a -> FieldLevelEncryptionSummary
s {$sel:queryArgProfileConfig:FieldLevelEncryptionSummary' :: Maybe QueryArgProfileConfig
queryArgProfileConfig = Maybe QueryArgProfileConfig
a} :: FieldLevelEncryptionSummary)

-- | A summary of a content type-profile mapping.
fieldLevelEncryptionSummary_contentTypeProfileConfig :: Lens.Lens' FieldLevelEncryptionSummary (Prelude.Maybe ContentTypeProfileConfig)
fieldLevelEncryptionSummary_contentTypeProfileConfig :: (Maybe ContentTypeProfileConfig
 -> f (Maybe ContentTypeProfileConfig))
-> FieldLevelEncryptionSummary -> f FieldLevelEncryptionSummary
fieldLevelEncryptionSummary_contentTypeProfileConfig = (FieldLevelEncryptionSummary -> Maybe ContentTypeProfileConfig)
-> (FieldLevelEncryptionSummary
    -> Maybe ContentTypeProfileConfig -> FieldLevelEncryptionSummary)
-> Lens
     FieldLevelEncryptionSummary
     FieldLevelEncryptionSummary
     (Maybe ContentTypeProfileConfig)
     (Maybe ContentTypeProfileConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionSummary' {Maybe ContentTypeProfileConfig
contentTypeProfileConfig :: Maybe ContentTypeProfileConfig
$sel:contentTypeProfileConfig:FieldLevelEncryptionSummary' :: FieldLevelEncryptionSummary -> Maybe ContentTypeProfileConfig
contentTypeProfileConfig} -> Maybe ContentTypeProfileConfig
contentTypeProfileConfig) (\s :: FieldLevelEncryptionSummary
s@FieldLevelEncryptionSummary' {} Maybe ContentTypeProfileConfig
a -> FieldLevelEncryptionSummary
s {$sel:contentTypeProfileConfig:FieldLevelEncryptionSummary' :: Maybe ContentTypeProfileConfig
contentTypeProfileConfig = Maybe ContentTypeProfileConfig
a} :: FieldLevelEncryptionSummary)

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

-- | The unique ID of a field-level encryption item.
fieldLevelEncryptionSummary_id :: Lens.Lens' FieldLevelEncryptionSummary Prelude.Text
fieldLevelEncryptionSummary_id :: (Text -> f Text)
-> FieldLevelEncryptionSummary -> f FieldLevelEncryptionSummary
fieldLevelEncryptionSummary_id = (FieldLevelEncryptionSummary -> Text)
-> (FieldLevelEncryptionSummary
    -> Text -> FieldLevelEncryptionSummary)
-> Lens
     FieldLevelEncryptionSummary FieldLevelEncryptionSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionSummary' {Text
id :: Text
$sel:id:FieldLevelEncryptionSummary' :: FieldLevelEncryptionSummary -> Text
id} -> Text
id) (\s :: FieldLevelEncryptionSummary
s@FieldLevelEncryptionSummary' {} Text
a -> FieldLevelEncryptionSummary
s {$sel:id:FieldLevelEncryptionSummary' :: Text
id = Text
a} :: FieldLevelEncryptionSummary)

-- | The last time that the summary of field-level encryption items was
-- modified.
fieldLevelEncryptionSummary_lastModifiedTime :: Lens.Lens' FieldLevelEncryptionSummary Prelude.UTCTime
fieldLevelEncryptionSummary_lastModifiedTime :: (UTCTime -> f UTCTime)
-> FieldLevelEncryptionSummary -> f FieldLevelEncryptionSummary
fieldLevelEncryptionSummary_lastModifiedTime = (FieldLevelEncryptionSummary -> ISO8601)
-> (FieldLevelEncryptionSummary
    -> ISO8601 -> FieldLevelEncryptionSummary)
-> Lens
     FieldLevelEncryptionSummary
     FieldLevelEncryptionSummary
     ISO8601
     ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldLevelEncryptionSummary' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:FieldLevelEncryptionSummary' :: FieldLevelEncryptionSummary -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: FieldLevelEncryptionSummary
s@FieldLevelEncryptionSummary' {} ISO8601
a -> FieldLevelEncryptionSummary
s {$sel:lastModifiedTime:FieldLevelEncryptionSummary' :: ISO8601
lastModifiedTime = ISO8601
a} :: FieldLevelEncryptionSummary) ((ISO8601 -> f ISO8601)
 -> FieldLevelEncryptionSummary -> f FieldLevelEncryptionSummary)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> FieldLevelEncryptionSummary
-> f FieldLevelEncryptionSummary
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

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

instance Prelude.Hashable FieldLevelEncryptionSummary

instance Prelude.NFData FieldLevelEncryptionSummary