{-# 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.CreateConnectionOAuthClientRequestParameters
-- 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.CreateConnectionOAuthClientRequestParameters 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:/ 'newCreateConnectionOAuthClientRequestParameters' smart constructor.
data CreateConnectionOAuthClientRequestParameters = CreateConnectionOAuthClientRequestParameters'
  { -- | The client ID to use for OAuth authorization for the connection.
    CreateConnectionOAuthClientRequestParameters -> Text
clientID :: Prelude.Text,
    -- | The client secret associated with the client ID to use for OAuth
    -- authorization for the connection.
    CreateConnectionOAuthClientRequestParameters -> Text
clientSecret :: Prelude.Text
  }
  deriving (CreateConnectionOAuthClientRequestParameters
-> CreateConnectionOAuthClientRequestParameters -> Bool
(CreateConnectionOAuthClientRequestParameters
 -> CreateConnectionOAuthClientRequestParameters -> Bool)
-> (CreateConnectionOAuthClientRequestParameters
    -> CreateConnectionOAuthClientRequestParameters -> Bool)
-> Eq CreateConnectionOAuthClientRequestParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionOAuthClientRequestParameters
-> CreateConnectionOAuthClientRequestParameters -> Bool
$c/= :: CreateConnectionOAuthClientRequestParameters
-> CreateConnectionOAuthClientRequestParameters -> Bool
== :: CreateConnectionOAuthClientRequestParameters
-> CreateConnectionOAuthClientRequestParameters -> Bool
$c== :: CreateConnectionOAuthClientRequestParameters
-> CreateConnectionOAuthClientRequestParameters -> Bool
Prelude.Eq, ReadPrec [CreateConnectionOAuthClientRequestParameters]
ReadPrec CreateConnectionOAuthClientRequestParameters
Int -> ReadS CreateConnectionOAuthClientRequestParameters
ReadS [CreateConnectionOAuthClientRequestParameters]
(Int -> ReadS CreateConnectionOAuthClientRequestParameters)
-> ReadS [CreateConnectionOAuthClientRequestParameters]
-> ReadPrec CreateConnectionOAuthClientRequestParameters
-> ReadPrec [CreateConnectionOAuthClientRequestParameters]
-> Read CreateConnectionOAuthClientRequestParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionOAuthClientRequestParameters]
$creadListPrec :: ReadPrec [CreateConnectionOAuthClientRequestParameters]
readPrec :: ReadPrec CreateConnectionOAuthClientRequestParameters
$creadPrec :: ReadPrec CreateConnectionOAuthClientRequestParameters
readList :: ReadS [CreateConnectionOAuthClientRequestParameters]
$creadList :: ReadS [CreateConnectionOAuthClientRequestParameters]
readsPrec :: Int -> ReadS CreateConnectionOAuthClientRequestParameters
$creadsPrec :: Int -> ReadS CreateConnectionOAuthClientRequestParameters
Prelude.Read, Int -> CreateConnectionOAuthClientRequestParameters -> ShowS
[CreateConnectionOAuthClientRequestParameters] -> ShowS
CreateConnectionOAuthClientRequestParameters -> String
(Int -> CreateConnectionOAuthClientRequestParameters -> ShowS)
-> (CreateConnectionOAuthClientRequestParameters -> String)
-> ([CreateConnectionOAuthClientRequestParameters] -> ShowS)
-> Show CreateConnectionOAuthClientRequestParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionOAuthClientRequestParameters] -> ShowS
$cshowList :: [CreateConnectionOAuthClientRequestParameters] -> ShowS
show :: CreateConnectionOAuthClientRequestParameters -> String
$cshow :: CreateConnectionOAuthClientRequestParameters -> String
showsPrec :: Int -> CreateConnectionOAuthClientRequestParameters -> ShowS
$cshowsPrec :: Int -> CreateConnectionOAuthClientRequestParameters -> ShowS
Prelude.Show, (forall x.
 CreateConnectionOAuthClientRequestParameters
 -> Rep CreateConnectionOAuthClientRequestParameters x)
-> (forall x.
    Rep CreateConnectionOAuthClientRequestParameters x
    -> CreateConnectionOAuthClientRequestParameters)
-> Generic CreateConnectionOAuthClientRequestParameters
forall x.
Rep CreateConnectionOAuthClientRequestParameters x
-> CreateConnectionOAuthClientRequestParameters
forall x.
CreateConnectionOAuthClientRequestParameters
-> Rep CreateConnectionOAuthClientRequestParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConnectionOAuthClientRequestParameters x
-> CreateConnectionOAuthClientRequestParameters
$cfrom :: forall x.
CreateConnectionOAuthClientRequestParameters
-> Rep CreateConnectionOAuthClientRequestParameters x
Prelude.Generic)

-- |
-- Create a value of 'CreateConnectionOAuthClientRequestParameters' 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:
--
-- 'clientID', 'createConnectionOAuthClientRequestParameters_clientID' - The client ID to use for OAuth authorization for the connection.
--
-- 'clientSecret', 'createConnectionOAuthClientRequestParameters_clientSecret' - The client secret associated with the client ID to use for OAuth
-- authorization for the connection.
newCreateConnectionOAuthClientRequestParameters ::
  -- | 'clientID'
  Prelude.Text ->
  -- | 'clientSecret'
  Prelude.Text ->
  CreateConnectionOAuthClientRequestParameters
newCreateConnectionOAuthClientRequestParameters :: Text -> Text -> CreateConnectionOAuthClientRequestParameters
newCreateConnectionOAuthClientRequestParameters
  Text
pClientID_
  Text
pClientSecret_ =
    CreateConnectionOAuthClientRequestParameters' :: Text -> Text -> CreateConnectionOAuthClientRequestParameters
CreateConnectionOAuthClientRequestParameters'
      { $sel:clientID:CreateConnectionOAuthClientRequestParameters' :: Text
clientID =
          Text
pClientID_,
        $sel:clientSecret:CreateConnectionOAuthClientRequestParameters' :: Text
clientSecret = Text
pClientSecret_
      }

-- | The client ID to use for OAuth authorization for the connection.
createConnectionOAuthClientRequestParameters_clientID :: Lens.Lens' CreateConnectionOAuthClientRequestParameters Prelude.Text
createConnectionOAuthClientRequestParameters_clientID :: (Text -> f Text)
-> CreateConnectionOAuthClientRequestParameters
-> f CreateConnectionOAuthClientRequestParameters
createConnectionOAuthClientRequestParameters_clientID = (CreateConnectionOAuthClientRequestParameters -> Text)
-> (CreateConnectionOAuthClientRequestParameters
    -> Text -> CreateConnectionOAuthClientRequestParameters)
-> Lens
     CreateConnectionOAuthClientRequestParameters
     CreateConnectionOAuthClientRequestParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionOAuthClientRequestParameters' {Text
clientID :: Text
$sel:clientID:CreateConnectionOAuthClientRequestParameters' :: CreateConnectionOAuthClientRequestParameters -> Text
clientID} -> Text
clientID) (\s :: CreateConnectionOAuthClientRequestParameters
s@CreateConnectionOAuthClientRequestParameters' {} Text
a -> CreateConnectionOAuthClientRequestParameters
s {$sel:clientID:CreateConnectionOAuthClientRequestParameters' :: Text
clientID = Text
a} :: CreateConnectionOAuthClientRequestParameters)

-- | The client secret associated with the client ID to use for OAuth
-- authorization for the connection.
createConnectionOAuthClientRequestParameters_clientSecret :: Lens.Lens' CreateConnectionOAuthClientRequestParameters Prelude.Text
createConnectionOAuthClientRequestParameters_clientSecret :: (Text -> f Text)
-> CreateConnectionOAuthClientRequestParameters
-> f CreateConnectionOAuthClientRequestParameters
createConnectionOAuthClientRequestParameters_clientSecret = (CreateConnectionOAuthClientRequestParameters -> Text)
-> (CreateConnectionOAuthClientRequestParameters
    -> Text -> CreateConnectionOAuthClientRequestParameters)
-> Lens
     CreateConnectionOAuthClientRequestParameters
     CreateConnectionOAuthClientRequestParameters
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionOAuthClientRequestParameters' {Text
clientSecret :: Text
$sel:clientSecret:CreateConnectionOAuthClientRequestParameters' :: CreateConnectionOAuthClientRequestParameters -> Text
clientSecret} -> Text
clientSecret) (\s :: CreateConnectionOAuthClientRequestParameters
s@CreateConnectionOAuthClientRequestParameters' {} Text
a -> CreateConnectionOAuthClientRequestParameters
s {$sel:clientSecret:CreateConnectionOAuthClientRequestParameters' :: Text
clientSecret = Text
a} :: CreateConnectionOAuthClientRequestParameters)

instance
  Prelude.Hashable
    CreateConnectionOAuthClientRequestParameters

instance
  Prelude.NFData
    CreateConnectionOAuthClientRequestParameters

instance
  Core.ToJSON
    CreateConnectionOAuthClientRequestParameters
  where
  toJSON :: CreateConnectionOAuthClientRequestParameters -> Value
toJSON
    CreateConnectionOAuthClientRequestParameters' {Text
clientSecret :: Text
clientID :: Text
$sel:clientSecret:CreateConnectionOAuthClientRequestParameters' :: CreateConnectionOAuthClientRequestParameters -> Text
$sel:clientID:CreateConnectionOAuthClientRequestParameters' :: CreateConnectionOAuthClientRequestParameters -> 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
"ClientID" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientID),
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientSecret" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientSecret)
            ]
        )