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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'OIDC' 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:
--
-- 'issuer', 'oidc_issuer' - The issuer URL for the OIDC identity provider.
newOIDC ::
  OIDC
newOIDC :: OIDC
newOIDC = OIDC' {$sel:issuer:OIDC' :: Maybe Text
issuer = forall a. Maybe a
Prelude.Nothing}

-- | The issuer URL for the OIDC identity provider.
oidc_issuer :: Lens.Lens' OIDC (Prelude.Maybe Prelude.Text)
oidc_issuer :: Lens' OIDC (Maybe Text)
oidc_issuer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OIDC' {Maybe Text
issuer :: Maybe Text
$sel:issuer:OIDC' :: OIDC -> Maybe Text
issuer} -> Maybe Text
issuer) (\s :: OIDC
s@OIDC' {} Maybe Text
a -> OIDC
s {$sel:issuer:OIDC' :: Maybe Text
issuer = Maybe Text
a} :: OIDC)

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

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

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