{-# 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.AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-- 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.AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails 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 for the
-- OpenSearch domain.
--
-- /See:/ 'newAwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' smart constructor.
data AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails = AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails'
  { -- | Whether encryption at rest is enabled.
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The KMS key ID.
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Bool
(AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
 -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
 -> Bool)
-> (AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
    -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
    -> Bool)
-> Eq AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Bool
$c/= :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Bool
== :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Bool
$c== :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Bool
Prelude.Eq, ReadPrec [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
ReadPrec AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
Int
-> ReadS AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
ReadS [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
(Int
 -> ReadS AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> ReadS [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
-> ReadPrec
     AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> ReadPrec
     [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
-> Read AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
$creadListPrec :: ReadPrec [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
readPrec :: ReadPrec AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
$creadPrec :: ReadPrec AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
readList :: ReadS [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
$creadList :: ReadS [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
readsPrec :: Int
-> ReadS AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
$creadsPrec :: Int
-> ReadS AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
Prelude.Read, Int
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> ShowS
[AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails] -> ShowS
AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> String
(Int
 -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
 -> ShowS)
-> (AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
    -> String)
-> ([AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails]
    -> ShowS)
-> Show AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails] -> ShowS
$cshowList :: [AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails] -> ShowS
show :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> String
$cshow :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> String
showsPrec :: Int
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> ShowS
$cshowsPrec :: Int
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> ShowS
Prelude.Show, (forall x.
 AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
 -> Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x)
-> (forall x.
    Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x
    -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> Generic AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall x.
Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall x.
AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
$cfrom :: forall x.
AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Rep AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' 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', 'awsOpenSearchServiceDomainEncryptionAtRestOptionsDetails_enabled' - Whether encryption at rest is enabled.
--
-- 'kmsKeyId', 'awsOpenSearchServiceDomainEncryptionAtRestOptionsDetails_kmsKeyId' - The KMS key ID.
newAwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails ::
  AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
newAwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
newAwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails =
  AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: Maybe Bool
-> Maybe Text
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails'
    { $sel:enabled:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: Maybe Text
kmsKeyId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The KMS key ID.
awsOpenSearchServiceDomainEncryptionAtRestOptionsDetails_kmsKeyId :: Lens.Lens' AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails (Prelude.Maybe Prelude.Text)
awsOpenSearchServiceDomainEncryptionAtRestOptionsDetails_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> f AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
awsOpenSearchServiceDomainEncryptionAtRestOptionsDetails_kmsKeyId = (AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
 -> Maybe Text)
-> (AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
    -> Maybe Text
    -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> Lens
     AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
     AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
s@AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' {} Maybe Text
a -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
s {$sel:kmsKeyId:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: Maybe Text
kmsKeyId = Maybe Text
a} :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)

instance
  Core.FromJSON
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
  where
  parseJSON :: Value
-> Parser AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
parseJSON =
    String
-> (Object
    -> Parser AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> Value
-> Parser AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails"
      ( \Object
x ->
          Maybe Bool
-> Maybe Text
-> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails'
            (Maybe Bool
 -> Maybe Text
 -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
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
   -> AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails)
-> Parser (Maybe Text)
-> Parser AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
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
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails

instance
  Prelude.NFData
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails

instance
  Core.ToJSON
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
  where
  toJSON :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails -> Value
toJSON
    AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' {Maybe Bool
Maybe Text
kmsKeyId :: Maybe Text
enabled :: Maybe Bool
$sel:kmsKeyId:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> Maybe Text
$sel:enabled:AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails' :: AwsOpenSearchServiceDomainEncryptionAtRestOptionsDetails
-> 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
            ]
        )