{-# 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.Firehose.Types.HttpEndpointConfiguration
-- 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.Firehose.Types.HttpEndpointConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the configuration of the HTTP endpoint to which Kinesis
-- Firehose delivers data.
--
-- /See:/ 'newHttpEndpointConfiguration' smart constructor.
data HttpEndpointConfiguration = HttpEndpointConfiguration'
  { -- | The name of the HTTP endpoint selected as the destination.
    HttpEndpointConfiguration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The access key required for Kinesis Firehose to authenticate with the
    -- HTTP endpoint selected as the destination.
    HttpEndpointConfiguration -> Maybe (Sensitive Text)
accessKey :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The URL of the HTTP endpoint selected as the destination.
    --
    -- If you choose an HTTP endpoint as your destination, review and follow
    -- the instructions in the
    -- <https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html Appendix - HTTP Endpoint Delivery Request and Response Specifications>.
    HttpEndpointConfiguration -> Sensitive Text
url :: Core.Sensitive Prelude.Text
  }
  deriving (HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
(HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool)
-> (HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool)
-> Eq HttpEndpointConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
$c/= :: HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
== :: HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
$c== :: HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
Prelude.Eq, Int -> HttpEndpointConfiguration -> ShowS
[HttpEndpointConfiguration] -> ShowS
HttpEndpointConfiguration -> String
(Int -> HttpEndpointConfiguration -> ShowS)
-> (HttpEndpointConfiguration -> String)
-> ([HttpEndpointConfiguration] -> ShowS)
-> Show HttpEndpointConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpEndpointConfiguration] -> ShowS
$cshowList :: [HttpEndpointConfiguration] -> ShowS
show :: HttpEndpointConfiguration -> String
$cshow :: HttpEndpointConfiguration -> String
showsPrec :: Int -> HttpEndpointConfiguration -> ShowS
$cshowsPrec :: Int -> HttpEndpointConfiguration -> ShowS
Prelude.Show, (forall x.
 HttpEndpointConfiguration -> Rep HttpEndpointConfiguration x)
-> (forall x.
    Rep HttpEndpointConfiguration x -> HttpEndpointConfiguration)
-> Generic HttpEndpointConfiguration
forall x.
Rep HttpEndpointConfiguration x -> HttpEndpointConfiguration
forall x.
HttpEndpointConfiguration -> Rep HttpEndpointConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HttpEndpointConfiguration x -> HttpEndpointConfiguration
$cfrom :: forall x.
HttpEndpointConfiguration -> Rep HttpEndpointConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'HttpEndpointConfiguration' 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:
--
-- 'name', 'httpEndpointConfiguration_name' - The name of the HTTP endpoint selected as the destination.
--
-- 'accessKey', 'httpEndpointConfiguration_accessKey' - The access key required for Kinesis Firehose to authenticate with the
-- HTTP endpoint selected as the destination.
--
-- 'url', 'httpEndpointConfiguration_url' - The URL of the HTTP endpoint selected as the destination.
--
-- If you choose an HTTP endpoint as your destination, review and follow
-- the instructions in the
-- <https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html Appendix - HTTP Endpoint Delivery Request and Response Specifications>.
newHttpEndpointConfiguration ::
  -- | 'url'
  Prelude.Text ->
  HttpEndpointConfiguration
newHttpEndpointConfiguration :: Text -> HttpEndpointConfiguration
newHttpEndpointConfiguration Text
pUrl_ =
  HttpEndpointConfiguration' :: Maybe Text
-> Maybe (Sensitive Text)
-> Sensitive Text
-> HttpEndpointConfiguration
HttpEndpointConfiguration'
    { $sel:name:HttpEndpointConfiguration' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessKey:HttpEndpointConfiguration' :: Maybe (Sensitive Text)
accessKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:url:HttpEndpointConfiguration' :: Sensitive Text
url = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pUrl_
    }

-- | The name of the HTTP endpoint selected as the destination.
httpEndpointConfiguration_name :: Lens.Lens' HttpEndpointConfiguration (Prelude.Maybe Prelude.Text)
httpEndpointConfiguration_name :: (Maybe Text -> f (Maybe Text))
-> HttpEndpointConfiguration -> f HttpEndpointConfiguration
httpEndpointConfiguration_name = (HttpEndpointConfiguration -> Maybe Text)
-> (HttpEndpointConfiguration
    -> Maybe Text -> HttpEndpointConfiguration)
-> Lens
     HttpEndpointConfiguration
     HttpEndpointConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpEndpointConfiguration' {Maybe Text
name :: Maybe Text
$sel:name:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe Text
name} -> Maybe Text
name) (\s :: HttpEndpointConfiguration
s@HttpEndpointConfiguration' {} Maybe Text
a -> HttpEndpointConfiguration
s {$sel:name:HttpEndpointConfiguration' :: Maybe Text
name = Maybe Text
a} :: HttpEndpointConfiguration)

-- | The access key required for Kinesis Firehose to authenticate with the
-- HTTP endpoint selected as the destination.
httpEndpointConfiguration_accessKey :: Lens.Lens' HttpEndpointConfiguration (Prelude.Maybe Prelude.Text)
httpEndpointConfiguration_accessKey :: (Maybe Text -> f (Maybe Text))
-> HttpEndpointConfiguration -> f HttpEndpointConfiguration
httpEndpointConfiguration_accessKey = (HttpEndpointConfiguration -> Maybe (Sensitive Text))
-> (HttpEndpointConfiguration
    -> Maybe (Sensitive Text) -> HttpEndpointConfiguration)
-> Lens
     HttpEndpointConfiguration
     HttpEndpointConfiguration
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpEndpointConfiguration' {Maybe (Sensitive Text)
accessKey :: Maybe (Sensitive Text)
$sel:accessKey:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe (Sensitive Text)
accessKey} -> Maybe (Sensitive Text)
accessKey) (\s :: HttpEndpointConfiguration
s@HttpEndpointConfiguration' {} Maybe (Sensitive Text)
a -> HttpEndpointConfiguration
s {$sel:accessKey:HttpEndpointConfiguration' :: Maybe (Sensitive Text)
accessKey = Maybe (Sensitive Text)
a} :: HttpEndpointConfiguration) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> HttpEndpointConfiguration -> f HttpEndpointConfiguration)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> HttpEndpointConfiguration
-> f HttpEndpointConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The URL of the HTTP endpoint selected as the destination.
--
-- If you choose an HTTP endpoint as your destination, review and follow
-- the instructions in the
-- <https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html Appendix - HTTP Endpoint Delivery Request and Response Specifications>.
httpEndpointConfiguration_url :: Lens.Lens' HttpEndpointConfiguration Prelude.Text
httpEndpointConfiguration_url :: (Text -> f Text)
-> HttpEndpointConfiguration -> f HttpEndpointConfiguration
httpEndpointConfiguration_url = (HttpEndpointConfiguration -> Sensitive Text)
-> (HttpEndpointConfiguration
    -> Sensitive Text -> HttpEndpointConfiguration)
-> Lens
     HttpEndpointConfiguration
     HttpEndpointConfiguration
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpEndpointConfiguration' {Sensitive Text
url :: Sensitive Text
$sel:url:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Sensitive Text
url} -> Sensitive Text
url) (\s :: HttpEndpointConfiguration
s@HttpEndpointConfiguration' {} Sensitive Text
a -> HttpEndpointConfiguration
s {$sel:url:HttpEndpointConfiguration' :: Sensitive Text
url = Sensitive Text
a} :: HttpEndpointConfiguration) ((Sensitive Text -> f (Sensitive Text))
 -> HttpEndpointConfiguration -> f HttpEndpointConfiguration)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> HttpEndpointConfiguration
-> f HttpEndpointConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Prelude.Hashable HttpEndpointConfiguration

instance Prelude.NFData HttpEndpointConfiguration

instance Core.ToJSON HttpEndpointConfiguration where
  toJSON :: HttpEndpointConfiguration -> Value
toJSON HttpEndpointConfiguration' {Maybe Text
Maybe (Sensitive Text)
Sensitive Text
url :: Sensitive Text
accessKey :: Maybe (Sensitive Text)
name :: Maybe Text
$sel:url:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Sensitive Text
$sel:accessKey:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe (Sensitive Text)
$sel:name:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"AccessKey" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
accessKey,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Url" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
url)
          ]
      )