{-# 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.OpenSearch.Types.AdvancedSecurityOptions
-- 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.OpenSearch.Types.AdvancedSecurityOptions where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types.SAMLOptionsOutput
import qualified Amazonka.Prelude as Prelude

-- | The advanced security configuration: whether advanced security is
-- enabled, whether the internal database option is enabled.
--
-- /See:/ 'newAdvancedSecurityOptions' smart constructor.
data AdvancedSecurityOptions = AdvancedSecurityOptions'
  { -- | True if advanced security is enabled.
    AdvancedSecurityOptions -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | True if the internal user database is enabled.
    AdvancedSecurityOptions -> Maybe Bool
internalUserDatabaseEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Describes the SAML application configured for a domain.
    AdvancedSecurityOptions -> Maybe SAMLOptionsOutput
sAMLOptions :: Prelude.Maybe SAMLOptionsOutput
  }
  deriving (AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool
(AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool)
-> (AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool)
-> Eq AdvancedSecurityOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool
$c/= :: AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool
== :: AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool
$c== :: AdvancedSecurityOptions -> AdvancedSecurityOptions -> Bool
Prelude.Eq, ReadPrec [AdvancedSecurityOptions]
ReadPrec AdvancedSecurityOptions
Int -> ReadS AdvancedSecurityOptions
ReadS [AdvancedSecurityOptions]
(Int -> ReadS AdvancedSecurityOptions)
-> ReadS [AdvancedSecurityOptions]
-> ReadPrec AdvancedSecurityOptions
-> ReadPrec [AdvancedSecurityOptions]
-> Read AdvancedSecurityOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AdvancedSecurityOptions]
$creadListPrec :: ReadPrec [AdvancedSecurityOptions]
readPrec :: ReadPrec AdvancedSecurityOptions
$creadPrec :: ReadPrec AdvancedSecurityOptions
readList :: ReadS [AdvancedSecurityOptions]
$creadList :: ReadS [AdvancedSecurityOptions]
readsPrec :: Int -> ReadS AdvancedSecurityOptions
$creadsPrec :: Int -> ReadS AdvancedSecurityOptions
Prelude.Read, Int -> AdvancedSecurityOptions -> ShowS
[AdvancedSecurityOptions] -> ShowS
AdvancedSecurityOptions -> String
(Int -> AdvancedSecurityOptions -> ShowS)
-> (AdvancedSecurityOptions -> String)
-> ([AdvancedSecurityOptions] -> ShowS)
-> Show AdvancedSecurityOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdvancedSecurityOptions] -> ShowS
$cshowList :: [AdvancedSecurityOptions] -> ShowS
show :: AdvancedSecurityOptions -> String
$cshow :: AdvancedSecurityOptions -> String
showsPrec :: Int -> AdvancedSecurityOptions -> ShowS
$cshowsPrec :: Int -> AdvancedSecurityOptions -> ShowS
Prelude.Show, (forall x.
 AdvancedSecurityOptions -> Rep AdvancedSecurityOptions x)
-> (forall x.
    Rep AdvancedSecurityOptions x -> AdvancedSecurityOptions)
-> Generic AdvancedSecurityOptions
forall x. Rep AdvancedSecurityOptions x -> AdvancedSecurityOptions
forall x. AdvancedSecurityOptions -> Rep AdvancedSecurityOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdvancedSecurityOptions x -> AdvancedSecurityOptions
$cfrom :: forall x. AdvancedSecurityOptions -> Rep AdvancedSecurityOptions x
Prelude.Generic)

-- |
-- Create a value of 'AdvancedSecurityOptions' 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', 'advancedSecurityOptions_enabled' - True if advanced security is enabled.
--
-- 'internalUserDatabaseEnabled', 'advancedSecurityOptions_internalUserDatabaseEnabled' - True if the internal user database is enabled.
--
-- 'sAMLOptions', 'advancedSecurityOptions_sAMLOptions' - Describes the SAML application configured for a domain.
newAdvancedSecurityOptions ::
  AdvancedSecurityOptions
newAdvancedSecurityOptions :: AdvancedSecurityOptions
newAdvancedSecurityOptions =
  AdvancedSecurityOptions' :: Maybe Bool
-> Maybe Bool -> Maybe SAMLOptionsOutput -> AdvancedSecurityOptions
AdvancedSecurityOptions'
    { $sel:enabled:AdvancedSecurityOptions' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:internalUserDatabaseEnabled:AdvancedSecurityOptions' :: Maybe Bool
internalUserDatabaseEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:sAMLOptions:AdvancedSecurityOptions' :: Maybe SAMLOptionsOutput
sAMLOptions = Maybe SAMLOptionsOutput
forall a. Maybe a
Prelude.Nothing
    }

-- | True if advanced security is enabled.
advancedSecurityOptions_enabled :: Lens.Lens' AdvancedSecurityOptions (Prelude.Maybe Prelude.Bool)
advancedSecurityOptions_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AdvancedSecurityOptions -> f AdvancedSecurityOptions
advancedSecurityOptions_enabled = (AdvancedSecurityOptions -> Maybe Bool)
-> (AdvancedSecurityOptions
    -> Maybe Bool -> AdvancedSecurityOptions)
-> Lens
     AdvancedSecurityOptions
     AdvancedSecurityOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedSecurityOptions' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AdvancedSecurityOptions' :: AdvancedSecurityOptions -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AdvancedSecurityOptions
s@AdvancedSecurityOptions' {} Maybe Bool
a -> AdvancedSecurityOptions
s {$sel:enabled:AdvancedSecurityOptions' :: Maybe Bool
enabled = Maybe Bool
a} :: AdvancedSecurityOptions)

-- | True if the internal user database is enabled.
advancedSecurityOptions_internalUserDatabaseEnabled :: Lens.Lens' AdvancedSecurityOptions (Prelude.Maybe Prelude.Bool)
advancedSecurityOptions_internalUserDatabaseEnabled :: (Maybe Bool -> f (Maybe Bool))
-> AdvancedSecurityOptions -> f AdvancedSecurityOptions
advancedSecurityOptions_internalUserDatabaseEnabled = (AdvancedSecurityOptions -> Maybe Bool)
-> (AdvancedSecurityOptions
    -> Maybe Bool -> AdvancedSecurityOptions)
-> Lens
     AdvancedSecurityOptions
     AdvancedSecurityOptions
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedSecurityOptions' {Maybe Bool
internalUserDatabaseEnabled :: Maybe Bool
$sel:internalUserDatabaseEnabled:AdvancedSecurityOptions' :: AdvancedSecurityOptions -> Maybe Bool
internalUserDatabaseEnabled} -> Maybe Bool
internalUserDatabaseEnabled) (\s :: AdvancedSecurityOptions
s@AdvancedSecurityOptions' {} Maybe Bool
a -> AdvancedSecurityOptions
s {$sel:internalUserDatabaseEnabled:AdvancedSecurityOptions' :: Maybe Bool
internalUserDatabaseEnabled = Maybe Bool
a} :: AdvancedSecurityOptions)

-- | Describes the SAML application configured for a domain.
advancedSecurityOptions_sAMLOptions :: Lens.Lens' AdvancedSecurityOptions (Prelude.Maybe SAMLOptionsOutput)
advancedSecurityOptions_sAMLOptions :: (Maybe SAMLOptionsOutput -> f (Maybe SAMLOptionsOutput))
-> AdvancedSecurityOptions -> f AdvancedSecurityOptions
advancedSecurityOptions_sAMLOptions = (AdvancedSecurityOptions -> Maybe SAMLOptionsOutput)
-> (AdvancedSecurityOptions
    -> Maybe SAMLOptionsOutput -> AdvancedSecurityOptions)
-> Lens
     AdvancedSecurityOptions
     AdvancedSecurityOptions
     (Maybe SAMLOptionsOutput)
     (Maybe SAMLOptionsOutput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedSecurityOptions' {Maybe SAMLOptionsOutput
sAMLOptions :: Maybe SAMLOptionsOutput
$sel:sAMLOptions:AdvancedSecurityOptions' :: AdvancedSecurityOptions -> Maybe SAMLOptionsOutput
sAMLOptions} -> Maybe SAMLOptionsOutput
sAMLOptions) (\s :: AdvancedSecurityOptions
s@AdvancedSecurityOptions' {} Maybe SAMLOptionsOutput
a -> AdvancedSecurityOptions
s {$sel:sAMLOptions:AdvancedSecurityOptions' :: Maybe SAMLOptionsOutput
sAMLOptions = Maybe SAMLOptionsOutput
a} :: AdvancedSecurityOptions)

instance Core.FromJSON AdvancedSecurityOptions where
  parseJSON :: Value -> Parser AdvancedSecurityOptions
parseJSON =
    String
-> (Object -> Parser AdvancedSecurityOptions)
-> Value
-> Parser AdvancedSecurityOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AdvancedSecurityOptions"
      ( \Object
x ->
          Maybe Bool
-> Maybe Bool -> Maybe SAMLOptionsOutput -> AdvancedSecurityOptions
AdvancedSecurityOptions'
            (Maybe Bool
 -> Maybe Bool
 -> Maybe SAMLOptionsOutput
 -> AdvancedSecurityOptions)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool -> Maybe SAMLOptionsOutput -> AdvancedSecurityOptions)
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 Bool -> Maybe SAMLOptionsOutput -> AdvancedSecurityOptions)
-> Parser (Maybe Bool)
-> Parser (Maybe SAMLOptionsOutput -> AdvancedSecurityOptions)
forall (f :: * -> *) a b. Applicative f => 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
"InternalUserDatabaseEnabled")
            Parser (Maybe SAMLOptionsOutput -> AdvancedSecurityOptions)
-> Parser (Maybe SAMLOptionsOutput)
-> Parser AdvancedSecurityOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SAMLOptionsOutput)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SAMLOptions")
      )

instance Prelude.Hashable AdvancedSecurityOptions

instance Prelude.NFData AdvancedSecurityOptions