{-# 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.Grafana.Types.SamlAuthentication
-- 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.Grafana.Types.SamlAuthentication where

import qualified Amazonka.Core as Core
import Amazonka.Grafana.Types.SamlConfiguration
import Amazonka.Grafana.Types.SamlConfigurationStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure containing information about how this workspace works with
-- SAML.
--
-- /See:/ 'newSamlAuthentication' smart constructor.
data SamlAuthentication = SamlAuthentication'
  { -- | A structure containing details about how this workspace works with SAML.
    SamlAuthentication -> Maybe SamlConfiguration
configuration :: Prelude.Maybe SamlConfiguration,
    -- | Specifies whether the workspace\'s SAML configuration is complete.
    SamlAuthentication -> SamlConfigurationStatus
status :: SamlConfigurationStatus
  }
  deriving (SamlAuthentication -> SamlAuthentication -> Bool
(SamlAuthentication -> SamlAuthentication -> Bool)
-> (SamlAuthentication -> SamlAuthentication -> Bool)
-> Eq SamlAuthentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SamlAuthentication -> SamlAuthentication -> Bool
$c/= :: SamlAuthentication -> SamlAuthentication -> Bool
== :: SamlAuthentication -> SamlAuthentication -> Bool
$c== :: SamlAuthentication -> SamlAuthentication -> Bool
Prelude.Eq, ReadPrec [SamlAuthentication]
ReadPrec SamlAuthentication
Int -> ReadS SamlAuthentication
ReadS [SamlAuthentication]
(Int -> ReadS SamlAuthentication)
-> ReadS [SamlAuthentication]
-> ReadPrec SamlAuthentication
-> ReadPrec [SamlAuthentication]
-> Read SamlAuthentication
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SamlAuthentication]
$creadListPrec :: ReadPrec [SamlAuthentication]
readPrec :: ReadPrec SamlAuthentication
$creadPrec :: ReadPrec SamlAuthentication
readList :: ReadS [SamlAuthentication]
$creadList :: ReadS [SamlAuthentication]
readsPrec :: Int -> ReadS SamlAuthentication
$creadsPrec :: Int -> ReadS SamlAuthentication
Prelude.Read, Int -> SamlAuthentication -> ShowS
[SamlAuthentication] -> ShowS
SamlAuthentication -> String
(Int -> SamlAuthentication -> ShowS)
-> (SamlAuthentication -> String)
-> ([SamlAuthentication] -> ShowS)
-> Show SamlAuthentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SamlAuthentication] -> ShowS
$cshowList :: [SamlAuthentication] -> ShowS
show :: SamlAuthentication -> String
$cshow :: SamlAuthentication -> String
showsPrec :: Int -> SamlAuthentication -> ShowS
$cshowsPrec :: Int -> SamlAuthentication -> ShowS
Prelude.Show, (forall x. SamlAuthentication -> Rep SamlAuthentication x)
-> (forall x. Rep SamlAuthentication x -> SamlAuthentication)
-> Generic SamlAuthentication
forall x. Rep SamlAuthentication x -> SamlAuthentication
forall x. SamlAuthentication -> Rep SamlAuthentication x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SamlAuthentication x -> SamlAuthentication
$cfrom :: forall x. SamlAuthentication -> Rep SamlAuthentication x
Prelude.Generic)

-- |
-- Create a value of 'SamlAuthentication' 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:
--
-- 'configuration', 'samlAuthentication_configuration' - A structure containing details about how this workspace works with SAML.
--
-- 'status', 'samlAuthentication_status' - Specifies whether the workspace\'s SAML configuration is complete.
newSamlAuthentication ::
  -- | 'status'
  SamlConfigurationStatus ->
  SamlAuthentication
newSamlAuthentication :: SamlConfigurationStatus -> SamlAuthentication
newSamlAuthentication SamlConfigurationStatus
pStatus_ =
  SamlAuthentication' :: Maybe SamlConfiguration
-> SamlConfigurationStatus -> SamlAuthentication
SamlAuthentication'
    { $sel:configuration:SamlAuthentication' :: Maybe SamlConfiguration
configuration =
        Maybe SamlConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:status:SamlAuthentication' :: SamlConfigurationStatus
status = SamlConfigurationStatus
pStatus_
    }

-- | A structure containing details about how this workspace works with SAML.
samlAuthentication_configuration :: Lens.Lens' SamlAuthentication (Prelude.Maybe SamlConfiguration)
samlAuthentication_configuration :: (Maybe SamlConfiguration -> f (Maybe SamlConfiguration))
-> SamlAuthentication -> f SamlAuthentication
samlAuthentication_configuration = (SamlAuthentication -> Maybe SamlConfiguration)
-> (SamlAuthentication
    -> Maybe SamlConfiguration -> SamlAuthentication)
-> Lens
     SamlAuthentication
     SamlAuthentication
     (Maybe SamlConfiguration)
     (Maybe SamlConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamlAuthentication' {Maybe SamlConfiguration
configuration :: Maybe SamlConfiguration
$sel:configuration:SamlAuthentication' :: SamlAuthentication -> Maybe SamlConfiguration
configuration} -> Maybe SamlConfiguration
configuration) (\s :: SamlAuthentication
s@SamlAuthentication' {} Maybe SamlConfiguration
a -> SamlAuthentication
s {$sel:configuration:SamlAuthentication' :: Maybe SamlConfiguration
configuration = Maybe SamlConfiguration
a} :: SamlAuthentication)

-- | Specifies whether the workspace\'s SAML configuration is complete.
samlAuthentication_status :: Lens.Lens' SamlAuthentication SamlConfigurationStatus
samlAuthentication_status :: (SamlConfigurationStatus -> f SamlConfigurationStatus)
-> SamlAuthentication -> f SamlAuthentication
samlAuthentication_status = (SamlAuthentication -> SamlConfigurationStatus)
-> (SamlAuthentication
    -> SamlConfigurationStatus -> SamlAuthentication)
-> Lens
     SamlAuthentication
     SamlAuthentication
     SamlConfigurationStatus
     SamlConfigurationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SamlAuthentication' {SamlConfigurationStatus
status :: SamlConfigurationStatus
$sel:status:SamlAuthentication' :: SamlAuthentication -> SamlConfigurationStatus
status} -> SamlConfigurationStatus
status) (\s :: SamlAuthentication
s@SamlAuthentication' {} SamlConfigurationStatus
a -> SamlAuthentication
s {$sel:status:SamlAuthentication' :: SamlConfigurationStatus
status = SamlConfigurationStatus
a} :: SamlAuthentication)

instance Core.FromJSON SamlAuthentication where
  parseJSON :: Value -> Parser SamlAuthentication
parseJSON =
    String
-> (Object -> Parser SamlAuthentication)
-> Value
-> Parser SamlAuthentication
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SamlAuthentication"
      ( \Object
x ->
          Maybe SamlConfiguration
-> SamlConfigurationStatus -> SamlAuthentication
SamlAuthentication'
            (Maybe SamlConfiguration
 -> SamlConfigurationStatus -> SamlAuthentication)
-> Parser (Maybe SamlConfiguration)
-> Parser (SamlConfigurationStatus -> SamlAuthentication)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SamlConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"configuration")
            Parser (SamlConfigurationStatus -> SamlAuthentication)
-> Parser SamlConfigurationStatus -> Parser SamlAuthentication
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SamlConfigurationStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance Prelude.Hashable SamlAuthentication

instance Prelude.NFData SamlAuthentication