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

import Amazonka.CloudWatchEvents.Types.ConnectionHttpParameters
import Amazonka.CloudWatchEvents.Types.CreateConnectionApiKeyAuthRequestParameters
import Amazonka.CloudWatchEvents.Types.CreateConnectionBasicAuthRequestParameters
import Amazonka.CloudWatchEvents.Types.CreateConnectionOAuthRequestParameters
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the authorization parameters for the connection.
--
-- /See:/ 'newCreateConnectionAuthRequestParameters' smart constructor.
data CreateConnectionAuthRequestParameters = CreateConnectionAuthRequestParameters'
  { -- | A @CreateConnectionOAuthRequestParameters@ object that contains the
    -- OAuth authorization parameters to use for the connection.
    CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionOAuthRequestParameters
oAuthParameters :: Prelude.Maybe CreateConnectionOAuthRequestParameters,
    -- | A @ConnectionHttpParameters@ object that contains the API key
    -- authorization parameters to use for the connection. Note that if you
    -- include additional parameters for the target of a rule via
    -- @HttpParameters@, including query strings, the parameters added for the
    -- connection take precedence.
    CreateConnectionAuthRequestParameters
-> Maybe ConnectionHttpParameters
invocationHttpParameters :: Prelude.Maybe ConnectionHttpParameters,
    -- | A @CreateConnectionApiKeyAuthRequestParameters@ object that contains the
    -- API key authorization parameters to use for the connection.
    CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters :: Prelude.Maybe CreateConnectionApiKeyAuthRequestParameters,
    -- | A @CreateConnectionBasicAuthRequestParameters@ object that contains the
    -- Basic authorization parameters to use for the connection.
    CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters :: Prelude.Maybe CreateConnectionBasicAuthRequestParameters
  }
  deriving (CreateConnectionAuthRequestParameters
-> CreateConnectionAuthRequestParameters -> Bool
(CreateConnectionAuthRequestParameters
 -> CreateConnectionAuthRequestParameters -> Bool)
-> (CreateConnectionAuthRequestParameters
    -> CreateConnectionAuthRequestParameters -> Bool)
-> Eq CreateConnectionAuthRequestParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionAuthRequestParameters
-> CreateConnectionAuthRequestParameters -> Bool
$c/= :: CreateConnectionAuthRequestParameters
-> CreateConnectionAuthRequestParameters -> Bool
== :: CreateConnectionAuthRequestParameters
-> CreateConnectionAuthRequestParameters -> Bool
$c== :: CreateConnectionAuthRequestParameters
-> CreateConnectionAuthRequestParameters -> Bool
Prelude.Eq, ReadPrec [CreateConnectionAuthRequestParameters]
ReadPrec CreateConnectionAuthRequestParameters
Int -> ReadS CreateConnectionAuthRequestParameters
ReadS [CreateConnectionAuthRequestParameters]
(Int -> ReadS CreateConnectionAuthRequestParameters)
-> ReadS [CreateConnectionAuthRequestParameters]
-> ReadPrec CreateConnectionAuthRequestParameters
-> ReadPrec [CreateConnectionAuthRequestParameters]
-> Read CreateConnectionAuthRequestParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionAuthRequestParameters]
$creadListPrec :: ReadPrec [CreateConnectionAuthRequestParameters]
readPrec :: ReadPrec CreateConnectionAuthRequestParameters
$creadPrec :: ReadPrec CreateConnectionAuthRequestParameters
readList :: ReadS [CreateConnectionAuthRequestParameters]
$creadList :: ReadS [CreateConnectionAuthRequestParameters]
readsPrec :: Int -> ReadS CreateConnectionAuthRequestParameters
$creadsPrec :: Int -> ReadS CreateConnectionAuthRequestParameters
Prelude.Read, Int -> CreateConnectionAuthRequestParameters -> ShowS
[CreateConnectionAuthRequestParameters] -> ShowS
CreateConnectionAuthRequestParameters -> String
(Int -> CreateConnectionAuthRequestParameters -> ShowS)
-> (CreateConnectionAuthRequestParameters -> String)
-> ([CreateConnectionAuthRequestParameters] -> ShowS)
-> Show CreateConnectionAuthRequestParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionAuthRequestParameters] -> ShowS
$cshowList :: [CreateConnectionAuthRequestParameters] -> ShowS
show :: CreateConnectionAuthRequestParameters -> String
$cshow :: CreateConnectionAuthRequestParameters -> String
showsPrec :: Int -> CreateConnectionAuthRequestParameters -> ShowS
$cshowsPrec :: Int -> CreateConnectionAuthRequestParameters -> ShowS
Prelude.Show, (forall x.
 CreateConnectionAuthRequestParameters
 -> Rep CreateConnectionAuthRequestParameters x)
-> (forall x.
    Rep CreateConnectionAuthRequestParameters x
    -> CreateConnectionAuthRequestParameters)
-> Generic CreateConnectionAuthRequestParameters
forall x.
Rep CreateConnectionAuthRequestParameters x
-> CreateConnectionAuthRequestParameters
forall x.
CreateConnectionAuthRequestParameters
-> Rep CreateConnectionAuthRequestParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConnectionAuthRequestParameters x
-> CreateConnectionAuthRequestParameters
$cfrom :: forall x.
CreateConnectionAuthRequestParameters
-> Rep CreateConnectionAuthRequestParameters x
Prelude.Generic)

-- |
-- Create a value of 'CreateConnectionAuthRequestParameters' 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', 'createConnectionAuthRequestParameters_oAuthParameters' - A @CreateConnectionOAuthRequestParameters@ object that contains the
-- OAuth authorization parameters to use for the connection.
--
-- 'invocationHttpParameters', 'createConnectionAuthRequestParameters_invocationHttpParameters' - A @ConnectionHttpParameters@ object that contains the API key
-- authorization parameters to use for the connection. Note that if you
-- include additional parameters for the target of a rule via
-- @HttpParameters@, including query strings, the parameters added for the
-- connection take precedence.
--
-- 'apiKeyAuthParameters', 'createConnectionAuthRequestParameters_apiKeyAuthParameters' - A @CreateConnectionApiKeyAuthRequestParameters@ object that contains the
-- API key authorization parameters to use for the connection.
--
-- 'basicAuthParameters', 'createConnectionAuthRequestParameters_basicAuthParameters' - A @CreateConnectionBasicAuthRequestParameters@ object that contains the
-- Basic authorization parameters to use for the connection.
newCreateConnectionAuthRequestParameters ::
  CreateConnectionAuthRequestParameters
newCreateConnectionAuthRequestParameters :: CreateConnectionAuthRequestParameters
newCreateConnectionAuthRequestParameters =
  CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionOAuthRequestParameters
-> Maybe ConnectionHttpParameters
-> Maybe CreateConnectionApiKeyAuthRequestParameters
-> Maybe CreateConnectionBasicAuthRequestParameters
-> CreateConnectionAuthRequestParameters
CreateConnectionAuthRequestParameters'
    { $sel:oAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionOAuthRequestParameters
oAuthParameters =
        Maybe CreateConnectionOAuthRequestParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:invocationHttpParameters:CreateConnectionAuthRequestParameters' :: Maybe ConnectionHttpParameters
invocationHttpParameters =
        Maybe ConnectionHttpParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters =
        Maybe CreateConnectionApiKeyAuthRequestParameters
forall a. Maybe a
Prelude.Nothing,
      $sel:basicAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters =
        Maybe CreateConnectionBasicAuthRequestParameters
forall a. Maybe a
Prelude.Nothing
    }

-- | A @CreateConnectionOAuthRequestParameters@ object that contains the
-- OAuth authorization parameters to use for the connection.
createConnectionAuthRequestParameters_oAuthParameters :: Lens.Lens' CreateConnectionAuthRequestParameters (Prelude.Maybe CreateConnectionOAuthRequestParameters)
createConnectionAuthRequestParameters_oAuthParameters :: (Maybe CreateConnectionOAuthRequestParameters
 -> f (Maybe CreateConnectionOAuthRequestParameters))
-> CreateConnectionAuthRequestParameters
-> f CreateConnectionAuthRequestParameters
createConnectionAuthRequestParameters_oAuthParameters = (CreateConnectionAuthRequestParameters
 -> Maybe CreateConnectionOAuthRequestParameters)
-> (CreateConnectionAuthRequestParameters
    -> Maybe CreateConnectionOAuthRequestParameters
    -> CreateConnectionAuthRequestParameters)
-> Lens
     CreateConnectionAuthRequestParameters
     CreateConnectionAuthRequestParameters
     (Maybe CreateConnectionOAuthRequestParameters)
     (Maybe CreateConnectionOAuthRequestParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAuthRequestParameters' {Maybe CreateConnectionOAuthRequestParameters
oAuthParameters :: Maybe CreateConnectionOAuthRequestParameters
$sel:oAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionOAuthRequestParameters
oAuthParameters} -> Maybe CreateConnectionOAuthRequestParameters
oAuthParameters) (\s :: CreateConnectionAuthRequestParameters
s@CreateConnectionAuthRequestParameters' {} Maybe CreateConnectionOAuthRequestParameters
a -> CreateConnectionAuthRequestParameters
s {$sel:oAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionOAuthRequestParameters
oAuthParameters = Maybe CreateConnectionOAuthRequestParameters
a} :: CreateConnectionAuthRequestParameters)

-- | A @ConnectionHttpParameters@ object that contains the API key
-- authorization parameters to use for the connection. Note that if you
-- include additional parameters for the target of a rule via
-- @HttpParameters@, including query strings, the parameters added for the
-- connection take precedence.
createConnectionAuthRequestParameters_invocationHttpParameters :: Lens.Lens' CreateConnectionAuthRequestParameters (Prelude.Maybe ConnectionHttpParameters)
createConnectionAuthRequestParameters_invocationHttpParameters :: (Maybe ConnectionHttpParameters
 -> f (Maybe ConnectionHttpParameters))
-> CreateConnectionAuthRequestParameters
-> f CreateConnectionAuthRequestParameters
createConnectionAuthRequestParameters_invocationHttpParameters = (CreateConnectionAuthRequestParameters
 -> Maybe ConnectionHttpParameters)
-> (CreateConnectionAuthRequestParameters
    -> Maybe ConnectionHttpParameters
    -> CreateConnectionAuthRequestParameters)
-> Lens
     CreateConnectionAuthRequestParameters
     CreateConnectionAuthRequestParameters
     (Maybe ConnectionHttpParameters)
     (Maybe ConnectionHttpParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAuthRequestParameters' {Maybe ConnectionHttpParameters
invocationHttpParameters :: Maybe ConnectionHttpParameters
$sel:invocationHttpParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe ConnectionHttpParameters
invocationHttpParameters} -> Maybe ConnectionHttpParameters
invocationHttpParameters) (\s :: CreateConnectionAuthRequestParameters
s@CreateConnectionAuthRequestParameters' {} Maybe ConnectionHttpParameters
a -> CreateConnectionAuthRequestParameters
s {$sel:invocationHttpParameters:CreateConnectionAuthRequestParameters' :: Maybe ConnectionHttpParameters
invocationHttpParameters = Maybe ConnectionHttpParameters
a} :: CreateConnectionAuthRequestParameters)

-- | A @CreateConnectionApiKeyAuthRequestParameters@ object that contains the
-- API key authorization parameters to use for the connection.
createConnectionAuthRequestParameters_apiKeyAuthParameters :: Lens.Lens' CreateConnectionAuthRequestParameters (Prelude.Maybe CreateConnectionApiKeyAuthRequestParameters)
createConnectionAuthRequestParameters_apiKeyAuthParameters :: (Maybe CreateConnectionApiKeyAuthRequestParameters
 -> f (Maybe CreateConnectionApiKeyAuthRequestParameters))
-> CreateConnectionAuthRequestParameters
-> f CreateConnectionAuthRequestParameters
createConnectionAuthRequestParameters_apiKeyAuthParameters = (CreateConnectionAuthRequestParameters
 -> Maybe CreateConnectionApiKeyAuthRequestParameters)
-> (CreateConnectionAuthRequestParameters
    -> Maybe CreateConnectionApiKeyAuthRequestParameters
    -> CreateConnectionAuthRequestParameters)
-> Lens
     CreateConnectionAuthRequestParameters
     CreateConnectionAuthRequestParameters
     (Maybe CreateConnectionApiKeyAuthRequestParameters)
     (Maybe CreateConnectionApiKeyAuthRequestParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAuthRequestParameters' {Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters :: Maybe CreateConnectionApiKeyAuthRequestParameters
$sel:apiKeyAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters} -> Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters) (\s :: CreateConnectionAuthRequestParameters
s@CreateConnectionAuthRequestParameters' {} Maybe CreateConnectionApiKeyAuthRequestParameters
a -> CreateConnectionAuthRequestParameters
s {$sel:apiKeyAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters = Maybe CreateConnectionApiKeyAuthRequestParameters
a} :: CreateConnectionAuthRequestParameters)

-- | A @CreateConnectionBasicAuthRequestParameters@ object that contains the
-- Basic authorization parameters to use for the connection.
createConnectionAuthRequestParameters_basicAuthParameters :: Lens.Lens' CreateConnectionAuthRequestParameters (Prelude.Maybe CreateConnectionBasicAuthRequestParameters)
createConnectionAuthRequestParameters_basicAuthParameters :: (Maybe CreateConnectionBasicAuthRequestParameters
 -> f (Maybe CreateConnectionBasicAuthRequestParameters))
-> CreateConnectionAuthRequestParameters
-> f CreateConnectionAuthRequestParameters
createConnectionAuthRequestParameters_basicAuthParameters = (CreateConnectionAuthRequestParameters
 -> Maybe CreateConnectionBasicAuthRequestParameters)
-> (CreateConnectionAuthRequestParameters
    -> Maybe CreateConnectionBasicAuthRequestParameters
    -> CreateConnectionAuthRequestParameters)
-> Lens
     CreateConnectionAuthRequestParameters
     CreateConnectionAuthRequestParameters
     (Maybe CreateConnectionBasicAuthRequestParameters)
     (Maybe CreateConnectionBasicAuthRequestParameters)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionAuthRequestParameters' {Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters :: Maybe CreateConnectionBasicAuthRequestParameters
$sel:basicAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters} -> Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters) (\s :: CreateConnectionAuthRequestParameters
s@CreateConnectionAuthRequestParameters' {} Maybe CreateConnectionBasicAuthRequestParameters
a -> CreateConnectionAuthRequestParameters
s {$sel:basicAuthParameters:CreateConnectionAuthRequestParameters' :: Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters = Maybe CreateConnectionBasicAuthRequestParameters
a} :: CreateConnectionAuthRequestParameters)

instance
  Prelude.Hashable
    CreateConnectionAuthRequestParameters

instance
  Prelude.NFData
    CreateConnectionAuthRequestParameters

instance
  Core.ToJSON
    CreateConnectionAuthRequestParameters
  where
  toJSON :: CreateConnectionAuthRequestParameters -> Value
toJSON CreateConnectionAuthRequestParameters' {Maybe ConnectionHttpParameters
Maybe CreateConnectionApiKeyAuthRequestParameters
Maybe CreateConnectionBasicAuthRequestParameters
Maybe CreateConnectionOAuthRequestParameters
basicAuthParameters :: Maybe CreateConnectionBasicAuthRequestParameters
apiKeyAuthParameters :: Maybe CreateConnectionApiKeyAuthRequestParameters
invocationHttpParameters :: Maybe ConnectionHttpParameters
oAuthParameters :: Maybe CreateConnectionOAuthRequestParameters
$sel:basicAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionBasicAuthRequestParameters
$sel:apiKeyAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionApiKeyAuthRequestParameters
$sel:invocationHttpParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe ConnectionHttpParameters
$sel:oAuthParameters:CreateConnectionAuthRequestParameters' :: CreateConnectionAuthRequestParameters
-> Maybe CreateConnectionOAuthRequestParameters
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OAuthParameters" Text -> CreateConnectionOAuthRequestParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CreateConnectionOAuthRequestParameters -> Pair)
-> Maybe CreateConnectionOAuthRequestParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateConnectionOAuthRequestParameters
oAuthParameters,
            (Text
"InvocationHttpParameters" 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
invocationHttpParameters,
            (Text
"ApiKeyAuthParameters" Text -> CreateConnectionApiKeyAuthRequestParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CreateConnectionApiKeyAuthRequestParameters -> Pair)
-> Maybe CreateConnectionApiKeyAuthRequestParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateConnectionApiKeyAuthRequestParameters
apiKeyAuthParameters,
            (Text
"BasicAuthParameters" Text -> CreateConnectionBasicAuthRequestParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CreateConnectionBasicAuthRequestParameters -> Pair)
-> Maybe CreateConnectionBasicAuthRequestParameters -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CreateConnectionBasicAuthRequestParameters
basicAuthParameters
          ]
      )