{-# 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.SecurityHub.Types.AwsDynamoDbTableSseDescription
-- 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.SecurityHub.Types.AwsDynamoDbTableSseDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the server-side encryption for the table.
--
-- /See:/ 'newAwsDynamoDbTableSseDescription' smart constructor.
data AwsDynamoDbTableSseDescription = AwsDynamoDbTableSseDescription'
  { -- | The status of the server-side encryption.
    AwsDynamoDbTableSseDescription -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | If the key is inaccessible, the date and time when DynamoDB detected
    -- that the key was inaccessible.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsDynamoDbTableSseDescription -> Maybe Text
inaccessibleEncryptionDateTime :: Prelude.Maybe Prelude.Text,
    -- | The type of server-side encryption.
    AwsDynamoDbTableSseDescription -> Maybe Text
sseType :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the KMS key that is used for the KMS encryption.
    AwsDynamoDbTableSseDescription -> Maybe Text
kmsMasterKeyArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsDynamoDbTableSseDescription
-> AwsDynamoDbTableSseDescription -> Bool
(AwsDynamoDbTableSseDescription
 -> AwsDynamoDbTableSseDescription -> Bool)
-> (AwsDynamoDbTableSseDescription
    -> AwsDynamoDbTableSseDescription -> Bool)
-> Eq AwsDynamoDbTableSseDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsDynamoDbTableSseDescription
-> AwsDynamoDbTableSseDescription -> Bool
$c/= :: AwsDynamoDbTableSseDescription
-> AwsDynamoDbTableSseDescription -> Bool
== :: AwsDynamoDbTableSseDescription
-> AwsDynamoDbTableSseDescription -> Bool
$c== :: AwsDynamoDbTableSseDescription
-> AwsDynamoDbTableSseDescription -> Bool
Prelude.Eq, ReadPrec [AwsDynamoDbTableSseDescription]
ReadPrec AwsDynamoDbTableSseDescription
Int -> ReadS AwsDynamoDbTableSseDescription
ReadS [AwsDynamoDbTableSseDescription]
(Int -> ReadS AwsDynamoDbTableSseDescription)
-> ReadS [AwsDynamoDbTableSseDescription]
-> ReadPrec AwsDynamoDbTableSseDescription
-> ReadPrec [AwsDynamoDbTableSseDescription]
-> Read AwsDynamoDbTableSseDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsDynamoDbTableSseDescription]
$creadListPrec :: ReadPrec [AwsDynamoDbTableSseDescription]
readPrec :: ReadPrec AwsDynamoDbTableSseDescription
$creadPrec :: ReadPrec AwsDynamoDbTableSseDescription
readList :: ReadS [AwsDynamoDbTableSseDescription]
$creadList :: ReadS [AwsDynamoDbTableSseDescription]
readsPrec :: Int -> ReadS AwsDynamoDbTableSseDescription
$creadsPrec :: Int -> ReadS AwsDynamoDbTableSseDescription
Prelude.Read, Int -> AwsDynamoDbTableSseDescription -> ShowS
[AwsDynamoDbTableSseDescription] -> ShowS
AwsDynamoDbTableSseDescription -> String
(Int -> AwsDynamoDbTableSseDescription -> ShowS)
-> (AwsDynamoDbTableSseDescription -> String)
-> ([AwsDynamoDbTableSseDescription] -> ShowS)
-> Show AwsDynamoDbTableSseDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsDynamoDbTableSseDescription] -> ShowS
$cshowList :: [AwsDynamoDbTableSseDescription] -> ShowS
show :: AwsDynamoDbTableSseDescription -> String
$cshow :: AwsDynamoDbTableSseDescription -> String
showsPrec :: Int -> AwsDynamoDbTableSseDescription -> ShowS
$cshowsPrec :: Int -> AwsDynamoDbTableSseDescription -> ShowS
Prelude.Show, (forall x.
 AwsDynamoDbTableSseDescription
 -> Rep AwsDynamoDbTableSseDescription x)
-> (forall x.
    Rep AwsDynamoDbTableSseDescription x
    -> AwsDynamoDbTableSseDescription)
-> Generic AwsDynamoDbTableSseDescription
forall x.
Rep AwsDynamoDbTableSseDescription x
-> AwsDynamoDbTableSseDescription
forall x.
AwsDynamoDbTableSseDescription
-> Rep AwsDynamoDbTableSseDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsDynamoDbTableSseDescription x
-> AwsDynamoDbTableSseDescription
$cfrom :: forall x.
AwsDynamoDbTableSseDescription
-> Rep AwsDynamoDbTableSseDescription x
Prelude.Generic)

-- |
-- Create a value of 'AwsDynamoDbTableSseDescription' 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:
--
-- 'status', 'awsDynamoDbTableSseDescription_status' - The status of the server-side encryption.
--
-- 'inaccessibleEncryptionDateTime', 'awsDynamoDbTableSseDescription_inaccessibleEncryptionDateTime' - If the key is inaccessible, the date and time when DynamoDB detected
-- that the key was inaccessible.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'sseType', 'awsDynamoDbTableSseDescription_sseType' - The type of server-side encryption.
--
-- 'kmsMasterKeyArn', 'awsDynamoDbTableSseDescription_kmsMasterKeyArn' - The ARN of the KMS key that is used for the KMS encryption.
newAwsDynamoDbTableSseDescription ::
  AwsDynamoDbTableSseDescription
newAwsDynamoDbTableSseDescription :: AwsDynamoDbTableSseDescription
newAwsDynamoDbTableSseDescription =
  AwsDynamoDbTableSseDescription' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsDynamoDbTableSseDescription
AwsDynamoDbTableSseDescription'
    { $sel:status:AwsDynamoDbTableSseDescription' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inaccessibleEncryptionDateTime:AwsDynamoDbTableSseDescription' :: Maybe Text
inaccessibleEncryptionDateTime =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sseType:AwsDynamoDbTableSseDescription' :: Maybe Text
sseType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsMasterKeyArn:AwsDynamoDbTableSseDescription' :: Maybe Text
kmsMasterKeyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the server-side encryption.
awsDynamoDbTableSseDescription_status :: Lens.Lens' AwsDynamoDbTableSseDescription (Prelude.Maybe Prelude.Text)
awsDynamoDbTableSseDescription_status :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableSseDescription
-> f AwsDynamoDbTableSseDescription
awsDynamoDbTableSseDescription_status = (AwsDynamoDbTableSseDescription -> Maybe Text)
-> (AwsDynamoDbTableSseDescription
    -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Lens
     AwsDynamoDbTableSseDescription
     AwsDynamoDbTableSseDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableSseDescription' {Maybe Text
status :: Maybe Text
$sel:status:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
status} -> Maybe Text
status) (\s :: AwsDynamoDbTableSseDescription
s@AwsDynamoDbTableSseDescription' {} Maybe Text
a -> AwsDynamoDbTableSseDescription
s {$sel:status:AwsDynamoDbTableSseDescription' :: Maybe Text
status = Maybe Text
a} :: AwsDynamoDbTableSseDescription)

-- | If the key is inaccessible, the date and time when DynamoDB detected
-- that the key was inaccessible.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsDynamoDbTableSseDescription_inaccessibleEncryptionDateTime :: Lens.Lens' AwsDynamoDbTableSseDescription (Prelude.Maybe Prelude.Text)
awsDynamoDbTableSseDescription_inaccessibleEncryptionDateTime :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableSseDescription
-> f AwsDynamoDbTableSseDescription
awsDynamoDbTableSseDescription_inaccessibleEncryptionDateTime = (AwsDynamoDbTableSseDescription -> Maybe Text)
-> (AwsDynamoDbTableSseDescription
    -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Lens
     AwsDynamoDbTableSseDescription
     AwsDynamoDbTableSseDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableSseDescription' {Maybe Text
inaccessibleEncryptionDateTime :: Maybe Text
$sel:inaccessibleEncryptionDateTime:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
inaccessibleEncryptionDateTime} -> Maybe Text
inaccessibleEncryptionDateTime) (\s :: AwsDynamoDbTableSseDescription
s@AwsDynamoDbTableSseDescription' {} Maybe Text
a -> AwsDynamoDbTableSseDescription
s {$sel:inaccessibleEncryptionDateTime:AwsDynamoDbTableSseDescription' :: Maybe Text
inaccessibleEncryptionDateTime = Maybe Text
a} :: AwsDynamoDbTableSseDescription)

-- | The type of server-side encryption.
awsDynamoDbTableSseDescription_sseType :: Lens.Lens' AwsDynamoDbTableSseDescription (Prelude.Maybe Prelude.Text)
awsDynamoDbTableSseDescription_sseType :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableSseDescription
-> f AwsDynamoDbTableSseDescription
awsDynamoDbTableSseDescription_sseType = (AwsDynamoDbTableSseDescription -> Maybe Text)
-> (AwsDynamoDbTableSseDescription
    -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Lens
     AwsDynamoDbTableSseDescription
     AwsDynamoDbTableSseDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableSseDescription' {Maybe Text
sseType :: Maybe Text
$sel:sseType:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
sseType} -> Maybe Text
sseType) (\s :: AwsDynamoDbTableSseDescription
s@AwsDynamoDbTableSseDescription' {} Maybe Text
a -> AwsDynamoDbTableSseDescription
s {$sel:sseType:AwsDynamoDbTableSseDescription' :: Maybe Text
sseType = Maybe Text
a} :: AwsDynamoDbTableSseDescription)

-- | The ARN of the KMS key that is used for the KMS encryption.
awsDynamoDbTableSseDescription_kmsMasterKeyArn :: Lens.Lens' AwsDynamoDbTableSseDescription (Prelude.Maybe Prelude.Text)
awsDynamoDbTableSseDescription_kmsMasterKeyArn :: (Maybe Text -> f (Maybe Text))
-> AwsDynamoDbTableSseDescription
-> f AwsDynamoDbTableSseDescription
awsDynamoDbTableSseDescription_kmsMasterKeyArn = (AwsDynamoDbTableSseDescription -> Maybe Text)
-> (AwsDynamoDbTableSseDescription
    -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Lens
     AwsDynamoDbTableSseDescription
     AwsDynamoDbTableSseDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsDynamoDbTableSseDescription' {Maybe Text
kmsMasterKeyArn :: Maybe Text
$sel:kmsMasterKeyArn:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
kmsMasterKeyArn} -> Maybe Text
kmsMasterKeyArn) (\s :: AwsDynamoDbTableSseDescription
s@AwsDynamoDbTableSseDescription' {} Maybe Text
a -> AwsDynamoDbTableSseDescription
s {$sel:kmsMasterKeyArn:AwsDynamoDbTableSseDescription' :: Maybe Text
kmsMasterKeyArn = Maybe Text
a} :: AwsDynamoDbTableSseDescription)

instance Core.FromJSON AwsDynamoDbTableSseDescription where
  parseJSON :: Value -> Parser AwsDynamoDbTableSseDescription
parseJSON =
    String
-> (Object -> Parser AwsDynamoDbTableSseDescription)
-> Value
-> Parser AwsDynamoDbTableSseDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsDynamoDbTableSseDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsDynamoDbTableSseDescription
AwsDynamoDbTableSseDescription'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AwsDynamoDbTableSseDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> AwsDynamoDbTableSseDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AwsDynamoDbTableSseDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InaccessibleEncryptionDateTime")
            Parser (Maybe Text -> Maybe Text -> AwsDynamoDbTableSseDescription)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsDynamoDbTableSseDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SseType")
            Parser (Maybe Text -> AwsDynamoDbTableSseDescription)
-> Parser (Maybe Text) -> Parser AwsDynamoDbTableSseDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KmsMasterKeyArn")
      )

instance
  Prelude.Hashable
    AwsDynamoDbTableSseDescription

instance
  Prelude.NFData
    AwsDynamoDbTableSseDescription

instance Core.ToJSON AwsDynamoDbTableSseDescription where
  toJSON :: AwsDynamoDbTableSseDescription -> Value
toJSON AwsDynamoDbTableSseDescription' {Maybe Text
kmsMasterKeyArn :: Maybe Text
sseType :: Maybe Text
inaccessibleEncryptionDateTime :: Maybe Text
status :: Maybe Text
$sel:kmsMasterKeyArn:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
$sel:sseType:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
$sel:inaccessibleEncryptionDateTime:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
$sel:status:AwsDynamoDbTableSseDescription' :: AwsDynamoDbTableSseDescription -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"InaccessibleEncryptionDateTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
inaccessibleEncryptionDateTime,
            (Text
"SseType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sseType,
            (Text
"KmsMasterKeyArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsMasterKeyArn
          ]
      )