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

-- | The URL to the HTTP endpoint that authorized the request.
connectionOAuthResponseParameters_authorizationEndpoint :: Lens.Lens' ConnectionOAuthResponseParameters (Prelude.Maybe Prelude.Text)
connectionOAuthResponseParameters_authorizationEndpoint :: Lens' ConnectionOAuthResponseParameters (Maybe Text)
connectionOAuthResponseParameters_authorizationEndpoint = 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)

-- | 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 :: Lens'
  ConnectionOAuthResponseParameters
  (Maybe ConnectionOAuthClientResponseParameters)
connectionOAuthResponseParameters_clientParameters = 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 method used to connect to the HTTP endpoint.
connectionOAuthResponseParameters_httpMethod :: Lens.Lens' ConnectionOAuthResponseParameters (Prelude.Maybe ConnectionOAuthHttpMethod)
connectionOAuthResponseParameters_httpMethod :: Lens'
  ConnectionOAuthResponseParameters (Maybe ConnectionOAuthHttpMethod)
connectionOAuthResponseParameters_httpMethod = 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)

-- | The additional HTTP parameters used for the OAuth authorization request.
connectionOAuthResponseParameters_oAuthHttpParameters :: Lens.Lens' ConnectionOAuthResponseParameters (Prelude.Maybe ConnectionHttpParameters)
connectionOAuthResponseParameters_oAuthHttpParameters :: Lens'
  ConnectionOAuthResponseParameters (Maybe ConnectionHttpParameters)
connectionOAuthResponseParameters_oAuthHttpParameters = 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)

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

instance
  Prelude.Hashable
    ConnectionOAuthResponseParameters
  where
  hashWithSalt :: Int -> ConnectionOAuthResponseParameters -> Int
hashWithSalt
    Int
_salt
    ConnectionOAuthResponseParameters' {Maybe Text
Maybe ConnectionOAuthClientResponseParameters
Maybe ConnectionOAuthHttpMethod
Maybe ConnectionHttpParameters
oAuthHttpParameters :: Maybe ConnectionHttpParameters
httpMethod :: Maybe ConnectionOAuthHttpMethod
clientParameters :: Maybe ConnectionOAuthClientResponseParameters
authorizationEndpoint :: Maybe Text
$sel:oAuthHttpParameters:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters -> Maybe ConnectionHttpParameters
$sel:httpMethod:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters
-> Maybe ConnectionOAuthHttpMethod
$sel:clientParameters:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters
-> Maybe ConnectionOAuthClientResponseParameters
$sel:authorizationEndpoint:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizationEndpoint
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionOAuthClientResponseParameters
clientParameters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionOAuthHttpMethod
httpMethod
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionHttpParameters
oAuthHttpParameters

instance
  Prelude.NFData
    ConnectionOAuthResponseParameters
  where
  rnf :: ConnectionOAuthResponseParameters -> ()
rnf ConnectionOAuthResponseParameters' {Maybe Text
Maybe ConnectionOAuthClientResponseParameters
Maybe ConnectionOAuthHttpMethod
Maybe ConnectionHttpParameters
oAuthHttpParameters :: Maybe ConnectionHttpParameters
httpMethod :: Maybe ConnectionOAuthHttpMethod
clientParameters :: Maybe ConnectionOAuthClientResponseParameters
authorizationEndpoint :: Maybe Text
$sel:oAuthHttpParameters:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters -> Maybe ConnectionHttpParameters
$sel:httpMethod:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters
-> Maybe ConnectionOAuthHttpMethod
$sel:clientParameters:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters
-> Maybe ConnectionOAuthClientResponseParameters
$sel:authorizationEndpoint:ConnectionOAuthResponseParameters' :: ConnectionOAuthResponseParameters -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizationEndpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionOAuthClientResponseParameters
clientParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionOAuthHttpMethod
httpMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionHttpParameters
oAuthHttpParameters