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

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

-- | A structure that describes whether the workspace uses SAML, IAM Identity
-- Center, 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, IAM Identity Center, or both
    -- methods for user authentication.
    AuthenticationSummary -> [AuthenticationProviderTypes]
providers :: [AuthenticationProviderTypes]
  }
  deriving (AuthenticationSummary -> AuthenticationSummary -> Bool
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]
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
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. 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, IAM Identity Center, or both
-- methods for user authentication.
newAuthenticationSummary ::
  AuthenticationSummary
newAuthenticationSummary :: AuthenticationSummary
newAuthenticationSummary =
  AuthenticationSummary'
    { $sel:samlConfigurationStatus:AuthenticationSummary' :: Maybe SamlConfigurationStatus
samlConfigurationStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:providers:AuthenticationSummary' :: [AuthenticationProviderTypes]
providers = 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 :: Lens' AuthenticationSummary (Maybe SamlConfigurationStatus)
authenticationSummary_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, IAM Identity Center, or both
-- methods for user authentication.
authenticationSummary_providers :: Lens.Lens' AuthenticationSummary [AuthenticationProviderTypes]
authenticationSummary_providers :: Lens' AuthenticationSummary [AuthenticationProviderTypes]
authenticationSummary_providers = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON AuthenticationSummary where
  parseJSON :: Value -> Parser AuthenticationSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AuthenticationSummary"
      ( \Object
x ->
          Maybe SamlConfigurationStatus
-> [AuthenticationProviderTypes] -> AuthenticationSummary
AuthenticationSummary'
            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
"samlConfigurationStatus")
            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
"providers" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable AuthenticationSummary where
  hashWithSalt :: Int -> AuthenticationSummary -> Int
hashWithSalt Int
_salt AuthenticationSummary' {[AuthenticationProviderTypes]
Maybe SamlConfigurationStatus
providers :: [AuthenticationProviderTypes]
samlConfigurationStatus :: Maybe SamlConfigurationStatus
$sel:providers:AuthenticationSummary' :: AuthenticationSummary -> [AuthenticationProviderTypes]
$sel:samlConfigurationStatus:AuthenticationSummary' :: AuthenticationSummary -> Maybe SamlConfigurationStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SamlConfigurationStatus
samlConfigurationStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [AuthenticationProviderTypes]
providers

instance Prelude.NFData AuthenticationSummary where
  rnf :: AuthenticationSummary -> ()
rnf AuthenticationSummary' {[AuthenticationProviderTypes]
Maybe SamlConfigurationStatus
providers :: [AuthenticationProviderTypes]
samlConfigurationStatus :: Maybe SamlConfigurationStatus
$sel:providers:AuthenticationSummary' :: AuthenticationSummary -> [AuthenticationProviderTypes]
$sel:samlConfigurationStatus:AuthenticationSummary' :: AuthenticationSummary -> Maybe SamlConfigurationStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SamlConfigurationStatus
samlConfigurationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AuthenticationProviderTypes]
providers