{-# 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-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.UpdateConnectionBasicAuthRequestParameters 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 Basic authorization parameters for the connection.
--
-- /See:/ 'newUpdateConnectionBasicAuthRequestParameters' smart constructor.
data UpdateConnectionBasicAuthRequestParameters = UpdateConnectionBasicAuthRequestParameters'
  { -- | The password associated with the user name to use for Basic
    -- authorization.
    UpdateConnectionBasicAuthRequestParameters -> Maybe Text
password :: Prelude.Maybe Prelude.Text,
    -- | The user name to use for Basic authorization.
    UpdateConnectionBasicAuthRequestParameters -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateConnectionBasicAuthRequestParameters
-> UpdateConnectionBasicAuthRequestParameters -> Bool
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]
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
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.
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:
--
-- 'password', 'updateConnectionBasicAuthRequestParameters_password' - The password associated with the user name to use for Basic
-- authorization.
--
-- 'username', 'updateConnectionBasicAuthRequestParameters_username' - The user name to use for Basic authorization.
newUpdateConnectionBasicAuthRequestParameters ::
  UpdateConnectionBasicAuthRequestParameters
newUpdateConnectionBasicAuthRequestParameters :: UpdateConnectionBasicAuthRequestParameters
newUpdateConnectionBasicAuthRequestParameters =
  UpdateConnectionBasicAuthRequestParameters'
    { $sel:password:UpdateConnectionBasicAuthRequestParameters' :: Maybe Text
password =
        forall a. Maybe a
Prelude.Nothing,
      $sel:username:UpdateConnectionBasicAuthRequestParameters' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

-- | The password associated with the user name to use for Basic
-- authorization.
updateConnectionBasicAuthRequestParameters_password :: Lens.Lens' UpdateConnectionBasicAuthRequestParameters (Prelude.Maybe Prelude.Text)
updateConnectionBasicAuthRequestParameters_password :: Lens' UpdateConnectionBasicAuthRequestParameters (Maybe Text)
updateConnectionBasicAuthRequestParameters_password = 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)

-- | The user name to use for Basic authorization.
updateConnectionBasicAuthRequestParameters_username :: Lens.Lens' UpdateConnectionBasicAuthRequestParameters (Prelude.Maybe Prelude.Text)
updateConnectionBasicAuthRequestParameters_username :: Lens' UpdateConnectionBasicAuthRequestParameters (Maybe Text)
updateConnectionBasicAuthRequestParameters_username = 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)

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

instance
  Prelude.NFData
    UpdateConnectionBasicAuthRequestParameters
  where
  rnf :: UpdateConnectionBasicAuthRequestParameters -> ()
rnf UpdateConnectionBasicAuthRequestParameters' {Maybe Text
username :: Maybe Text
password :: Maybe Text
$sel:username:UpdateConnectionBasicAuthRequestParameters' :: UpdateConnectionBasicAuthRequestParameters -> Maybe Text
$sel:password:UpdateConnectionBasicAuthRequestParameters' :: UpdateConnectionBasicAuthRequestParameters -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
password
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username

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