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

import Amazonka.CloudWatchEvents.Types.ConnectionHttpParameters
import Amazonka.CloudWatchEvents.Types.ConnectionOAuthHttpMethod
import Amazonka.CloudWatchEvents.Types.UpdateConnectionOAuthClientRequestParameters
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the OAuth request parameters to use for the connection.
--
-- /See:/ 'newUpdateConnectionOAuthRequestParameters' smart constructor.
data UpdateConnectionOAuthRequestParameters = UpdateConnectionOAuthRequestParameters'
  { -- | The method used to connect to the HTTP endpoint.
    UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionOAuthHttpMethod
httpMethod :: Prelude.Maybe ConnectionOAuthHttpMethod,
    -- | A @UpdateConnectionOAuthClientRequestParameters@ object that contains
    -- the client parameters to use for the connection when OAuth is specified
    -- as the authorization type.
    UpdateConnectionOAuthRequestParameters
-> Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters :: Prelude.Maybe UpdateConnectionOAuthClientRequestParameters,
    -- | The additional HTTP parameters used for the OAuth authorization request.
    UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionHttpParameters
oAuthHttpParameters :: Prelude.Maybe ConnectionHttpParameters,
    -- | The URL to the authorization endpoint when OAuth is specified as the
    -- authorization type.
    UpdateConnectionOAuthRequestParameters -> Maybe Text
authorizationEndpoint :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateConnectionOAuthRequestParameters
-> UpdateConnectionOAuthRequestParameters -> Bool
(UpdateConnectionOAuthRequestParameters
 -> UpdateConnectionOAuthRequestParameters -> Bool)
-> (UpdateConnectionOAuthRequestParameters
    -> UpdateConnectionOAuthRequestParameters -> Bool)
-> Eq UpdateConnectionOAuthRequestParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnectionOAuthRequestParameters
-> UpdateConnectionOAuthRequestParameters -> Bool
$c/= :: UpdateConnectionOAuthRequestParameters
-> UpdateConnectionOAuthRequestParameters -> Bool
== :: UpdateConnectionOAuthRequestParameters
-> UpdateConnectionOAuthRequestParameters -> Bool
$c== :: UpdateConnectionOAuthRequestParameters
-> UpdateConnectionOAuthRequestParameters -> Bool
Prelude.Eq, ReadPrec [UpdateConnectionOAuthRequestParameters]
ReadPrec UpdateConnectionOAuthRequestParameters
Int -> ReadS UpdateConnectionOAuthRequestParameters
ReadS [UpdateConnectionOAuthRequestParameters]
(Int -> ReadS UpdateConnectionOAuthRequestParameters)
-> ReadS [UpdateConnectionOAuthRequestParameters]
-> ReadPrec UpdateConnectionOAuthRequestParameters
-> ReadPrec [UpdateConnectionOAuthRequestParameters]
-> Read UpdateConnectionOAuthRequestParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnectionOAuthRequestParameters]
$creadListPrec :: ReadPrec [UpdateConnectionOAuthRequestParameters]
readPrec :: ReadPrec UpdateConnectionOAuthRequestParameters
$creadPrec :: ReadPrec UpdateConnectionOAuthRequestParameters
readList :: ReadS [UpdateConnectionOAuthRequestParameters]
$creadList :: ReadS [UpdateConnectionOAuthRequestParameters]
readsPrec :: Int -> ReadS UpdateConnectionOAuthRequestParameters
$creadsPrec :: Int -> ReadS UpdateConnectionOAuthRequestParameters
Prelude.Read, Int -> UpdateConnectionOAuthRequestParameters -> ShowS
[UpdateConnectionOAuthRequestParameters] -> ShowS
UpdateConnectionOAuthRequestParameters -> String
(Int -> UpdateConnectionOAuthRequestParameters -> ShowS)
-> (UpdateConnectionOAuthRequestParameters -> String)
-> ([UpdateConnectionOAuthRequestParameters] -> ShowS)
-> Show UpdateConnectionOAuthRequestParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnectionOAuthRequestParameters] -> ShowS
$cshowList :: [UpdateConnectionOAuthRequestParameters] -> ShowS
show :: UpdateConnectionOAuthRequestParameters -> String
$cshow :: UpdateConnectionOAuthRequestParameters -> String
showsPrec :: Int -> UpdateConnectionOAuthRequestParameters -> ShowS
$cshowsPrec :: Int -> UpdateConnectionOAuthRequestParameters -> ShowS
Prelude.Show, (forall x.
 UpdateConnectionOAuthRequestParameters
 -> Rep UpdateConnectionOAuthRequestParameters x)
-> (forall x.
    Rep UpdateConnectionOAuthRequestParameters x
    -> UpdateConnectionOAuthRequestParameters)
-> Generic UpdateConnectionOAuthRequestParameters
forall x.
Rep UpdateConnectionOAuthRequestParameters x
-> UpdateConnectionOAuthRequestParameters
forall x.
UpdateConnectionOAuthRequestParameters
-> Rep UpdateConnectionOAuthRequestParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateConnectionOAuthRequestParameters x
-> UpdateConnectionOAuthRequestParameters
$cfrom :: forall x.
UpdateConnectionOAuthRequestParameters
-> Rep UpdateConnectionOAuthRequestParameters x
Prelude.Generic)

-- |
-- Create a value of 'UpdateConnectionOAuthRequestParameters' 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:
--
-- 'httpMethod', 'updateConnectionOAuthRequestParameters_httpMethod' - The method used to connect to the HTTP endpoint.
--
-- 'clientParameters', 'updateConnectionOAuthRequestParameters_clientParameters' - A @UpdateConnectionOAuthClientRequestParameters@ object that contains
-- the client parameters to use for the connection when OAuth is specified
-- as the authorization type.
--
-- 'oAuthHttpParameters', 'updateConnectionOAuthRequestParameters_oAuthHttpParameters' - The additional HTTP parameters used for the OAuth authorization request.
--
-- 'authorizationEndpoint', 'updateConnectionOAuthRequestParameters_authorizationEndpoint' - The URL to the authorization endpoint when OAuth is specified as the
-- authorization type.
newUpdateConnectionOAuthRequestParameters ::
  UpdateConnectionOAuthRequestParameters
newUpdateConnectionOAuthRequestParameters :: UpdateConnectionOAuthRequestParameters
newUpdateConnectionOAuthRequestParameters =
  UpdateConnectionOAuthRequestParameters' :: Maybe ConnectionOAuthHttpMethod
-> Maybe UpdateConnectionOAuthClientRequestParameters
-> Maybe ConnectionHttpParameters
-> Maybe Text
-> UpdateConnectionOAuthRequestParameters
UpdateConnectionOAuthRequestParameters'
    { $sel:httpMethod:UpdateConnectionOAuthRequestParameters' :: Maybe ConnectionOAuthHttpMethod
httpMethod =
        Maybe ConnectionOAuthHttpMethod
forall a. Maybe a
Prelude.Nothing,
      $sel:clientParameters:UpdateConnectionOAuthRequestParameters' :: Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters = Maybe UpdateConnectionOAuthClientRequestParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:oAuthHttpParameters:UpdateConnectionOAuthRequestParameters' :: Maybe ConnectionHttpParameters
oAuthHttpParameters =
        Maybe ConnectionHttpParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationEndpoint:UpdateConnectionOAuthRequestParameters' :: Maybe Text
authorizationEndpoint =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The method used to connect to the HTTP endpoint.
updateConnectionOAuthRequestParameters_httpMethod :: Lens.Lens' UpdateConnectionOAuthRequestParameters (Prelude.Maybe ConnectionOAuthHttpMethod)
updateConnectionOAuthRequestParameters_httpMethod :: (Maybe ConnectionOAuthHttpMethod
 -> f (Maybe ConnectionOAuthHttpMethod))
-> UpdateConnectionOAuthRequestParameters
-> f UpdateConnectionOAuthRequestParameters
updateConnectionOAuthRequestParameters_httpMethod = (UpdateConnectionOAuthRequestParameters
 -> Maybe ConnectionOAuthHttpMethod)
-> (UpdateConnectionOAuthRequestParameters
    -> Maybe ConnectionOAuthHttpMethod
    -> UpdateConnectionOAuthRequestParameters)
-> Lens
     UpdateConnectionOAuthRequestParameters
     UpdateConnectionOAuthRequestParameters
     (Maybe ConnectionOAuthHttpMethod)
     (Maybe ConnectionOAuthHttpMethod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionOAuthRequestParameters' {Maybe ConnectionOAuthHttpMethod
httpMethod :: Maybe ConnectionOAuthHttpMethod
$sel:httpMethod:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionOAuthHttpMethod
httpMethod} -> Maybe ConnectionOAuthHttpMethod
httpMethod) (\s :: UpdateConnectionOAuthRequestParameters
s@UpdateConnectionOAuthRequestParameters' {} Maybe ConnectionOAuthHttpMethod
a -> UpdateConnectionOAuthRequestParameters
s {$sel:httpMethod:UpdateConnectionOAuthRequestParameters' :: Maybe ConnectionOAuthHttpMethod
httpMethod = Maybe ConnectionOAuthHttpMethod
a} :: UpdateConnectionOAuthRequestParameters)

-- | A @UpdateConnectionOAuthClientRequestParameters@ object that contains
-- the client parameters to use for the connection when OAuth is specified
-- as the authorization type.
updateConnectionOAuthRequestParameters_clientParameters :: Lens.Lens' UpdateConnectionOAuthRequestParameters (Prelude.Maybe UpdateConnectionOAuthClientRequestParameters)
updateConnectionOAuthRequestParameters_clientParameters :: (Maybe UpdateConnectionOAuthClientRequestParameters
 -> f (Maybe UpdateConnectionOAuthClientRequestParameters))
-> UpdateConnectionOAuthRequestParameters
-> f UpdateConnectionOAuthRequestParameters
updateConnectionOAuthRequestParameters_clientParameters = (UpdateConnectionOAuthRequestParameters
 -> Maybe UpdateConnectionOAuthClientRequestParameters)
-> (UpdateConnectionOAuthRequestParameters
    -> Maybe UpdateConnectionOAuthClientRequestParameters
    -> UpdateConnectionOAuthRequestParameters)
-> Lens
     UpdateConnectionOAuthRequestParameters
     UpdateConnectionOAuthRequestParameters
     (Maybe UpdateConnectionOAuthClientRequestParameters)
     (Maybe UpdateConnectionOAuthClientRequestParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionOAuthRequestParameters' {Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters :: Maybe UpdateConnectionOAuthClientRequestParameters
$sel:clientParameters:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters} -> Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters) (\s :: UpdateConnectionOAuthRequestParameters
s@UpdateConnectionOAuthRequestParameters' {} Maybe UpdateConnectionOAuthClientRequestParameters
a -> UpdateConnectionOAuthRequestParameters
s {$sel:clientParameters:UpdateConnectionOAuthRequestParameters' :: Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters = Maybe UpdateConnectionOAuthClientRequestParameters
a} :: UpdateConnectionOAuthRequestParameters)

-- | The additional HTTP parameters used for the OAuth authorization request.
updateConnectionOAuthRequestParameters_oAuthHttpParameters :: Lens.Lens' UpdateConnectionOAuthRequestParameters (Prelude.Maybe ConnectionHttpParameters)
updateConnectionOAuthRequestParameters_oAuthHttpParameters :: (Maybe ConnectionHttpParameters
 -> f (Maybe ConnectionHttpParameters))
-> UpdateConnectionOAuthRequestParameters
-> f UpdateConnectionOAuthRequestParameters
updateConnectionOAuthRequestParameters_oAuthHttpParameters = (UpdateConnectionOAuthRequestParameters
 -> Maybe ConnectionHttpParameters)
-> (UpdateConnectionOAuthRequestParameters
    -> Maybe ConnectionHttpParameters
    -> UpdateConnectionOAuthRequestParameters)
-> Lens
     UpdateConnectionOAuthRequestParameters
     UpdateConnectionOAuthRequestParameters
     (Maybe ConnectionHttpParameters)
     (Maybe ConnectionHttpParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionOAuthRequestParameters' {Maybe ConnectionHttpParameters
oAuthHttpParameters :: Maybe ConnectionHttpParameters
$sel:oAuthHttpParameters:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionHttpParameters
oAuthHttpParameters} -> Maybe ConnectionHttpParameters
oAuthHttpParameters) (\s :: UpdateConnectionOAuthRequestParameters
s@UpdateConnectionOAuthRequestParameters' {} Maybe ConnectionHttpParameters
a -> UpdateConnectionOAuthRequestParameters
s {$sel:oAuthHttpParameters:UpdateConnectionOAuthRequestParameters' :: Maybe ConnectionHttpParameters
oAuthHttpParameters = Maybe ConnectionHttpParameters
a} :: UpdateConnectionOAuthRequestParameters)

-- | The URL to the authorization endpoint when OAuth is specified as the
-- authorization type.
updateConnectionOAuthRequestParameters_authorizationEndpoint :: Lens.Lens' UpdateConnectionOAuthRequestParameters (Prelude.Maybe Prelude.Text)
updateConnectionOAuthRequestParameters_authorizationEndpoint :: (Maybe Text -> f (Maybe Text))
-> UpdateConnectionOAuthRequestParameters
-> f UpdateConnectionOAuthRequestParameters
updateConnectionOAuthRequestParameters_authorizationEndpoint = (UpdateConnectionOAuthRequestParameters -> Maybe Text)
-> (UpdateConnectionOAuthRequestParameters
    -> Maybe Text -> UpdateConnectionOAuthRequestParameters)
-> Lens
     UpdateConnectionOAuthRequestParameters
     UpdateConnectionOAuthRequestParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectionOAuthRequestParameters' {Maybe Text
authorizationEndpoint :: Maybe Text
$sel:authorizationEndpoint:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters -> Maybe Text
authorizationEndpoint} -> Maybe Text
authorizationEndpoint) (\s :: UpdateConnectionOAuthRequestParameters
s@UpdateConnectionOAuthRequestParameters' {} Maybe Text
a -> UpdateConnectionOAuthRequestParameters
s {$sel:authorizationEndpoint:UpdateConnectionOAuthRequestParameters' :: Maybe Text
authorizationEndpoint = Maybe Text
a} :: UpdateConnectionOAuthRequestParameters)

instance
  Prelude.Hashable
    UpdateConnectionOAuthRequestParameters

instance
  Prelude.NFData
    UpdateConnectionOAuthRequestParameters

instance
  Core.ToJSON
    UpdateConnectionOAuthRequestParameters
  where
  toJSON :: UpdateConnectionOAuthRequestParameters -> Value
toJSON UpdateConnectionOAuthRequestParameters' {Maybe Text
Maybe ConnectionOAuthHttpMethod
Maybe ConnectionHttpParameters
Maybe UpdateConnectionOAuthClientRequestParameters
authorizationEndpoint :: Maybe Text
oAuthHttpParameters :: Maybe ConnectionHttpParameters
clientParameters :: Maybe UpdateConnectionOAuthClientRequestParameters
httpMethod :: Maybe ConnectionOAuthHttpMethod
$sel:authorizationEndpoint:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters -> Maybe Text
$sel:oAuthHttpParameters:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionHttpParameters
$sel:clientParameters:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe UpdateConnectionOAuthClientRequestParameters
$sel:httpMethod:UpdateConnectionOAuthRequestParameters' :: UpdateConnectionOAuthRequestParameters
-> Maybe ConnectionOAuthHttpMethod
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HttpMethod" Text -> ConnectionOAuthHttpMethod -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConnectionOAuthHttpMethod -> Pair)
-> Maybe ConnectionOAuthHttpMethod -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConnectionOAuthHttpMethod
httpMethod,
            (Text
"ClientParameters" Text -> UpdateConnectionOAuthClientRequestParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UpdateConnectionOAuthClientRequestParameters -> Pair)
-> Maybe UpdateConnectionOAuthClientRequestParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateConnectionOAuthClientRequestParameters
clientParameters,
            (Text
"OAuthHttpParameters" Text -> ConnectionHttpParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConnectionHttpParameters -> Pair)
-> Maybe ConnectionHttpParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConnectionHttpParameters
oAuthHttpParameters,
            (Text
"AuthorizationEndpoint" 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
authorizationEndpoint
          ]
      )