{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Firehose.Types.HttpEndpointConfiguration where

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

-- | Describes the configuration of the HTTP endpoint to which Kinesis
-- Firehose delivers data.
--
-- /See:/ 'newHttpEndpointConfiguration' smart constructor.
data HttpEndpointConfiguration = HttpEndpointConfiguration'
  { -- | The access key required for Kinesis Firehose to authenticate with the
    -- HTTP endpoint selected as the destination.
    HttpEndpointConfiguration -> Maybe (Sensitive Text)
accessKey :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The name of the HTTP endpoint selected as the destination.
    HttpEndpointConfiguration -> Maybe Text
name :: Prelude.Maybe 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 :: Data.Sensitive Prelude.Text
  }
  deriving (HttpEndpointConfiguration -> HttpEndpointConfiguration -> Bool
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
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.
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:
--
-- 'accessKey', 'httpEndpointConfiguration_accessKey' - The access key required for Kinesis Firehose to authenticate with the
-- HTTP endpoint selected as the destination.
--
-- 'name', 'httpEndpointConfiguration_name' - The name of 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'
    { $sel:accessKey:HttpEndpointConfiguration' :: Maybe (Sensitive Text)
accessKey =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:HttpEndpointConfiguration' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:url:HttpEndpointConfiguration' :: Sensitive Text
url = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pUrl_
    }

-- | 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 :: Lens' HttpEndpointConfiguration (Maybe Text)
httpEndpointConfiguration_accessKey = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The name of the HTTP endpoint selected as the destination.
httpEndpointConfiguration_name :: Lens.Lens' HttpEndpointConfiguration (Prelude.Maybe Prelude.Text)
httpEndpointConfiguration_name :: Lens' HttpEndpointConfiguration (Maybe Text)
httpEndpointConfiguration_name = 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 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 :: Lens' HttpEndpointConfiguration Text
httpEndpointConfiguration_url = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

instance Prelude.Hashable HttpEndpointConfiguration where
  hashWithSalt :: Int -> HttpEndpointConfiguration -> Int
hashWithSalt Int
_salt HttpEndpointConfiguration' {Maybe Text
Maybe (Sensitive Text)
Sensitive Text
url :: Sensitive Text
name :: Maybe Text
accessKey :: Maybe (Sensitive Text)
$sel:url:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Sensitive Text
$sel:name:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe Text
$sel:accessKey:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe (Sensitive Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
accessKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
url

instance Prelude.NFData HttpEndpointConfiguration where
  rnf :: HttpEndpointConfiguration -> ()
rnf HttpEndpointConfiguration' {Maybe Text
Maybe (Sensitive Text)
Sensitive Text
url :: Sensitive Text
name :: Maybe Text
accessKey :: Maybe (Sensitive Text)
$sel:url:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Sensitive Text
$sel:name:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe Text
$sel:accessKey:HttpEndpointConfiguration' :: HttpEndpointConfiguration -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
accessKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
url

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