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

import Amazonka.CloudWatchEvents.Types.ConnectionApiKeyAuthResponseParameters
import Amazonka.CloudWatchEvents.Types.ConnectionBasicAuthResponseParameters
import Amazonka.CloudWatchEvents.Types.ConnectionHttpParameters
import Amazonka.CloudWatchEvents.Types.ConnectionOAuthResponseParameters
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the authorization parameters to use for the connection.
--
-- /See:/ 'newConnectionAuthResponseParameters' smart constructor.
data ConnectionAuthResponseParameters = ConnectionAuthResponseParameters'
  { -- | The OAuth parameters to use for authorization.
    ConnectionAuthResponseParameters
-> Maybe ConnectionOAuthResponseParameters
oAuthParameters :: Prelude.Maybe ConnectionOAuthResponseParameters,
    -- | Additional parameters for the connection that are passed through with
    -- every invocation to the HTTP endpoint.
    ConnectionAuthResponseParameters -> Maybe ConnectionHttpParameters
invocationHttpParameters :: Prelude.Maybe ConnectionHttpParameters,
    -- | The API Key parameters to use for authorization.
    ConnectionAuthResponseParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters :: Prelude.Maybe ConnectionApiKeyAuthResponseParameters,
    -- | The authorization parameters for Basic authorization.
    ConnectionAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters :: Prelude.Maybe ConnectionBasicAuthResponseParameters
  }
  deriving (ConnectionAuthResponseParameters
-> ConnectionAuthResponseParameters -> Bool
(ConnectionAuthResponseParameters
 -> ConnectionAuthResponseParameters -> Bool)
-> (ConnectionAuthResponseParameters
    -> ConnectionAuthResponseParameters -> Bool)
-> Eq ConnectionAuthResponseParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionAuthResponseParameters
-> ConnectionAuthResponseParameters -> Bool
$c/= :: ConnectionAuthResponseParameters
-> ConnectionAuthResponseParameters -> Bool
== :: ConnectionAuthResponseParameters
-> ConnectionAuthResponseParameters -> Bool
$c== :: ConnectionAuthResponseParameters
-> ConnectionAuthResponseParameters -> Bool
Prelude.Eq, ReadPrec [ConnectionAuthResponseParameters]
ReadPrec ConnectionAuthResponseParameters
Int -> ReadS ConnectionAuthResponseParameters
ReadS [ConnectionAuthResponseParameters]
(Int -> ReadS ConnectionAuthResponseParameters)
-> ReadS [ConnectionAuthResponseParameters]
-> ReadPrec ConnectionAuthResponseParameters
-> ReadPrec [ConnectionAuthResponseParameters]
-> Read ConnectionAuthResponseParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionAuthResponseParameters]
$creadListPrec :: ReadPrec [ConnectionAuthResponseParameters]
readPrec :: ReadPrec ConnectionAuthResponseParameters
$creadPrec :: ReadPrec ConnectionAuthResponseParameters
readList :: ReadS [ConnectionAuthResponseParameters]
$creadList :: ReadS [ConnectionAuthResponseParameters]
readsPrec :: Int -> ReadS ConnectionAuthResponseParameters
$creadsPrec :: Int -> ReadS ConnectionAuthResponseParameters
Prelude.Read, Int -> ConnectionAuthResponseParameters -> ShowS
[ConnectionAuthResponseParameters] -> ShowS
ConnectionAuthResponseParameters -> String
(Int -> ConnectionAuthResponseParameters -> ShowS)
-> (ConnectionAuthResponseParameters -> String)
-> ([ConnectionAuthResponseParameters] -> ShowS)
-> Show ConnectionAuthResponseParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionAuthResponseParameters] -> ShowS
$cshowList :: [ConnectionAuthResponseParameters] -> ShowS
show :: ConnectionAuthResponseParameters -> String
$cshow :: ConnectionAuthResponseParameters -> String
showsPrec :: Int -> ConnectionAuthResponseParameters -> ShowS
$cshowsPrec :: Int -> ConnectionAuthResponseParameters -> ShowS
Prelude.Show, (forall x.
 ConnectionAuthResponseParameters
 -> Rep ConnectionAuthResponseParameters x)
-> (forall x.
    Rep ConnectionAuthResponseParameters x
    -> ConnectionAuthResponseParameters)
-> Generic ConnectionAuthResponseParameters
forall x.
Rep ConnectionAuthResponseParameters x
-> ConnectionAuthResponseParameters
forall x.
ConnectionAuthResponseParameters
-> Rep ConnectionAuthResponseParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionAuthResponseParameters x
-> ConnectionAuthResponseParameters
$cfrom :: forall x.
ConnectionAuthResponseParameters
-> Rep ConnectionAuthResponseParameters x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionAuthResponseParameters' 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:
--
-- 'oAuthParameters', 'connectionAuthResponseParameters_oAuthParameters' - The OAuth parameters to use for authorization.
--
-- 'invocationHttpParameters', 'connectionAuthResponseParameters_invocationHttpParameters' - Additional parameters for the connection that are passed through with
-- every invocation to the HTTP endpoint.
--
-- 'apiKeyAuthParameters', 'connectionAuthResponseParameters_apiKeyAuthParameters' - The API Key parameters to use for authorization.
--
-- 'basicAuthParameters', 'connectionAuthResponseParameters_basicAuthParameters' - The authorization parameters for Basic authorization.
newConnectionAuthResponseParameters ::
  ConnectionAuthResponseParameters
newConnectionAuthResponseParameters :: ConnectionAuthResponseParameters
newConnectionAuthResponseParameters =
  ConnectionAuthResponseParameters' :: Maybe ConnectionOAuthResponseParameters
-> Maybe ConnectionHttpParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
-> ConnectionAuthResponseParameters
ConnectionAuthResponseParameters'
    { $sel:oAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionOAuthResponseParameters
oAuthParameters =
        Maybe ConnectionOAuthResponseParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:invocationHttpParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionHttpParameters
invocationHttpParameters =
        Maybe ConnectionHttpParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters = Maybe ConnectionApiKeyAuthResponseParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:basicAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters = Maybe ConnectionBasicAuthResponseParameters
forall a. Maybe a
Prelude.Nothing
    }

-- | The OAuth parameters to use for authorization.
connectionAuthResponseParameters_oAuthParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionOAuthResponseParameters)
connectionAuthResponseParameters_oAuthParameters :: (Maybe ConnectionOAuthResponseParameters
 -> f (Maybe ConnectionOAuthResponseParameters))
-> ConnectionAuthResponseParameters
-> f ConnectionAuthResponseParameters
connectionAuthResponseParameters_oAuthParameters = (ConnectionAuthResponseParameters
 -> Maybe ConnectionOAuthResponseParameters)
-> (ConnectionAuthResponseParameters
    -> Maybe ConnectionOAuthResponseParameters
    -> ConnectionAuthResponseParameters)
-> Lens
     ConnectionAuthResponseParameters
     ConnectionAuthResponseParameters
     (Maybe ConnectionOAuthResponseParameters)
     (Maybe ConnectionOAuthResponseParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAuthResponseParameters' {Maybe ConnectionOAuthResponseParameters
oAuthParameters :: Maybe ConnectionOAuthResponseParameters
$sel:oAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionOAuthResponseParameters
oAuthParameters} -> Maybe ConnectionOAuthResponseParameters
oAuthParameters) (\s :: ConnectionAuthResponseParameters
s@ConnectionAuthResponseParameters' {} Maybe ConnectionOAuthResponseParameters
a -> ConnectionAuthResponseParameters
s {$sel:oAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionOAuthResponseParameters
oAuthParameters = Maybe ConnectionOAuthResponseParameters
a} :: ConnectionAuthResponseParameters)

-- | Additional parameters for the connection that are passed through with
-- every invocation to the HTTP endpoint.
connectionAuthResponseParameters_invocationHttpParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionHttpParameters)
connectionAuthResponseParameters_invocationHttpParameters :: (Maybe ConnectionHttpParameters
 -> f (Maybe ConnectionHttpParameters))
-> ConnectionAuthResponseParameters
-> f ConnectionAuthResponseParameters
connectionAuthResponseParameters_invocationHttpParameters = (ConnectionAuthResponseParameters
 -> Maybe ConnectionHttpParameters)
-> (ConnectionAuthResponseParameters
    -> Maybe ConnectionHttpParameters
    -> ConnectionAuthResponseParameters)
-> Lens
     ConnectionAuthResponseParameters
     ConnectionAuthResponseParameters
     (Maybe ConnectionHttpParameters)
     (Maybe ConnectionHttpParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAuthResponseParameters' {Maybe ConnectionHttpParameters
invocationHttpParameters :: Maybe ConnectionHttpParameters
$sel:invocationHttpParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters -> Maybe ConnectionHttpParameters
invocationHttpParameters} -> Maybe ConnectionHttpParameters
invocationHttpParameters) (\s :: ConnectionAuthResponseParameters
s@ConnectionAuthResponseParameters' {} Maybe ConnectionHttpParameters
a -> ConnectionAuthResponseParameters
s {$sel:invocationHttpParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionHttpParameters
invocationHttpParameters = Maybe ConnectionHttpParameters
a} :: ConnectionAuthResponseParameters)

-- | The API Key parameters to use for authorization.
connectionAuthResponseParameters_apiKeyAuthParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionApiKeyAuthResponseParameters)
connectionAuthResponseParameters_apiKeyAuthParameters :: (Maybe ConnectionApiKeyAuthResponseParameters
 -> f (Maybe ConnectionApiKeyAuthResponseParameters))
-> ConnectionAuthResponseParameters
-> f ConnectionAuthResponseParameters
connectionAuthResponseParameters_apiKeyAuthParameters = (ConnectionAuthResponseParameters
 -> Maybe ConnectionApiKeyAuthResponseParameters)
-> (ConnectionAuthResponseParameters
    -> Maybe ConnectionApiKeyAuthResponseParameters
    -> ConnectionAuthResponseParameters)
-> Lens
     ConnectionAuthResponseParameters
     ConnectionAuthResponseParameters
     (Maybe ConnectionApiKeyAuthResponseParameters)
     (Maybe ConnectionApiKeyAuthResponseParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAuthResponseParameters' {Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters :: Maybe ConnectionApiKeyAuthResponseParameters
$sel:apiKeyAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters} -> Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters) (\s :: ConnectionAuthResponseParameters
s@ConnectionAuthResponseParameters' {} Maybe ConnectionApiKeyAuthResponseParameters
a -> ConnectionAuthResponseParameters
s {$sel:apiKeyAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters = Maybe ConnectionApiKeyAuthResponseParameters
a} :: ConnectionAuthResponseParameters)

-- | The authorization parameters for Basic authorization.
connectionAuthResponseParameters_basicAuthParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionBasicAuthResponseParameters)
connectionAuthResponseParameters_basicAuthParameters :: (Maybe ConnectionBasicAuthResponseParameters
 -> f (Maybe ConnectionBasicAuthResponseParameters))
-> ConnectionAuthResponseParameters
-> f ConnectionAuthResponseParameters
connectionAuthResponseParameters_basicAuthParameters = (ConnectionAuthResponseParameters
 -> Maybe ConnectionBasicAuthResponseParameters)
-> (ConnectionAuthResponseParameters
    -> Maybe ConnectionBasicAuthResponseParameters
    -> ConnectionAuthResponseParameters)
-> Lens
     ConnectionAuthResponseParameters
     ConnectionAuthResponseParameters
     (Maybe ConnectionBasicAuthResponseParameters)
     (Maybe ConnectionBasicAuthResponseParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAuthResponseParameters' {Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters :: Maybe ConnectionBasicAuthResponseParameters
$sel:basicAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters} -> Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters) (\s :: ConnectionAuthResponseParameters
s@ConnectionAuthResponseParameters' {} Maybe ConnectionBasicAuthResponseParameters
a -> ConnectionAuthResponseParameters
s {$sel:basicAuthParameters:ConnectionAuthResponseParameters' :: Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters = Maybe ConnectionBasicAuthResponseParameters
a} :: ConnectionAuthResponseParameters)

instance
  Core.FromJSON
    ConnectionAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionAuthResponseParameters
parseJSON =
    String
-> (Object -> Parser ConnectionAuthResponseParameters)
-> Value
-> Parser ConnectionAuthResponseParameters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConnectionAuthResponseParameters"
      ( \Object
x ->
          Maybe ConnectionOAuthResponseParameters
-> Maybe ConnectionHttpParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
-> ConnectionAuthResponseParameters
ConnectionAuthResponseParameters'
            (Maybe ConnectionOAuthResponseParameters
 -> Maybe ConnectionHttpParameters
 -> Maybe ConnectionApiKeyAuthResponseParameters
 -> Maybe ConnectionBasicAuthResponseParameters
 -> ConnectionAuthResponseParameters)
-> Parser (Maybe ConnectionOAuthResponseParameters)
-> Parser
     (Maybe ConnectionHttpParameters
      -> Maybe ConnectionApiKeyAuthResponseParameters
      -> Maybe ConnectionBasicAuthResponseParameters
      -> ConnectionAuthResponseParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ConnectionOAuthResponseParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OAuthParameters")
            Parser
  (Maybe ConnectionHttpParameters
   -> Maybe ConnectionApiKeyAuthResponseParameters
   -> Maybe ConnectionBasicAuthResponseParameters
   -> ConnectionAuthResponseParameters)
-> Parser (Maybe ConnectionHttpParameters)
-> Parser
     (Maybe ConnectionApiKeyAuthResponseParameters
      -> Maybe ConnectionBasicAuthResponseParameters
      -> ConnectionAuthResponseParameters)
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
"InvocationHttpParameters")
            Parser
  (Maybe ConnectionApiKeyAuthResponseParameters
   -> Maybe ConnectionBasicAuthResponseParameters
   -> ConnectionAuthResponseParameters)
-> Parser (Maybe ConnectionApiKeyAuthResponseParameters)
-> Parser
     (Maybe ConnectionBasicAuthResponseParameters
      -> ConnectionAuthResponseParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe ConnectionApiKeyAuthResponseParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApiKeyAuthParameters")
            Parser
  (Maybe ConnectionBasicAuthResponseParameters
   -> ConnectionAuthResponseParameters)
-> Parser (Maybe ConnectionBasicAuthResponseParameters)
-> Parser ConnectionAuthResponseParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe ConnectionBasicAuthResponseParameters)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BasicAuthParameters")
      )

instance
  Prelude.Hashable
    ConnectionAuthResponseParameters

instance
  Prelude.NFData
    ConnectionAuthResponseParameters