{-# 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.ElasticSearch.Types.AdvancedSecurityOptionsInput
-- 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.ElasticSearch.Types.AdvancedSecurityOptionsInput where

import qualified Amazonka.Core as Core
import Amazonka.ElasticSearch.Types.MasterUserOptions
import Amazonka.ElasticSearch.Types.SAMLOptionsInput
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the advanced security configuration: whether advanced security
-- is enabled, whether the internal database option is enabled, master
-- username and password (if internal database is enabled), and master user
-- ARN (if IAM is enabled).
--
-- /See:/ 'newAdvancedSecurityOptionsInput' smart constructor.
data AdvancedSecurityOptionsInput = AdvancedSecurityOptionsInput'
  { -- | True if advanced security is enabled.
    AdvancedSecurityOptionsInput -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | True if the internal user database is enabled.
    AdvancedSecurityOptionsInput -> Maybe Bool
internalUserDatabaseEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Credentials for the master user: username and password, ARN, or both.
    AdvancedSecurityOptionsInput -> Maybe MasterUserOptions
masterUserOptions :: Prelude.Maybe MasterUserOptions,
    -- | Specifies the SAML application configuration for the domain.
    AdvancedSecurityOptionsInput -> Maybe SAMLOptionsInput
sAMLOptions :: Prelude.Maybe SAMLOptionsInput
  }
  deriving (AdvancedSecurityOptionsInput
-> AdvancedSecurityOptionsInput -> Bool
(AdvancedSecurityOptionsInput
 -> AdvancedSecurityOptionsInput -> Bool)
-> (AdvancedSecurityOptionsInput
    -> AdvancedSecurityOptionsInput -> Bool)
-> Eq AdvancedSecurityOptionsInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdvancedSecurityOptionsInput
-> AdvancedSecurityOptionsInput -> Bool
$c/= :: AdvancedSecurityOptionsInput
-> AdvancedSecurityOptionsInput -> Bool
== :: AdvancedSecurityOptionsInput
-> AdvancedSecurityOptionsInput -> Bool
$c== :: AdvancedSecurityOptionsInput
-> AdvancedSecurityOptionsInput -> Bool
Prelude.Eq, Int -> AdvancedSecurityOptionsInput -> ShowS
[AdvancedSecurityOptionsInput] -> ShowS
AdvancedSecurityOptionsInput -> String
(Int -> AdvancedSecurityOptionsInput -> ShowS)
-> (AdvancedSecurityOptionsInput -> String)
-> ([AdvancedSecurityOptionsInput] -> ShowS)
-> Show AdvancedSecurityOptionsInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdvancedSecurityOptionsInput] -> ShowS
$cshowList :: [AdvancedSecurityOptionsInput] -> ShowS
show :: AdvancedSecurityOptionsInput -> String
$cshow :: AdvancedSecurityOptionsInput -> String
showsPrec :: Int -> AdvancedSecurityOptionsInput -> ShowS
$cshowsPrec :: Int -> AdvancedSecurityOptionsInput -> ShowS
Prelude.Show, (forall x.
 AdvancedSecurityOptionsInput -> Rep AdvancedSecurityOptionsInput x)
-> (forall x.
    Rep AdvancedSecurityOptionsInput x -> AdvancedSecurityOptionsInput)
-> Generic AdvancedSecurityOptionsInput
forall x.
Rep AdvancedSecurityOptionsInput x -> AdvancedSecurityOptionsInput
forall x.
AdvancedSecurityOptionsInput -> Rep AdvancedSecurityOptionsInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AdvancedSecurityOptionsInput x -> AdvancedSecurityOptionsInput
$cfrom :: forall x.
AdvancedSecurityOptionsInput -> Rep AdvancedSecurityOptionsInput x
Prelude.Generic)

-- |
-- Create a value of 'AdvancedSecurityOptionsInput' 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', 'advancedSecurityOptionsInput_enabled' - True if advanced security is enabled.
--
-- 'internalUserDatabaseEnabled', 'advancedSecurityOptionsInput_internalUserDatabaseEnabled' - True if the internal user database is enabled.
--
-- 'masterUserOptions', 'advancedSecurityOptionsInput_masterUserOptions' - Credentials for the master user: username and password, ARN, or both.
--
-- 'sAMLOptions', 'advancedSecurityOptionsInput_sAMLOptions' - Specifies the SAML application configuration for the domain.
newAdvancedSecurityOptionsInput ::
  AdvancedSecurityOptionsInput
newAdvancedSecurityOptionsInput :: AdvancedSecurityOptionsInput
newAdvancedSecurityOptionsInput =
  AdvancedSecurityOptionsInput' :: Maybe Bool
-> Maybe Bool
-> Maybe MasterUserOptions
-> Maybe SAMLOptionsInput
-> AdvancedSecurityOptionsInput
AdvancedSecurityOptionsInput'
    { $sel:enabled:AdvancedSecurityOptionsInput' :: Maybe Bool
enabled =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:internalUserDatabaseEnabled:AdvancedSecurityOptionsInput' :: Maybe Bool
internalUserDatabaseEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:masterUserOptions:AdvancedSecurityOptionsInput' :: Maybe MasterUserOptions
masterUserOptions = Maybe MasterUserOptions
forall a. Maybe a
Prelude.Nothing,
      $sel:sAMLOptions:AdvancedSecurityOptionsInput' :: Maybe SAMLOptionsInput
sAMLOptions = Maybe SAMLOptionsInput
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | Credentials for the master user: username and password, ARN, or both.
advancedSecurityOptionsInput_masterUserOptions :: Lens.Lens' AdvancedSecurityOptionsInput (Prelude.Maybe MasterUserOptions)
advancedSecurityOptionsInput_masterUserOptions :: (Maybe MasterUserOptions -> f (Maybe MasterUserOptions))
-> AdvancedSecurityOptionsInput -> f AdvancedSecurityOptionsInput
advancedSecurityOptionsInput_masterUserOptions = (AdvancedSecurityOptionsInput -> Maybe MasterUserOptions)
-> (AdvancedSecurityOptionsInput
    -> Maybe MasterUserOptions -> AdvancedSecurityOptionsInput)
-> Lens
     AdvancedSecurityOptionsInput
     AdvancedSecurityOptionsInput
     (Maybe MasterUserOptions)
     (Maybe MasterUserOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedSecurityOptionsInput' {Maybe MasterUserOptions
masterUserOptions :: Maybe MasterUserOptions
$sel:masterUserOptions:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> Maybe MasterUserOptions
masterUserOptions} -> Maybe MasterUserOptions
masterUserOptions) (\s :: AdvancedSecurityOptionsInput
s@AdvancedSecurityOptionsInput' {} Maybe MasterUserOptions
a -> AdvancedSecurityOptionsInput
s {$sel:masterUserOptions:AdvancedSecurityOptionsInput' :: Maybe MasterUserOptions
masterUserOptions = Maybe MasterUserOptions
a} :: AdvancedSecurityOptionsInput)

-- | Specifies the SAML application configuration for the domain.
advancedSecurityOptionsInput_sAMLOptions :: Lens.Lens' AdvancedSecurityOptionsInput (Prelude.Maybe SAMLOptionsInput)
advancedSecurityOptionsInput_sAMLOptions :: (Maybe SAMLOptionsInput -> f (Maybe SAMLOptionsInput))
-> AdvancedSecurityOptionsInput -> f AdvancedSecurityOptionsInput
advancedSecurityOptionsInput_sAMLOptions = (AdvancedSecurityOptionsInput -> Maybe SAMLOptionsInput)
-> (AdvancedSecurityOptionsInput
    -> Maybe SAMLOptionsInput -> AdvancedSecurityOptionsInput)
-> Lens
     AdvancedSecurityOptionsInput
     AdvancedSecurityOptionsInput
     (Maybe SAMLOptionsInput)
     (Maybe SAMLOptionsInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdvancedSecurityOptionsInput' {Maybe SAMLOptionsInput
sAMLOptions :: Maybe SAMLOptionsInput
$sel:sAMLOptions:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> Maybe SAMLOptionsInput
sAMLOptions} -> Maybe SAMLOptionsInput
sAMLOptions) (\s :: AdvancedSecurityOptionsInput
s@AdvancedSecurityOptionsInput' {} Maybe SAMLOptionsInput
a -> AdvancedSecurityOptionsInput
s {$sel:sAMLOptions:AdvancedSecurityOptionsInput' :: Maybe SAMLOptionsInput
sAMLOptions = Maybe SAMLOptionsInput
a} :: AdvancedSecurityOptionsInput)

instance
  Prelude.Hashable
    AdvancedSecurityOptionsInput

instance Prelude.NFData AdvancedSecurityOptionsInput

instance Core.ToJSON AdvancedSecurityOptionsInput where
  toJSON :: AdvancedSecurityOptionsInput -> Value
toJSON AdvancedSecurityOptionsInput' {Maybe Bool
Maybe MasterUserOptions
Maybe SAMLOptionsInput
sAMLOptions :: Maybe SAMLOptionsInput
masterUserOptions :: Maybe MasterUserOptions
internalUserDatabaseEnabled :: Maybe Bool
enabled :: Maybe Bool
$sel:sAMLOptions:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> Maybe SAMLOptionsInput
$sel:masterUserOptions:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> Maybe MasterUserOptions
$sel:internalUserDatabaseEnabled:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> Maybe Bool
$sel:enabled:AdvancedSecurityOptionsInput' :: AdvancedSecurityOptionsInput -> 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
"InternalUserDatabaseEnabled" 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
internalUserDatabaseEnabled,
            (Text
"MasterUserOptions" Text -> MasterUserOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MasterUserOptions -> Pair)
-> Maybe MasterUserOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MasterUserOptions
masterUserOptions,
            (Text
"SAMLOptions" Text -> SAMLOptionsInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SAMLOptionsInput -> Pair) -> Maybe SAMLOptionsInput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SAMLOptionsInput
sAMLOptions
          ]
      )