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

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

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

-- |
-- Create a value of 'CreateConnectionBasicAuthRequestParameters' 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', 'createConnectionBasicAuthRequestParameters_username' - The user name to use for Basic authorization.
--
-- 'password', 'createConnectionBasicAuthRequestParameters_password' - The password associated with the user name to use for Basic
-- authorization.
newCreateConnectionBasicAuthRequestParameters ::
  -- | 'username'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  CreateConnectionBasicAuthRequestParameters
newCreateConnectionBasicAuthRequestParameters :: Text -> Text -> CreateConnectionBasicAuthRequestParameters
newCreateConnectionBasicAuthRequestParameters
  Text
pUsername_
  Text
pPassword_ =
    CreateConnectionBasicAuthRequestParameters' :: Text -> Text -> CreateConnectionBasicAuthRequestParameters
CreateConnectionBasicAuthRequestParameters'
      { $sel:username:CreateConnectionBasicAuthRequestParameters' :: Text
username =
          Text
pUsername_,
        $sel:password:CreateConnectionBasicAuthRequestParameters' :: Text
password = Text
pPassword_
      }

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

-- | The password associated with the user name to use for Basic
-- authorization.
createConnectionBasicAuthRequestParameters_password :: Lens.Lens' CreateConnectionBasicAuthRequestParameters Prelude.Text
createConnectionBasicAuthRequestParameters_password :: (Text -> f Text)
-> CreateConnectionBasicAuthRequestParameters
-> f CreateConnectionBasicAuthRequestParameters
createConnectionBasicAuthRequestParameters_password = (CreateConnectionBasicAuthRequestParameters -> Text)
-> (CreateConnectionBasicAuthRequestParameters
    -> Text -> CreateConnectionBasicAuthRequestParameters)
-> Lens
     CreateConnectionBasicAuthRequestParameters
     CreateConnectionBasicAuthRequestParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionBasicAuthRequestParameters' {Text
password :: Text
$sel:password:CreateConnectionBasicAuthRequestParameters' :: CreateConnectionBasicAuthRequestParameters -> Text
password} -> Text
password) (\s :: CreateConnectionBasicAuthRequestParameters
s@CreateConnectionBasicAuthRequestParameters' {} Text
a -> CreateConnectionBasicAuthRequestParameters
s {$sel:password:CreateConnectionBasicAuthRequestParameters' :: Text
password = Text
a} :: CreateConnectionBasicAuthRequestParameters)

instance
  Prelude.Hashable
    CreateConnectionBasicAuthRequestParameters

instance
  Prelude.NFData
    CreateConnectionBasicAuthRequestParameters

instance
  Core.ToJSON
    CreateConnectionBasicAuthRequestParameters
  where
  toJSON :: CreateConnectionBasicAuthRequestParameters -> Value
toJSON
    CreateConnectionBasicAuthRequestParameters' {Text
password :: Text
username :: Text
$sel:password:CreateConnectionBasicAuthRequestParameters' :: CreateConnectionBasicAuthRequestParameters -> Text
$sel:username:CreateConnectionBasicAuthRequestParameters' :: CreateConnectionBasicAuthRequestParameters -> Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
username),
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
password)
            ]
        )