{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.OpenSearch.Types.SAMLOptionsOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
    { $sel:enabled:SAMLOptionsOutput' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
      $sel:idp:SAMLOptionsOutput' :: Maybe SAMLIdp
idp = forall a. Maybe a
Prelude.Nothing,
      $sel:rolesKey:SAMLOptionsOutput' :: Maybe Text
rolesKey = forall a. Maybe a
Prelude.Nothing,
      $sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: Maybe Int
sessionTimeoutMinutes = forall a. Maybe a
Prelude.Nothing,
      $sel:subjectKey:SAMLOptionsOutput' :: Maybe Text
subjectKey = forall a. Maybe a
Prelude.Nothing
    }

-- | True if SAML is enabled.
sAMLOptionsOutput_enabled :: Lens.Lens' SAMLOptionsOutput (Prelude.Maybe Prelude.Bool)
sAMLOptionsOutput_enabled :: Lens' SAMLOptionsOutput (Maybe Bool)
sAMLOptionsOutput_enabled = 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 :: Lens' SAMLOptionsOutput (Maybe SAMLIdp)
sAMLOptionsOutput_idp = 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 :: Lens' SAMLOptionsOutput (Maybe Text)
sAMLOptionsOutput_rolesKey = 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 :: Lens' SAMLOptionsOutput (Maybe Int)
sAMLOptionsOutput_sessionTimeoutMinutes = 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 :: Lens' SAMLOptionsOutput (Maybe Text)
sAMLOptionsOutput_subjectKey = 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 Data.FromJSON SAMLOptionsOutput where
  parseJSON :: Value -> Parser SAMLOptionsOutput
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SAMLOptionsOutput"
      ( \Object
x ->
          Maybe Bool
-> Maybe SAMLIdp
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> SAMLOptionsOutput
SAMLOptionsOutput'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Enabled")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Idp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RolesKey")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SessionTimeoutMinutes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SubjectKey")
      )

instance Prelude.Hashable SAMLOptionsOutput where
  hashWithSalt :: Int -> SAMLOptionsOutput -> Int
hashWithSalt Int
_salt SAMLOptionsOutput' {Maybe Bool
Maybe Int
Maybe Text
Maybe SAMLIdp
subjectKey :: Maybe Text
sessionTimeoutMinutes :: Maybe Int
rolesKey :: Maybe Text
idp :: Maybe SAMLIdp
enabled :: Maybe Bool
$sel:subjectKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
$sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Int
$sel:rolesKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
$sel:idp:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe SAMLIdp
$sel:enabled:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SAMLIdp
idp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
rolesKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sessionTimeoutMinutes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
subjectKey

instance Prelude.NFData SAMLOptionsOutput where
  rnf :: SAMLOptionsOutput -> ()
rnf SAMLOptionsOutput' {Maybe Bool
Maybe Int
Maybe Text
Maybe SAMLIdp
subjectKey :: Maybe Text
sessionTimeoutMinutes :: Maybe Int
rolesKey :: Maybe Text
idp :: Maybe SAMLIdp
enabled :: Maybe Bool
$sel:subjectKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
$sel:sessionTimeoutMinutes:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Int
$sel:rolesKey:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Text
$sel:idp:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe SAMLIdp
$sel:enabled:SAMLOptionsOutput' :: SAMLOptionsOutput -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SAMLIdp
idp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
rolesKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sessionTimeoutMinutes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
subjectKey