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

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

-- | Details about the configuration for encryption at rest.
--
-- /See:/ 'newAwsElasticsearchDomainEncryptionAtRestOptions' smart constructor.
data AwsElasticsearchDomainEncryptionAtRestOptions = AwsElasticsearchDomainEncryptionAtRestOptions'
  { -- | Whether encryption at rest is enabled.
    AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The KMS key ID. Takes the form 1a2a3a4-1a2a-3a4a-5a6a-1a2a3a4a5a6a.
    AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsElasticsearchDomainEncryptionAtRestOptions
-> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool
(AwsElasticsearchDomainEncryptionAtRestOptions
 -> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool)
-> (AwsElasticsearchDomainEncryptionAtRestOptions
    -> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool)
-> Eq AwsElasticsearchDomainEncryptionAtRestOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElasticsearchDomainEncryptionAtRestOptions
-> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool
$c/= :: AwsElasticsearchDomainEncryptionAtRestOptions
-> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool
== :: AwsElasticsearchDomainEncryptionAtRestOptions
-> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool
$c== :: AwsElasticsearchDomainEncryptionAtRestOptions
-> AwsElasticsearchDomainEncryptionAtRestOptions -> Bool
Prelude.Eq, ReadPrec [AwsElasticsearchDomainEncryptionAtRestOptions]
ReadPrec AwsElasticsearchDomainEncryptionAtRestOptions
Int -> ReadS AwsElasticsearchDomainEncryptionAtRestOptions
ReadS [AwsElasticsearchDomainEncryptionAtRestOptions]
(Int -> ReadS AwsElasticsearchDomainEncryptionAtRestOptions)
-> ReadS [AwsElasticsearchDomainEncryptionAtRestOptions]
-> ReadPrec AwsElasticsearchDomainEncryptionAtRestOptions
-> ReadPrec [AwsElasticsearchDomainEncryptionAtRestOptions]
-> Read AwsElasticsearchDomainEncryptionAtRestOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElasticsearchDomainEncryptionAtRestOptions]
$creadListPrec :: ReadPrec [AwsElasticsearchDomainEncryptionAtRestOptions]
readPrec :: ReadPrec AwsElasticsearchDomainEncryptionAtRestOptions
$creadPrec :: ReadPrec AwsElasticsearchDomainEncryptionAtRestOptions
readList :: ReadS [AwsElasticsearchDomainEncryptionAtRestOptions]
$creadList :: ReadS [AwsElasticsearchDomainEncryptionAtRestOptions]
readsPrec :: Int -> ReadS AwsElasticsearchDomainEncryptionAtRestOptions
$creadsPrec :: Int -> ReadS AwsElasticsearchDomainEncryptionAtRestOptions
Prelude.Read, Int -> AwsElasticsearchDomainEncryptionAtRestOptions -> ShowS
[AwsElasticsearchDomainEncryptionAtRestOptions] -> ShowS
AwsElasticsearchDomainEncryptionAtRestOptions -> String
(Int -> AwsElasticsearchDomainEncryptionAtRestOptions -> ShowS)
-> (AwsElasticsearchDomainEncryptionAtRestOptions -> String)
-> ([AwsElasticsearchDomainEncryptionAtRestOptions] -> ShowS)
-> Show AwsElasticsearchDomainEncryptionAtRestOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElasticsearchDomainEncryptionAtRestOptions] -> ShowS
$cshowList :: [AwsElasticsearchDomainEncryptionAtRestOptions] -> ShowS
show :: AwsElasticsearchDomainEncryptionAtRestOptions -> String
$cshow :: AwsElasticsearchDomainEncryptionAtRestOptions -> String
showsPrec :: Int -> AwsElasticsearchDomainEncryptionAtRestOptions -> ShowS
$cshowsPrec :: Int -> AwsElasticsearchDomainEncryptionAtRestOptions -> ShowS
Prelude.Show, (forall x.
 AwsElasticsearchDomainEncryptionAtRestOptions
 -> Rep AwsElasticsearchDomainEncryptionAtRestOptions x)
-> (forall x.
    Rep AwsElasticsearchDomainEncryptionAtRestOptions x
    -> AwsElasticsearchDomainEncryptionAtRestOptions)
-> Generic AwsElasticsearchDomainEncryptionAtRestOptions
forall x.
Rep AwsElasticsearchDomainEncryptionAtRestOptions x
-> AwsElasticsearchDomainEncryptionAtRestOptions
forall x.
AwsElasticsearchDomainEncryptionAtRestOptions
-> Rep AwsElasticsearchDomainEncryptionAtRestOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElasticsearchDomainEncryptionAtRestOptions x
-> AwsElasticsearchDomainEncryptionAtRestOptions
$cfrom :: forall x.
AwsElasticsearchDomainEncryptionAtRestOptions
-> Rep AwsElasticsearchDomainEncryptionAtRestOptions x
Prelude.Generic)

-- |
-- Create a value of 'AwsElasticsearchDomainEncryptionAtRestOptions' 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:
--
-- 'enabled', 'awsElasticsearchDomainEncryptionAtRestOptions_enabled' - Whether encryption at rest is enabled.
--
-- 'kmsKeyId', 'awsElasticsearchDomainEncryptionAtRestOptions_kmsKeyId' - The KMS key ID. Takes the form 1a2a3a4-1a2a-3a4a-5a6a-1a2a3a4a5a6a.
newAwsElasticsearchDomainEncryptionAtRestOptions ::
  AwsElasticsearchDomainEncryptionAtRestOptions
newAwsElasticsearchDomainEncryptionAtRestOptions :: AwsElasticsearchDomainEncryptionAtRestOptions
newAwsElasticsearchDomainEncryptionAtRestOptions =
  AwsElasticsearchDomainEncryptionAtRestOptions' :: Maybe Bool
-> Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions
AwsElasticsearchDomainEncryptionAtRestOptions'
    { $sel:enabled:AwsElasticsearchDomainEncryptionAtRestOptions' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:AwsElasticsearchDomainEncryptionAtRestOptions' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether encryption at rest is enabled.
awsElasticsearchDomainEncryptionAtRestOptions_enabled :: Lens.Lens' AwsElasticsearchDomainEncryptionAtRestOptions (Prelude.Maybe Prelude.Bool)
awsElasticsearchDomainEncryptionAtRestOptions_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AwsElasticsearchDomainEncryptionAtRestOptions
-> f AwsElasticsearchDomainEncryptionAtRestOptions
awsElasticsearchDomainEncryptionAtRestOptions_enabled = (AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Bool)
-> (AwsElasticsearchDomainEncryptionAtRestOptions
    -> Maybe Bool -> AwsElasticsearchDomainEncryptionAtRestOptions)
-> Lens
     AwsElasticsearchDomainEncryptionAtRestOptions
     AwsElasticsearchDomainEncryptionAtRestOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainEncryptionAtRestOptions' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AwsElasticsearchDomainEncryptionAtRestOptions' :: AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AwsElasticsearchDomainEncryptionAtRestOptions
s@AwsElasticsearchDomainEncryptionAtRestOptions' {} Maybe Bool
a -> AwsElasticsearchDomainEncryptionAtRestOptions
s {$sel:enabled:AwsElasticsearchDomainEncryptionAtRestOptions' :: Maybe Bool
enabled = Maybe Bool
a} :: AwsElasticsearchDomainEncryptionAtRestOptions)

-- | The KMS key ID. Takes the form 1a2a3a4-1a2a-3a4a-5a6a-1a2a3a4a5a6a.
awsElasticsearchDomainEncryptionAtRestOptions_kmsKeyId :: Lens.Lens' AwsElasticsearchDomainEncryptionAtRestOptions (Prelude.Maybe Prelude.Text)
awsElasticsearchDomainEncryptionAtRestOptions_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> AwsElasticsearchDomainEncryptionAtRestOptions
-> f AwsElasticsearchDomainEncryptionAtRestOptions
awsElasticsearchDomainEncryptionAtRestOptions_kmsKeyId = (AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Text)
-> (AwsElasticsearchDomainEncryptionAtRestOptions
    -> Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions)
-> Lens
     AwsElasticsearchDomainEncryptionAtRestOptions
     AwsElasticsearchDomainEncryptionAtRestOptions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainEncryptionAtRestOptions' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:AwsElasticsearchDomainEncryptionAtRestOptions' :: AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: AwsElasticsearchDomainEncryptionAtRestOptions
s@AwsElasticsearchDomainEncryptionAtRestOptions' {} Maybe Text
a -> AwsElasticsearchDomainEncryptionAtRestOptions
s {$sel:kmsKeyId:AwsElasticsearchDomainEncryptionAtRestOptions' :: Maybe Text
kmsKeyId = Maybe Text
a} :: AwsElasticsearchDomainEncryptionAtRestOptions)

instance
  Core.FromJSON
    AwsElasticsearchDomainEncryptionAtRestOptions
  where
  parseJSON :: Value -> Parser AwsElasticsearchDomainEncryptionAtRestOptions
parseJSON =
    String
-> (Object -> Parser AwsElasticsearchDomainEncryptionAtRestOptions)
-> Value
-> Parser AwsElasticsearchDomainEncryptionAtRestOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsElasticsearchDomainEncryptionAtRestOptions"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions
AwsElasticsearchDomainEncryptionAtRestOptions'
            (Maybe Bool
 -> Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
              Parser
  (Maybe Text -> AwsElasticsearchDomainEncryptionAtRestOptions)
-> Parser (Maybe Text)
-> Parser AwsElasticsearchDomainEncryptionAtRestOptions
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
"KmsKeyId")
      )

instance
  Prelude.Hashable
    AwsElasticsearchDomainEncryptionAtRestOptions

instance
  Prelude.NFData
    AwsElasticsearchDomainEncryptionAtRestOptions

instance
  Core.ToJSON
    AwsElasticsearchDomainEncryptionAtRestOptions
  where
  toJSON :: AwsElasticsearchDomainEncryptionAtRestOptions -> Value
toJSON
    AwsElasticsearchDomainEncryptionAtRestOptions' {Maybe Bool
Maybe Text
kmsKeyId :: Maybe Text
enabled :: Maybe Bool
$sel:kmsKeyId:AwsElasticsearchDomainEncryptionAtRestOptions' :: AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Text
$sel:enabled:AwsElasticsearchDomainEncryptionAtRestOptions' :: AwsElasticsearchDomainEncryptionAtRestOptions -> Maybe Bool
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
              (Text
"KmsKeyId" 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
kmsKeyId
            ]
        )