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

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

-- | Describes the SAML application configured for the domain.
--
-- /See:/ 'newSAMLOptionsOutput' smart constructor.
data SAMLOptionsOutput = SAMLOptionsOutput'
  { -- | True if SAML is enabled.
    SAMLOptionsOutput -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | Describes the SAML identity provider\'s information.
    SAMLOptionsOutput -> Maybe SAMLIdp
idp :: Prelude.Maybe SAMLIdp,
    -- | The key used for matching the SAML roles attribute.
    SAMLOptionsOutput -> Maybe Text
rolesKey :: Prelude.Maybe Prelude.Text,
    -- | The duration, in minutes, after which a user session becomes inactive.
    SAMLOptionsOutput -> Maybe Int
sessionTimeoutMinutes :: Prelude.Maybe Prelude.Int,
    -- | The key used for matching the SAML subject attribute.
    SAMLOptionsOutput -> Maybe Text
subjectKey :: Prelude.Maybe Prelude.Text
  }
  deriving (SAMLOptionsOutput -> SAMLOptionsOutput -> Bool
(SAMLOptionsOutput -> SAMLOptionsOutput -> Bool)
-> (SAMLOptionsOutput -> SAMLOptionsOutput -> Bool)
-> Eq SAMLOptionsOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SAMLOptionsOutput -> SAMLOptionsOutput -> Bool
$c/= :: SAMLOptionsOutput -> SAMLOptionsOutput -> Bool
== :: SAMLOptionsOutput -> SAMLOptionsOutput -> Bool
$c== :: SAMLOptionsOutput -> SAMLOptionsOutput -> Bool
Prelude.Eq, ReadPrec [SAMLOptionsOutput]
ReadPrec SAMLOptionsOutput
Int -> ReadS SAMLOptionsOutput
ReadS [SAMLOptionsOutput]
(Int -> ReadS SAMLOptionsOutput)
-> ReadS [SAMLOptionsOutput]
-> ReadPrec SAMLOptionsOutput
-> ReadPrec [SAMLOptionsOutput]
-> Read SAMLOptionsOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SAMLOptionsOutput]
$creadListPrec :: ReadPrec [SAMLOptionsOutput]
readPrec :: ReadPrec SAMLOptionsOutput
$creadPrec :: ReadPrec SAMLOptionsOutput
readList :: ReadS [SAMLOptionsOutput]
$creadList :: ReadS [SAMLOptionsOutput]
readsPrec :: Int -> ReadS SAMLOptionsOutput
$creadsPrec :: Int -> ReadS SAMLOptionsOutput
Prelude.Read, Int -> SAMLOptionsOutput -> ShowS
[SAMLOptionsOutput] -> ShowS
SAMLOptionsOutput -> String
(Int -> SAMLOptionsOutput -> ShowS)
-> (SAMLOptionsOutput -> String)
-> ([SAMLOptionsOutput] -> ShowS)
-> Show SAMLOptionsOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SAMLOptionsOutput] -> ShowS
$cshowList :: [SAMLOptionsOutput] -> ShowS
show :: SAMLOptionsOutput -> String
$cshow :: SAMLOptionsOutput -> String
showsPrec :: Int -> SAMLOptionsOutput -> ShowS
$cshowsPrec :: Int -> SAMLOptionsOutput -> ShowS
Prelude.Show, (forall x. SAMLOptionsOutput -> Rep SAMLOptionsOutput x)
-> (forall x. Rep SAMLOptionsOutput x -> SAMLOptionsOutput)
-> Generic SAMLOptionsOutput
forall x. Rep SAMLOptionsOutput x -> SAMLOptionsOutput
forall x. SAMLOptionsOutput -> Rep SAMLOptionsOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SAMLOptionsOutput x -> SAMLOptionsOutput
$cfrom :: forall x. SAMLOptionsOutput -> Rep SAMLOptionsOutput x
Prelude.Generic)

-- |
-- Create a value of 'SAMLOptionsOutput' 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', 'sAMLOptionsOutput_enabled' - True if SAML is enabled.
--
-- 'idp', 'sAMLOptionsOutput_idp' - Describes the SAML identity provider\'s information.
--
-- 'rolesKey', 'sAMLOptionsOutput_rolesKey' - The key used for matching the SAML roles attribute.
--
-- 'sessionTimeoutMinutes', 'sAMLOptionsOutput_sessionTimeoutMinutes' - The duration, in minutes, after which a user session becomes inactive.
--
-- 'subjectKey', 'sAMLOptionsOutput_subjectKey' - The key used for matching the SAML subject attribute.
newSAMLOptionsOutput ::
  SAMLOptionsOutput
newSAMLOptionsOutput :: SAMLOptionsOutput
newSAMLOptionsOutput =
  SAMLOptionsOutput' :: Maybe Bool
-> Maybe SAMLIdp
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> SAMLOptionsOutput
SAMLOptionsOutput'
    { $sel:enabled:SAMLOptionsOutput' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:idp:SAMLOptionsOutput' :: Maybe SAMLIdp
idp = Maybe SAMLIdp
forall a. Maybe a
Prelude.Nothing,
      $sel:rolesKey:SAMLOptionsOutput' :: Maybe Text
rolesKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: Maybe Int
sessionTimeoutMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:subjectKey:SAMLOptionsOutput' :: Maybe Text
subjectKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Describes the SAML identity provider\'s information.
sAMLOptionsOutput_idp :: Lens.Lens' SAMLOptionsOutput (Prelude.Maybe SAMLIdp)
sAMLOptionsOutput_idp :: (Maybe SAMLIdp -> f (Maybe SAMLIdp))
-> SAMLOptionsOutput -> f SAMLOptionsOutput
sAMLOptionsOutput_idp = (SAMLOptionsOutput -> Maybe SAMLIdp)
-> (SAMLOptionsOutput -> Maybe SAMLIdp -> SAMLOptionsOutput)
-> Lens
     SAMLOptionsOutput SAMLOptionsOutput (Maybe SAMLIdp) (Maybe SAMLIdp)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAMLOptionsOutput' {Maybe SAMLIdp
idp :: Maybe SAMLIdp
$sel:idp:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe SAMLIdp
idp} -> Maybe SAMLIdp
idp) (\s :: SAMLOptionsOutput
s@SAMLOptionsOutput' {} Maybe SAMLIdp
a -> SAMLOptionsOutput
s {$sel:idp:SAMLOptionsOutput' :: Maybe SAMLIdp
idp = Maybe SAMLIdp
a} :: SAMLOptionsOutput)

-- | The key used for matching the SAML roles attribute.
sAMLOptionsOutput_rolesKey :: Lens.Lens' SAMLOptionsOutput (Prelude.Maybe Prelude.Text)
sAMLOptionsOutput_rolesKey :: (Maybe Text -> f (Maybe Text))
-> SAMLOptionsOutput -> f SAMLOptionsOutput
sAMLOptionsOutput_rolesKey = (SAMLOptionsOutput -> Maybe Text)
-> (SAMLOptionsOutput -> Maybe Text -> SAMLOptionsOutput)
-> Lens
     SAMLOptionsOutput SAMLOptionsOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAMLOptionsOutput' {Maybe Text
rolesKey :: Maybe Text
$sel:rolesKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
rolesKey} -> Maybe Text
rolesKey) (\s :: SAMLOptionsOutput
s@SAMLOptionsOutput' {} Maybe Text
a -> SAMLOptionsOutput
s {$sel:rolesKey:SAMLOptionsOutput' :: Maybe Text
rolesKey = Maybe Text
a} :: SAMLOptionsOutput)

-- | The duration, in minutes, after which a user session becomes inactive.
sAMLOptionsOutput_sessionTimeoutMinutes :: Lens.Lens' SAMLOptionsOutput (Prelude.Maybe Prelude.Int)
sAMLOptionsOutput_sessionTimeoutMinutes :: (Maybe Int -> f (Maybe Int))
-> SAMLOptionsOutput -> f SAMLOptionsOutput
sAMLOptionsOutput_sessionTimeoutMinutes = (SAMLOptionsOutput -> Maybe Int)
-> (SAMLOptionsOutput -> Maybe Int -> SAMLOptionsOutput)
-> Lens SAMLOptionsOutput SAMLOptionsOutput (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAMLOptionsOutput' {Maybe Int
sessionTimeoutMinutes :: Maybe Int
$sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Int
sessionTimeoutMinutes} -> Maybe Int
sessionTimeoutMinutes) (\s :: SAMLOptionsOutput
s@SAMLOptionsOutput' {} Maybe Int
a -> SAMLOptionsOutput
s {$sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: Maybe Int
sessionTimeoutMinutes = Maybe Int
a} :: SAMLOptionsOutput)

-- | The key used for matching the SAML subject attribute.
sAMLOptionsOutput_subjectKey :: Lens.Lens' SAMLOptionsOutput (Prelude.Maybe Prelude.Text)
sAMLOptionsOutput_subjectKey :: (Maybe Text -> f (Maybe Text))
-> SAMLOptionsOutput -> f SAMLOptionsOutput
sAMLOptionsOutput_subjectKey = (SAMLOptionsOutput -> Maybe Text)
-> (SAMLOptionsOutput -> Maybe Text -> SAMLOptionsOutput)
-> Lens
     SAMLOptionsOutput SAMLOptionsOutput (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAMLOptionsOutput' {Maybe Text
subjectKey :: Maybe Text
$sel:subjectKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
subjectKey} -> Maybe Text
subjectKey) (\s :: SAMLOptionsOutput
s@SAMLOptionsOutput' {} Maybe Text
a -> SAMLOptionsOutput
s {$sel:subjectKey:SAMLOptionsOutput' :: Maybe Text
subjectKey = Maybe Text
a} :: SAMLOptionsOutput)

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

instance Prelude.Hashable SAMLOptionsOutput

instance Prelude.NFData SAMLOptionsOutput