{-# 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-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.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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- | The API Key parameters to use for authorization.
connectionAuthResponseParameters_apiKeyAuthParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionApiKeyAuthResponseParameters)
connectionAuthResponseParameters_apiKeyAuthParameters :: Lens'
  ConnectionAuthResponseParameters
  (Maybe ConnectionApiKeyAuthResponseParameters)
connectionAuthResponseParameters_apiKeyAuthParameters = 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 :: Lens'
  ConnectionAuthResponseParameters
  (Maybe ConnectionBasicAuthResponseParameters)
connectionAuthResponseParameters_basicAuthParameters = 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)

-- | 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 :: Lens'
  ConnectionAuthResponseParameters (Maybe ConnectionHttpParameters)
connectionAuthResponseParameters_invocationHttpParameters = 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 OAuth parameters to use for authorization.
connectionAuthResponseParameters_oAuthParameters :: Lens.Lens' ConnectionAuthResponseParameters (Prelude.Maybe ConnectionOAuthResponseParameters)
connectionAuthResponseParameters_oAuthParameters :: Lens'
  ConnectionAuthResponseParameters
  (Maybe ConnectionOAuthResponseParameters)
connectionAuthResponseParameters_oAuthParameters = 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)

instance
  Data.FromJSON
    ConnectionAuthResponseParameters
  where
  parseJSON :: Value -> Parser ConnectionAuthResponseParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConnectionAuthResponseParameters"
      ( \Object
x ->
          Maybe ConnectionApiKeyAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
-> Maybe ConnectionHttpParameters
-> Maybe ConnectionOAuthResponseParameters
-> ConnectionAuthResponseParameters
ConnectionAuthResponseParameters'
            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
"ApiKeyAuthParameters")
            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
"BasicAuthParameters")
            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
"InvocationHttpParameters")
            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
"OAuthParameters")
      )

instance
  Prelude.Hashable
    ConnectionAuthResponseParameters
  where
  hashWithSalt :: Int -> ConnectionAuthResponseParameters -> Int
hashWithSalt
    Int
_salt
    ConnectionAuthResponseParameters' {Maybe ConnectionApiKeyAuthResponseParameters
Maybe ConnectionBasicAuthResponseParameters
Maybe ConnectionHttpParameters
Maybe ConnectionOAuthResponseParameters
oAuthParameters :: Maybe ConnectionOAuthResponseParameters
invocationHttpParameters :: Maybe ConnectionHttpParameters
basicAuthParameters :: Maybe ConnectionBasicAuthResponseParameters
apiKeyAuthParameters :: Maybe ConnectionApiKeyAuthResponseParameters
$sel:oAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionOAuthResponseParameters
$sel:invocationHttpParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters -> Maybe ConnectionHttpParameters
$sel:basicAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
$sel:apiKeyAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionHttpParameters
invocationHttpParameters
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectionOAuthResponseParameters
oAuthParameters

instance
  Prelude.NFData
    ConnectionAuthResponseParameters
  where
  rnf :: ConnectionAuthResponseParameters -> ()
rnf ConnectionAuthResponseParameters' {Maybe ConnectionApiKeyAuthResponseParameters
Maybe ConnectionBasicAuthResponseParameters
Maybe ConnectionHttpParameters
Maybe ConnectionOAuthResponseParameters
oAuthParameters :: Maybe ConnectionOAuthResponseParameters
invocationHttpParameters :: Maybe ConnectionHttpParameters
basicAuthParameters :: Maybe ConnectionBasicAuthResponseParameters
apiKeyAuthParameters :: Maybe ConnectionApiKeyAuthResponseParameters
$sel:oAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionOAuthResponseParameters
$sel:invocationHttpParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters -> Maybe ConnectionHttpParameters
$sel:basicAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionBasicAuthResponseParameters
$sel:apiKeyAuthParameters:ConnectionAuthResponseParameters' :: ConnectionAuthResponseParameters
-> Maybe ConnectionApiKeyAuthResponseParameters
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionApiKeyAuthResponseParameters
apiKeyAuthParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionBasicAuthResponseParameters
basicAuthParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionHttpParameters
invocationHttpParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionOAuthResponseParameters
oAuthParameters