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

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

-- | A structure that describes whether the workspace uses SAML, Amazon Web
-- Services SSO, or both methods for user authentication, and whether that
-- authentication is fully configured.
--
-- /See:/ 'newAuthenticationSummary' smart constructor.
data AuthenticationSummary = AuthenticationSummary'
  { -- | Specifies whether the workplace\'s user authentication method is fully
    -- configured.
    AuthenticationSummary -> Maybe SamlConfigurationStatus
samlConfigurationStatus :: Prelude.Maybe SamlConfigurationStatus,
    -- | Specifies whether the workspace uses SAML, Amazon Web Services SSO, or
    -- both methods for user authentication.
    AuthenticationSummary -> [AuthenticationProviderTypes]
providers :: [AuthenticationProviderTypes]
  }
  deriving (AuthenticationSummary -> AuthenticationSummary -> Bool
(AuthenticationSummary -> AuthenticationSummary -> Bool)
-> (AuthenticationSummary -> AuthenticationSummary -> Bool)
-> Eq AuthenticationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthenticationSummary -> AuthenticationSummary -> Bool
$c/= :: AuthenticationSummary -> AuthenticationSummary -> Bool
== :: AuthenticationSummary -> AuthenticationSummary -> Bool
$c== :: AuthenticationSummary -> AuthenticationSummary -> Bool
Prelude.Eq, ReadPrec [AuthenticationSummary]
ReadPrec AuthenticationSummary
Int -> ReadS AuthenticationSummary
ReadS [AuthenticationSummary]
(Int -> ReadS AuthenticationSummary)
-> ReadS [AuthenticationSummary]
-> ReadPrec AuthenticationSummary
-> ReadPrec [AuthenticationSummary]
-> Read AuthenticationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthenticationSummary]
$creadListPrec :: ReadPrec [AuthenticationSummary]
readPrec :: ReadPrec AuthenticationSummary
$creadPrec :: ReadPrec AuthenticationSummary
readList :: ReadS [AuthenticationSummary]
$creadList :: ReadS [AuthenticationSummary]
readsPrec :: Int -> ReadS AuthenticationSummary
$creadsPrec :: Int -> ReadS AuthenticationSummary
Prelude.Read, Int -> AuthenticationSummary -> ShowS
[AuthenticationSummary] -> ShowS
AuthenticationSummary -> String
(Int -> AuthenticationSummary -> ShowS)
-> (AuthenticationSummary -> String)
-> ([AuthenticationSummary] -> ShowS)
-> Show AuthenticationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthenticationSummary] -> ShowS
$cshowList :: [AuthenticationSummary] -> ShowS
show :: AuthenticationSummary -> String
$cshow :: AuthenticationSummary -> String
showsPrec :: Int -> AuthenticationSummary -> ShowS
$cshowsPrec :: Int -> AuthenticationSummary -> ShowS
Prelude.Show, (forall x. AuthenticationSummary -> Rep AuthenticationSummary x)
-> (forall x. Rep AuthenticationSummary x -> AuthenticationSummary)
-> Generic AuthenticationSummary
forall x. Rep AuthenticationSummary x -> AuthenticationSummary
forall x. AuthenticationSummary -> Rep AuthenticationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuthenticationSummary x -> AuthenticationSummary
$cfrom :: forall x. AuthenticationSummary -> Rep AuthenticationSummary x
Prelude.Generic)

-- |
-- Create a value of 'AuthenticationSummary' 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:
--
-- 'samlConfigurationStatus', 'authenticationSummary_samlConfigurationStatus' - Specifies whether the workplace\'s user authentication method is fully
-- configured.
--
-- 'providers', 'authenticationSummary_providers' - Specifies whether the workspace uses SAML, Amazon Web Services SSO, or
-- both methods for user authentication.
newAuthenticationSummary ::
  AuthenticationSummary
newAuthenticationSummary :: AuthenticationSummary
newAuthenticationSummary =
  AuthenticationSummary' :: Maybe SamlConfigurationStatus
-> [AuthenticationProviderTypes] -> AuthenticationSummary
AuthenticationSummary'
    { $sel:samlConfigurationStatus:AuthenticationSummary' :: Maybe SamlConfigurationStatus
samlConfigurationStatus =
        Maybe SamlConfigurationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:providers:AuthenticationSummary' :: [AuthenticationProviderTypes]
providers = [AuthenticationProviderTypes]
forall a. Monoid a => a
Prelude.mempty
    }

-- | Specifies whether the workplace\'s user authentication method is fully
-- configured.
authenticationSummary_samlConfigurationStatus :: Lens.Lens' AuthenticationSummary (Prelude.Maybe SamlConfigurationStatus)
authenticationSummary_samlConfigurationStatus :: (Maybe SamlConfigurationStatus
 -> f (Maybe SamlConfigurationStatus))
-> AuthenticationSummary -> f AuthenticationSummary
authenticationSummary_samlConfigurationStatus = (AuthenticationSummary -> Maybe SamlConfigurationStatus)
-> (AuthenticationSummary
    -> Maybe SamlConfigurationStatus -> AuthenticationSummary)
-> Lens
     AuthenticationSummary
     AuthenticationSummary
     (Maybe SamlConfigurationStatus)
     (Maybe SamlConfigurationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticationSummary' {Maybe SamlConfigurationStatus
samlConfigurationStatus :: Maybe SamlConfigurationStatus
$sel:samlConfigurationStatus:AuthenticationSummary' :: AuthenticationSummary -> Maybe SamlConfigurationStatus
samlConfigurationStatus} -> Maybe SamlConfigurationStatus
samlConfigurationStatus) (\s :: AuthenticationSummary
s@AuthenticationSummary' {} Maybe SamlConfigurationStatus
a -> AuthenticationSummary
s {$sel:samlConfigurationStatus:AuthenticationSummary' :: Maybe SamlConfigurationStatus
samlConfigurationStatus = Maybe SamlConfigurationStatus
a} :: AuthenticationSummary)

-- | Specifies whether the workspace uses SAML, Amazon Web Services SSO, or
-- both methods for user authentication.
authenticationSummary_providers :: Lens.Lens' AuthenticationSummary [AuthenticationProviderTypes]
authenticationSummary_providers :: ([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
-> AuthenticationSummary -> f AuthenticationSummary
authenticationSummary_providers = (AuthenticationSummary -> [AuthenticationProviderTypes])
-> (AuthenticationSummary
    -> [AuthenticationProviderTypes] -> AuthenticationSummary)
-> Lens
     AuthenticationSummary
     AuthenticationSummary
     [AuthenticationProviderTypes]
     [AuthenticationProviderTypes]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticationSummary' {[AuthenticationProviderTypes]
providers :: [AuthenticationProviderTypes]
$sel:providers:AuthenticationSummary' :: AuthenticationSummary -> [AuthenticationProviderTypes]
providers} -> [AuthenticationProviderTypes]
providers) (\s :: AuthenticationSummary
s@AuthenticationSummary' {} [AuthenticationProviderTypes]
a -> AuthenticationSummary
s {$sel:providers:AuthenticationSummary' :: [AuthenticationProviderTypes]
providers = [AuthenticationProviderTypes]
a} :: AuthenticationSummary) (([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
 -> AuthenticationSummary -> f AuthenticationSummary)
-> (([AuthenticationProviderTypes]
     -> f [AuthenticationProviderTypes])
    -> [AuthenticationProviderTypes]
    -> f [AuthenticationProviderTypes])
-> ([AuthenticationProviderTypes]
    -> f [AuthenticationProviderTypes])
-> AuthenticationSummary
-> f AuthenticationSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
-> [AuthenticationProviderTypes] -> f [AuthenticationProviderTypes]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON AuthenticationSummary where
  parseJSON :: Value -> Parser AuthenticationSummary
parseJSON =
    String
-> (Object -> Parser AuthenticationSummary)
-> Value
-> Parser AuthenticationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuthenticationSummary"
      ( \Object
x ->
          Maybe SamlConfigurationStatus
-> [AuthenticationProviderTypes] -> AuthenticationSummary
AuthenticationSummary'
            (Maybe SamlConfigurationStatus
 -> [AuthenticationProviderTypes] -> AuthenticationSummary)
-> Parser (Maybe SamlConfigurationStatus)
-> Parser ([AuthenticationProviderTypes] -> AuthenticationSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SamlConfigurationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"samlConfigurationStatus")
            Parser ([AuthenticationProviderTypes] -> AuthenticationSummary)
-> Parser [AuthenticationProviderTypes]
-> Parser AuthenticationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [AuthenticationProviderTypes])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"providers" Parser (Maybe [AuthenticationProviderTypes])
-> [AuthenticationProviderTypes]
-> Parser [AuthenticationProviderTypes]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AuthenticationProviderTypes]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AuthenticationSummary

instance Prelude.NFData AuthenticationSummary