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

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

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

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

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

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

instance
  Prelude.NFData
    AwsOpenSearchServiceDomainNodeToNodeEncryptionOptionsDetails

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