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

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

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

-- |
-- Create a value of 'UpdateConnectionBasicAuthRequestParameters' 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', 'updateConnectionBasicAuthRequestParameters_username' - The user name to use for Basic authorization.
--
-- 'password', 'updateConnectionBasicAuthRequestParameters_password' - The password associated with the user name to use for Basic
-- authorization.
newUpdateConnectionBasicAuthRequestParameters ::
  UpdateConnectionBasicAuthRequestParameters
newUpdateConnectionBasicAuthRequestParameters :: UpdateConnectionBasicAuthRequestParameters
newUpdateConnectionBasicAuthRequestParameters =
  UpdateConnectionBasicAuthRequestParameters' :: Maybe Text
-> Maybe Text -> UpdateConnectionBasicAuthRequestParameters
UpdateConnectionBasicAuthRequestParameters'
    { $sel:username:UpdateConnectionBasicAuthRequestParameters' :: Maybe Text
username =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:password:UpdateConnectionBasicAuthRequestParameters' :: Maybe Text
password = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Prelude.Hashable
    UpdateConnectionBasicAuthRequestParameters

instance
  Prelude.NFData
    UpdateConnectionBasicAuthRequestParameters

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