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

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

-- | Details about the configuration for node-to-node encryption.
--
-- /See:/ 'newAwsElasticsearchDomainNodeToNodeEncryptionOptions' smart constructor.
data AwsElasticsearchDomainNodeToNodeEncryptionOptions = AwsElasticsearchDomainNodeToNodeEncryptionOptions'
  { -- | Whether node-to-node encryption is enabled.
    AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool
(AwsElasticsearchDomainNodeToNodeEncryptionOptions
 -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool)
-> (AwsElasticsearchDomainNodeToNodeEncryptionOptions
    -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool)
-> Eq AwsElasticsearchDomainNodeToNodeEncryptionOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool
$c/= :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool
== :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool
$c== :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Bool
Prelude.Eq, ReadPrec [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
ReadPrec AwsElasticsearchDomainNodeToNodeEncryptionOptions
Int -> ReadS AwsElasticsearchDomainNodeToNodeEncryptionOptions
ReadS [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
(Int -> ReadS AwsElasticsearchDomainNodeToNodeEncryptionOptions)
-> ReadS [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
-> ReadPrec AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> ReadPrec [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
-> Read AwsElasticsearchDomainNodeToNodeEncryptionOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
$creadListPrec :: ReadPrec [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
readPrec :: ReadPrec AwsElasticsearchDomainNodeToNodeEncryptionOptions
$creadPrec :: ReadPrec AwsElasticsearchDomainNodeToNodeEncryptionOptions
readList :: ReadS [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
$creadList :: ReadS [AwsElasticsearchDomainNodeToNodeEncryptionOptions]
readsPrec :: Int -> ReadS AwsElasticsearchDomainNodeToNodeEncryptionOptions
$creadsPrec :: Int -> ReadS AwsElasticsearchDomainNodeToNodeEncryptionOptions
Prelude.Read, Int -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> ShowS
[AwsElasticsearchDomainNodeToNodeEncryptionOptions] -> ShowS
AwsElasticsearchDomainNodeToNodeEncryptionOptions -> String
(Int -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> ShowS)
-> (AwsElasticsearchDomainNodeToNodeEncryptionOptions -> String)
-> ([AwsElasticsearchDomainNodeToNodeEncryptionOptions] -> ShowS)
-> Show AwsElasticsearchDomainNodeToNodeEncryptionOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsElasticsearchDomainNodeToNodeEncryptionOptions] -> ShowS
$cshowList :: [AwsElasticsearchDomainNodeToNodeEncryptionOptions] -> ShowS
show :: AwsElasticsearchDomainNodeToNodeEncryptionOptions -> String
$cshow :: AwsElasticsearchDomainNodeToNodeEncryptionOptions -> String
showsPrec :: Int -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> ShowS
$cshowsPrec :: Int -> AwsElasticsearchDomainNodeToNodeEncryptionOptions -> ShowS
Prelude.Show, (forall x.
 AwsElasticsearchDomainNodeToNodeEncryptionOptions
 -> Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x)
-> (forall x.
    Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x
    -> AwsElasticsearchDomainNodeToNodeEncryptionOptions)
-> Generic AwsElasticsearchDomainNodeToNodeEncryptionOptions
forall x.
Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions
forall x.
AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions
$cfrom :: forall x.
AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> Rep AwsElasticsearchDomainNodeToNodeEncryptionOptions x
Prelude.Generic)

-- |
-- Create a value of 'AwsElasticsearchDomainNodeToNodeEncryptionOptions' 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', 'awsElasticsearchDomainNodeToNodeEncryptionOptions_enabled' - Whether node-to-node encryption is enabled.
newAwsElasticsearchDomainNodeToNodeEncryptionOptions ::
  AwsElasticsearchDomainNodeToNodeEncryptionOptions
newAwsElasticsearchDomainNodeToNodeEncryptionOptions :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
newAwsElasticsearchDomainNodeToNodeEncryptionOptions =
  AwsElasticsearchDomainNodeToNodeEncryptionOptions' :: Maybe Bool -> AwsElasticsearchDomainNodeToNodeEncryptionOptions
AwsElasticsearchDomainNodeToNodeEncryptionOptions'
    { $sel:enabled:AwsElasticsearchDomainNodeToNodeEncryptionOptions' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether node-to-node encryption is enabled.
awsElasticsearchDomainNodeToNodeEncryptionOptions_enabled :: Lens.Lens' AwsElasticsearchDomainNodeToNodeEncryptionOptions (Prelude.Maybe Prelude.Bool)
awsElasticsearchDomainNodeToNodeEncryptionOptions_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AwsElasticsearchDomainNodeToNodeEncryptionOptions
-> f AwsElasticsearchDomainNodeToNodeEncryptionOptions
awsElasticsearchDomainNodeToNodeEncryptionOptions_enabled = (AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Maybe Bool)
-> (AwsElasticsearchDomainNodeToNodeEncryptionOptions
    -> Maybe Bool -> AwsElasticsearchDomainNodeToNodeEncryptionOptions)
-> Lens
     AwsElasticsearchDomainNodeToNodeEncryptionOptions
     AwsElasticsearchDomainNodeToNodeEncryptionOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElasticsearchDomainNodeToNodeEncryptionOptions' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AwsElasticsearchDomainNodeToNodeEncryptionOptions' :: AwsElasticsearchDomainNodeToNodeEncryptionOptions -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AwsElasticsearchDomainNodeToNodeEncryptionOptions
s@AwsElasticsearchDomainNodeToNodeEncryptionOptions' {} Maybe Bool
a -> AwsElasticsearchDomainNodeToNodeEncryptionOptions
s {$sel:enabled:AwsElasticsearchDomainNodeToNodeEncryptionOptions' :: Maybe Bool
enabled = Maybe Bool
a} :: AwsElasticsearchDomainNodeToNodeEncryptionOptions)

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

instance
  Prelude.Hashable
    AwsElasticsearchDomainNodeToNodeEncryptionOptions

instance
  Prelude.NFData
    AwsElasticsearchDomainNodeToNodeEncryptionOptions

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