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

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

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

-- |
-- Create a value of 'ConnectionOAuthResponseParameters' 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', 'connectionOAuthResponseParameters_httpMethod' - The method used to connect to the HTTP endpoint.
--
-- 'clientParameters', 'connectionOAuthResponseParameters_clientParameters' - A @ConnectionOAuthClientResponseParameters@ object that contains details
-- about the client parameters returned when OAuth is specified as the
-- authorization type.
--
-- 'oAuthHttpParameters', 'connectionOAuthResponseParameters_oAuthHttpParameters' - The additional HTTP parameters used for the OAuth authorization request.
--
-- 'authorizationEndpoint', 'connectionOAuthResponseParameters_authorizationEndpoint' - The URL to the HTTP endpoint that authorized the request.
newConnectionOAuthResponseParameters ::
  ConnectionOAuthResponseParameters
newConnectionOAuthResponseParameters :: ConnectionOAuthResponseParameters
newConnectionOAuthResponseParameters =
  ConnectionOAuthResponseParameters' :: Maybe ConnectionOAuthHttpMethod
-> Maybe ConnectionOAuthClientResponseParameters
-> Maybe ConnectionHttpParameters
-> Maybe Text
-> ConnectionOAuthResponseParameters
ConnectionOAuthResponseParameters'
    { $sel:httpMethod:ConnectionOAuthResponseParameters' :: Maybe ConnectionOAuthHttpMethod
httpMethod =
        Maybe ConnectionOAuthHttpMethod
forall a. Maybe a
Prelude.Nothing,
      $sel:clientParameters:ConnectionOAuthResponseParameters' :: Maybe ConnectionOAuthClientResponseParameters
clientParameters = Maybe ConnectionOAuthClientResponseParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:oAuthHttpParameters:ConnectionOAuthResponseParameters' :: Maybe ConnectionHttpParameters
oAuthHttpParameters = Maybe ConnectionHttpParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationEndpoint:ConnectionOAuthResponseParameters' :: Maybe Text
authorizationEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | A @ConnectionOAuthClientResponseParameters@ object that contains details
-- about the client parameters returned when OAuth is specified as the
-- authorization type.
connectionOAuthResponseParameters_clientParameters :: Lens.Lens' ConnectionOAuthResponseParameters (Prelude.Maybe ConnectionOAuthClientResponseParameters)
connectionOAuthResponseParameters_clientParameters :: (Maybe ConnectionOAuthClientResponseParameters
 -> f (Maybe ConnectionOAuthClientResponseParameters))
-> ConnectionOAuthResponseParameters
-> f ConnectionOAuthResponseParameters
connectionOAuthResponseParameters_clientParameters = (ConnectionOAuthResponseParameters
 -> Maybe ConnectionOAuthClientResponseParameters)
-> (ConnectionOAuthResponseParameters
    -> Maybe ConnectionOAuthClientResponseParameters
    -> ConnectionOAuthResponseParameters)
-> Lens
     ConnectionOAuthResponseParameters
     ConnectionOAuthResponseParameters
     (Maybe ConnectionOAuthClientResponseParameters)
     (Maybe ConnectionOAuthClientResponseParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionOAuthResponseParameters' {Maybe ConnectionOAuthClientResponseParameters
clientParameters :: Maybe ConnectionOAuthClientResponseParameters
$sel:clientParameters:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters
-> Maybe ConnectionOAuthClientResponseParameters
clientParameters} -> Maybe ConnectionOAuthClientResponseParameters
clientParameters) (\s :: ConnectionOAuthResponseParameters
s@ConnectionOAuthResponseParameters' {} Maybe ConnectionOAuthClientResponseParameters
a -> ConnectionOAuthResponseParameters
s {$sel:clientParameters:ConnectionOAuthResponseParameters' :: Maybe ConnectionOAuthClientResponseParameters
clientParameters = Maybe ConnectionOAuthClientResponseParameters
a} :: ConnectionOAuthResponseParameters)

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

-- | The URL to the HTTP endpoint that authorized the request.
connectionOAuthResponseParameters_authorizationEndpoint :: Lens.Lens' ConnectionOAuthResponseParameters (Prelude.Maybe Prelude.Text)
connectionOAuthResponseParameters_authorizationEndpoint :: (Maybe Text -> f (Maybe Text))
-> ConnectionOAuthResponseParameters
-> f ConnectionOAuthResponseParameters
connectionOAuthResponseParameters_authorizationEndpoint = (ConnectionOAuthResponseParameters -> Maybe Text)
-> (ConnectionOAuthResponseParameters
    -> Maybe Text -> ConnectionOAuthResponseParameters)
-> Lens
     ConnectionOAuthResponseParameters
     ConnectionOAuthResponseParameters
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionOAuthResponseParameters' {Maybe Text
authorizationEndpoint :: Maybe Text
$sel:authorizationEndpoint:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters -> Maybe Text
authorizationEndpoint} -> Maybe Text
authorizationEndpoint) (\s :: ConnectionOAuthResponseParameters
s@ConnectionOAuthResponseParameters' {} Maybe Text
a -> ConnectionOAuthResponseParameters
s {$sel:authorizationEndpoint:ConnectionOAuthResponseParameters' :: Maybe Text
authorizationEndpoint = Maybe Text
a} :: ConnectionOAuthResponseParameters)

instance
  Core.FromJSON
    ConnectionOAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionOAuthResponseParameters
parseJSON =
    String
-> (Object -> Parser ConnectionOAuthResponseParameters)
-> Value
-> Parser ConnectionOAuthResponseParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionOAuthResponseParameters"
      ( \Object
x ->
          Maybe ConnectionOAuthHttpMethod
-> Maybe ConnectionOAuthClientResponseParameters
-> Maybe ConnectionHttpParameters
-> Maybe Text
-> ConnectionOAuthResponseParameters
ConnectionOAuthResponseParameters'
            (Maybe ConnectionOAuthHttpMethod
 -> Maybe ConnectionOAuthClientResponseParameters
 -> Maybe ConnectionHttpParameters
 -> Maybe Text
 -> ConnectionOAuthResponseParameters)
-> Parser (Maybe ConnectionOAuthHttpMethod)
-> Parser
     (Maybe ConnectionOAuthClientResponseParameters
      -> Maybe ConnectionHttpParameters
      -> Maybe Text
      -> ConnectionOAuthResponseParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ConnectionOAuthHttpMethod)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HttpMethod")
            Parser
  (Maybe ConnectionOAuthClientResponseParameters
   -> Maybe ConnectionHttpParameters
   -> Maybe Text
   -> ConnectionOAuthResponseParameters)
-> Parser (Maybe ConnectionOAuthClientResponseParameters)
-> Parser
     (Maybe ConnectionHttpParameters
      -> Maybe Text -> ConnectionOAuthResponseParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe ConnectionOAuthClientResponseParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ClientParameters")
            Parser
  (Maybe ConnectionHttpParameters
   -> Maybe Text -> ConnectionOAuthResponseParameters)
-> Parser (Maybe ConnectionHttpParameters)
-> Parser (Maybe Text -> ConnectionOAuthResponseParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConnectionHttpParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OAuthHttpParameters")
            Parser (Maybe Text -> ConnectionOAuthResponseParameters)
-> Parser (Maybe Text) -> Parser ConnectionOAuthResponseParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AuthorizationEndpoint")
      )

instance
  Prelude.Hashable
    ConnectionOAuthResponseParameters

instance
  Prelude.NFData
    ConnectionOAuthResponseParameters