{-# 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.CloudWatchEvents.Types.ConnectionBasicAuthResponseParameters
-- 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.CloudWatchEvents.Types.ConnectionBasicAuthResponseParameters where

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

-- | Contains the authorization parameters for the connection if Basic is
-- specified as the authorization type.
--
-- /See:/ 'newConnectionBasicAuthResponseParameters' smart constructor.
data ConnectionBasicAuthResponseParameters = ConnectionBasicAuthResponseParameters'
  { -- | The user name to use for Basic authorization.
    ConnectionBasicAuthResponseParameters -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (ConnectionBasicAuthResponseParameters
-> ConnectionBasicAuthResponseParameters -> Bool
(ConnectionBasicAuthResponseParameters
 -> ConnectionBasicAuthResponseParameters -> Bool)
-> (ConnectionBasicAuthResponseParameters
    -> ConnectionBasicAuthResponseParameters -> Bool)
-> Eq ConnectionBasicAuthResponseParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionBasicAuthResponseParameters
-> ConnectionBasicAuthResponseParameters -> Bool
$c/= :: ConnectionBasicAuthResponseParameters
-> ConnectionBasicAuthResponseParameters -> Bool
== :: ConnectionBasicAuthResponseParameters
-> ConnectionBasicAuthResponseParameters -> Bool
$c== :: ConnectionBasicAuthResponseParameters
-> ConnectionBasicAuthResponseParameters -> Bool
Prelude.Eq, ReadPrec [ConnectionBasicAuthResponseParameters]
ReadPrec ConnectionBasicAuthResponseParameters
Int -> ReadS ConnectionBasicAuthResponseParameters
ReadS [ConnectionBasicAuthResponseParameters]
(Int -> ReadS ConnectionBasicAuthResponseParameters)
-> ReadS [ConnectionBasicAuthResponseParameters]
-> ReadPrec ConnectionBasicAuthResponseParameters
-> ReadPrec [ConnectionBasicAuthResponseParameters]
-> Read ConnectionBasicAuthResponseParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionBasicAuthResponseParameters]
$creadListPrec :: ReadPrec [ConnectionBasicAuthResponseParameters]
readPrec :: ReadPrec ConnectionBasicAuthResponseParameters
$creadPrec :: ReadPrec ConnectionBasicAuthResponseParameters
readList :: ReadS [ConnectionBasicAuthResponseParameters]
$creadList :: ReadS [ConnectionBasicAuthResponseParameters]
readsPrec :: Int -> ReadS ConnectionBasicAuthResponseParameters
$creadsPrec :: Int -> ReadS ConnectionBasicAuthResponseParameters
Prelude.Read, Int -> ConnectionBasicAuthResponseParameters -> ShowS
[ConnectionBasicAuthResponseParameters] -> ShowS
ConnectionBasicAuthResponseParameters -> String
(Int -> ConnectionBasicAuthResponseParameters -> ShowS)
-> (ConnectionBasicAuthResponseParameters -> String)
-> ([ConnectionBasicAuthResponseParameters] -> ShowS)
-> Show ConnectionBasicAuthResponseParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionBasicAuthResponseParameters] -> ShowS
$cshowList :: [ConnectionBasicAuthResponseParameters] -> ShowS
show :: ConnectionBasicAuthResponseParameters -> String
$cshow :: ConnectionBasicAuthResponseParameters -> String
showsPrec :: Int -> ConnectionBasicAuthResponseParameters -> ShowS
$cshowsPrec :: Int -> ConnectionBasicAuthResponseParameters -> ShowS
Prelude.Show, (forall x.
 ConnectionBasicAuthResponseParameters
 -> Rep ConnectionBasicAuthResponseParameters x)
-> (forall x.
    Rep ConnectionBasicAuthResponseParameters x
    -> ConnectionBasicAuthResponseParameters)
-> Generic ConnectionBasicAuthResponseParameters
forall x.
Rep ConnectionBasicAuthResponseParameters x
-> ConnectionBasicAuthResponseParameters
forall x.
ConnectionBasicAuthResponseParameters
-> Rep ConnectionBasicAuthResponseParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionBasicAuthResponseParameters x
-> ConnectionBasicAuthResponseParameters
$cfrom :: forall x.
ConnectionBasicAuthResponseParameters
-> Rep ConnectionBasicAuthResponseParameters x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionBasicAuthResponseParameters' 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:
--
-- 'username', 'connectionBasicAuthResponseParameters_username' - The user name to use for Basic authorization.
newConnectionBasicAuthResponseParameters ::
  ConnectionBasicAuthResponseParameters
newConnectionBasicAuthResponseParameters :: ConnectionBasicAuthResponseParameters
newConnectionBasicAuthResponseParameters =
  ConnectionBasicAuthResponseParameters' :: Maybe Text -> ConnectionBasicAuthResponseParameters
ConnectionBasicAuthResponseParameters'
    { $sel:username:ConnectionBasicAuthResponseParameters' :: Maybe Text
username =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The user name to use for Basic authorization.
connectionBasicAuthResponseParameters_username :: Lens.Lens' ConnectionBasicAuthResponseParameters (Prelude.Maybe Prelude.Text)
connectionBasicAuthResponseParameters_username :: (Maybe Text -> f (Maybe Text))
-> ConnectionBasicAuthResponseParameters
-> f ConnectionBasicAuthResponseParameters
connectionBasicAuthResponseParameters_username = (ConnectionBasicAuthResponseParameters -> Maybe Text)
-> (ConnectionBasicAuthResponseParameters
    -> Maybe Text -> ConnectionBasicAuthResponseParameters)
-> Lens
     ConnectionBasicAuthResponseParameters
     ConnectionBasicAuthResponseParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionBasicAuthResponseParameters' {Maybe Text
username :: Maybe Text
$sel:username:ConnectionBasicAuthResponseParameters' :: ConnectionBasicAuthResponseParameters -> Maybe Text
username} -> Maybe Text
username) (\s :: ConnectionBasicAuthResponseParameters
s@ConnectionBasicAuthResponseParameters' {} Maybe Text
a -> ConnectionBasicAuthResponseParameters
s {$sel:username:ConnectionBasicAuthResponseParameters' :: Maybe Text
username = Maybe Text
a} :: ConnectionBasicAuthResponseParameters)

instance
  Core.FromJSON
    ConnectionBasicAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionBasicAuthResponseParameters
parseJSON =
    String
-> (Object -> Parser ConnectionBasicAuthResponseParameters)
-> Value
-> Parser ConnectionBasicAuthResponseParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionBasicAuthResponseParameters"
      ( \Object
x ->
          Maybe Text -> ConnectionBasicAuthResponseParameters
ConnectionBasicAuthResponseParameters'
            (Maybe Text -> ConnectionBasicAuthResponseParameters)
-> Parser (Maybe Text)
-> Parser ConnectionBasicAuthResponseParameters
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Username")
      )

instance
  Prelude.Hashable
    ConnectionBasicAuthResponseParameters

instance
  Prelude.NFData
    ConnectionBasicAuthResponseParameters