{-# 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.EKS.Types.Identity
-- 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.EKS.Types.Identity where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types.OIDC
import qualified Amazonka.Prelude as Prelude

-- | An object representing an identity provider.
--
-- /See:/ 'newIdentity' smart constructor.
data Identity = Identity'
  { -- | An object representing the <https://openid.net/connect/ OpenID Connect>
    -- identity provider information.
    Identity -> Maybe OIDC
oidc :: Prelude.Maybe OIDC
  }
  deriving (Identity -> Identity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Identity -> Identity -> Bool
$c/= :: Identity -> Identity -> Bool
== :: Identity -> Identity -> Bool
$c== :: Identity -> Identity -> Bool
Prelude.Eq, ReadPrec [Identity]
ReadPrec Identity
Int -> ReadS Identity
ReadS [Identity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Identity]
$creadListPrec :: ReadPrec [Identity]
readPrec :: ReadPrec Identity
$creadPrec :: ReadPrec Identity
readList :: ReadS [Identity]
$creadList :: ReadS [Identity]
readsPrec :: Int -> ReadS Identity
$creadsPrec :: Int -> ReadS Identity
Prelude.Read, Int -> Identity -> ShowS
[Identity] -> ShowS
Identity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Identity] -> ShowS
$cshowList :: [Identity] -> ShowS
show :: Identity -> String
$cshow :: Identity -> String
showsPrec :: Int -> Identity -> ShowS
$cshowsPrec :: Int -> Identity -> ShowS
Prelude.Show, forall x. Rep Identity x -> Identity
forall x. Identity -> Rep Identity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Identity x -> Identity
$cfrom :: forall x. Identity -> Rep Identity x
Prelude.Generic)

-- |
-- Create a value of 'Identity' 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:
--
-- 'oidc', 'identity_oidc' - An object representing the <https://openid.net/connect/ OpenID Connect>
-- identity provider information.
newIdentity ::
  Identity
newIdentity :: Identity
newIdentity = Identity' {$sel:oidc:Identity' :: Maybe OIDC
oidc = forall a. Maybe a
Prelude.Nothing}

-- | An object representing the <https://openid.net/connect/ OpenID Connect>
-- identity provider information.
identity_oidc :: Lens.Lens' Identity (Prelude.Maybe OIDC)
identity_oidc :: Lens' Identity (Maybe OIDC)
identity_oidc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Identity' {Maybe OIDC
oidc :: Maybe OIDC
$sel:oidc:Identity' :: Identity -> Maybe OIDC
oidc} -> Maybe OIDC
oidc) (\s :: Identity
s@Identity' {} Maybe OIDC
a -> Identity
s {$sel:oidc:Identity' :: Maybe OIDC
oidc = Maybe OIDC
a} :: Identity)

instance Data.FromJSON Identity where
  parseJSON :: Value -> Parser Identity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Identity"
      (\Object
x -> Maybe OIDC -> Identity
Identity' 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
"oidc"))

instance Prelude.Hashable Identity where
  hashWithSalt :: Int -> Identity -> Int
hashWithSalt Int
_salt Identity' {Maybe OIDC
oidc :: Maybe OIDC
$sel:oidc:Identity' :: Identity -> Maybe OIDC
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OIDC
oidc

instance Prelude.NFData Identity where
  rnf :: Identity -> ()
rnf Identity' {Maybe OIDC
oidc :: Maybe OIDC
$sel:oidc:Identity' :: Identity -> Maybe OIDC
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe OIDC
oidc