{-# 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.Redshift.Types.AuthenticationProfile
-- 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.Redshift.Types.AuthenticationProfile where

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

-- | Describes an authentication profile.
--
-- /See:/ 'newAuthenticationProfile' smart constructor.
data AuthenticationProfile = AuthenticationProfile'
  { -- | The name of the authentication profile.
    AuthenticationProfile -> Maybe Text
authenticationProfileName :: Prelude.Maybe Prelude.Text,
    -- | The content of the authentication profile in JSON format. The maximum
    -- length of the JSON string is determined by a quota for your account.
    AuthenticationProfile -> Maybe Text
authenticationProfileContent :: Prelude.Maybe Prelude.Text
  }
  deriving (AuthenticationProfile -> AuthenticationProfile -> Bool
(AuthenticationProfile -> AuthenticationProfile -> Bool)
-> (AuthenticationProfile -> AuthenticationProfile -> Bool)
-> Eq AuthenticationProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthenticationProfile -> AuthenticationProfile -> Bool
$c/= :: AuthenticationProfile -> AuthenticationProfile -> Bool
== :: AuthenticationProfile -> AuthenticationProfile -> Bool
$c== :: AuthenticationProfile -> AuthenticationProfile -> Bool
Prelude.Eq, ReadPrec [AuthenticationProfile]
ReadPrec AuthenticationProfile
Int -> ReadS AuthenticationProfile
ReadS [AuthenticationProfile]
(Int -> ReadS AuthenticationProfile)
-> ReadS [AuthenticationProfile]
-> ReadPrec AuthenticationProfile
-> ReadPrec [AuthenticationProfile]
-> Read AuthenticationProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuthenticationProfile]
$creadListPrec :: ReadPrec [AuthenticationProfile]
readPrec :: ReadPrec AuthenticationProfile
$creadPrec :: ReadPrec AuthenticationProfile
readList :: ReadS [AuthenticationProfile]
$creadList :: ReadS [AuthenticationProfile]
readsPrec :: Int -> ReadS AuthenticationProfile
$creadsPrec :: Int -> ReadS AuthenticationProfile
Prelude.Read, Int -> AuthenticationProfile -> ShowS
[AuthenticationProfile] -> ShowS
AuthenticationProfile -> String
(Int -> AuthenticationProfile -> ShowS)
-> (AuthenticationProfile -> String)
-> ([AuthenticationProfile] -> ShowS)
-> Show AuthenticationProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuthenticationProfile] -> ShowS
$cshowList :: [AuthenticationProfile] -> ShowS
show :: AuthenticationProfile -> String
$cshow :: AuthenticationProfile -> String
showsPrec :: Int -> AuthenticationProfile -> ShowS
$cshowsPrec :: Int -> AuthenticationProfile -> ShowS
Prelude.Show, (forall x. AuthenticationProfile -> Rep AuthenticationProfile x)
-> (forall x. Rep AuthenticationProfile x -> AuthenticationProfile)
-> Generic AuthenticationProfile
forall x. Rep AuthenticationProfile x -> AuthenticationProfile
forall x. AuthenticationProfile -> Rep AuthenticationProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuthenticationProfile x -> AuthenticationProfile
$cfrom :: forall x. AuthenticationProfile -> Rep AuthenticationProfile x
Prelude.Generic)

-- |
-- Create a value of 'AuthenticationProfile' 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:
--
-- 'authenticationProfileName', 'authenticationProfile_authenticationProfileName' - The name of the authentication profile.
--
-- 'authenticationProfileContent', 'authenticationProfile_authenticationProfileContent' - The content of the authentication profile in JSON format. The maximum
-- length of the JSON string is determined by a quota for your account.
newAuthenticationProfile ::
  AuthenticationProfile
newAuthenticationProfile :: AuthenticationProfile
newAuthenticationProfile =
  AuthenticationProfile' :: Maybe Text -> Maybe Text -> AuthenticationProfile
AuthenticationProfile'
    { $sel:authenticationProfileName:AuthenticationProfile' :: Maybe Text
authenticationProfileName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationProfileContent:AuthenticationProfile' :: Maybe Text
authenticationProfileContent = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the authentication profile.
authenticationProfile_authenticationProfileName :: Lens.Lens' AuthenticationProfile (Prelude.Maybe Prelude.Text)
authenticationProfile_authenticationProfileName :: (Maybe Text -> f (Maybe Text))
-> AuthenticationProfile -> f AuthenticationProfile
authenticationProfile_authenticationProfileName = (AuthenticationProfile -> Maybe Text)
-> (AuthenticationProfile -> Maybe Text -> AuthenticationProfile)
-> Lens
     AuthenticationProfile
     AuthenticationProfile
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticationProfile' {Maybe Text
authenticationProfileName :: Maybe Text
$sel:authenticationProfileName:AuthenticationProfile' :: AuthenticationProfile -> Maybe Text
authenticationProfileName} -> Maybe Text
authenticationProfileName) (\s :: AuthenticationProfile
s@AuthenticationProfile' {} Maybe Text
a -> AuthenticationProfile
s {$sel:authenticationProfileName:AuthenticationProfile' :: Maybe Text
authenticationProfileName = Maybe Text
a} :: AuthenticationProfile)

-- | The content of the authentication profile in JSON format. The maximum
-- length of the JSON string is determined by a quota for your account.
authenticationProfile_authenticationProfileContent :: Lens.Lens' AuthenticationProfile (Prelude.Maybe Prelude.Text)
authenticationProfile_authenticationProfileContent :: (Maybe Text -> f (Maybe Text))
-> AuthenticationProfile -> f AuthenticationProfile
authenticationProfile_authenticationProfileContent = (AuthenticationProfile -> Maybe Text)
-> (AuthenticationProfile -> Maybe Text -> AuthenticationProfile)
-> Lens
     AuthenticationProfile
     AuthenticationProfile
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuthenticationProfile' {Maybe Text
authenticationProfileContent :: Maybe Text
$sel:authenticationProfileContent:AuthenticationProfile' :: AuthenticationProfile -> Maybe Text
authenticationProfileContent} -> Maybe Text
authenticationProfileContent) (\s :: AuthenticationProfile
s@AuthenticationProfile' {} Maybe Text
a -> AuthenticationProfile
s {$sel:authenticationProfileContent:AuthenticationProfile' :: Maybe Text
authenticationProfileContent = Maybe Text
a} :: AuthenticationProfile)

instance Core.FromXML AuthenticationProfile where
  parseXML :: [Node] -> Either String AuthenticationProfile
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> AuthenticationProfile
AuthenticationProfile'
      (Maybe Text -> Maybe Text -> AuthenticationProfile)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> AuthenticationProfile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AuthenticationProfileName")
      Either String (Maybe Text -> AuthenticationProfile)
-> Either String (Maybe Text)
-> Either String AuthenticationProfile
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AuthenticationProfileContent")

instance Prelude.Hashable AuthenticationProfile

instance Prelude.NFData AuthenticationProfile