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

-- | 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
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]
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
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.
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'
    { $sel:username:ConnectionBasicAuthResponseParameters' :: Maybe Text
username =
        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 :: Lens' ConnectionBasicAuthResponseParameters (Maybe Text)
connectionBasicAuthResponseParameters_username = 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
  Data.FromJSON
    ConnectionBasicAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionBasicAuthResponseParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectionBasicAuthResponseParameters"
      ( \Object
x ->
          Maybe Text -> ConnectionBasicAuthResponseParameters
ConnectionBasicAuthResponseParameters'
            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
"Username")
      )

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

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