{-# 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.HttpEndpointDescription
-- 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.HttpEndpointDescription 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 HTTP endpoint selected as the destination.
--
-- /See:/ 'newHttpEndpointDescription' smart constructor.
data HttpEndpointDescription = HttpEndpointDescription'
  { -- | The name of the HTTP endpoint selected as the destination.
    HttpEndpointDescription -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The URL of the HTTP endpoint selected as the destination.
    HttpEndpointDescription -> Maybe (Sensitive Text)
url :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (HttpEndpointDescription -> HttpEndpointDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpEndpointDescription -> HttpEndpointDescription -> Bool
$c/= :: HttpEndpointDescription -> HttpEndpointDescription -> Bool
== :: HttpEndpointDescription -> HttpEndpointDescription -> Bool
$c== :: HttpEndpointDescription -> HttpEndpointDescription -> Bool
Prelude.Eq, Int -> HttpEndpointDescription -> ShowS
[HttpEndpointDescription] -> ShowS
HttpEndpointDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpEndpointDescription] -> ShowS
$cshowList :: [HttpEndpointDescription] -> ShowS
show :: HttpEndpointDescription -> String
$cshow :: HttpEndpointDescription -> String
showsPrec :: Int -> HttpEndpointDescription -> ShowS
$cshowsPrec :: Int -> HttpEndpointDescription -> ShowS
Prelude.Show, forall x. Rep HttpEndpointDescription x -> HttpEndpointDescription
forall x. HttpEndpointDescription -> Rep HttpEndpointDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpEndpointDescription x -> HttpEndpointDescription
$cfrom :: forall x. HttpEndpointDescription -> Rep HttpEndpointDescription x
Prelude.Generic)

-- |
-- Create a value of 'HttpEndpointDescription' 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', 'httpEndpointDescription_name' - The name of the HTTP endpoint selected as the destination.
--
-- 'url', 'httpEndpointDescription_url' - The URL of the HTTP endpoint selected as the destination.
newHttpEndpointDescription ::
  HttpEndpointDescription
newHttpEndpointDescription :: HttpEndpointDescription
newHttpEndpointDescription =
  HttpEndpointDescription'
    { $sel:name:HttpEndpointDescription' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:url:HttpEndpointDescription' :: Maybe (Sensitive Text)
url = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The URL of the HTTP endpoint selected as the destination.
httpEndpointDescription_url :: Lens.Lens' HttpEndpointDescription (Prelude.Maybe Prelude.Text)
httpEndpointDescription_url :: Lens' HttpEndpointDescription (Maybe Text)
httpEndpointDescription_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpEndpointDescription' {Maybe (Sensitive Text)
url :: Maybe (Sensitive Text)
$sel:url:HttpEndpointDescription' :: HttpEndpointDescription -> Maybe (Sensitive Text)
url} -> Maybe (Sensitive Text)
url) (\s :: HttpEndpointDescription
s@HttpEndpointDescription' {} Maybe (Sensitive Text)
a -> HttpEndpointDescription
s {$sel:url:HttpEndpointDescription' :: Maybe (Sensitive Text)
url = Maybe (Sensitive Text)
a} :: HttpEndpointDescription) 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

instance Data.FromJSON HttpEndpointDescription where
  parseJSON :: Value -> Parser HttpEndpointDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HttpEndpointDescription"
      ( \Object
x ->
          Maybe Text -> Maybe (Sensitive Text) -> HttpEndpointDescription
HttpEndpointDescription'
            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
"Name")
            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
"Url")
      )

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

instance Prelude.NFData HttpEndpointDescription where
  rnf :: HttpEndpointDescription -> ()
rnf HttpEndpointDescription' {Maybe Text
Maybe (Sensitive Text)
url :: Maybe (Sensitive Text)
name :: Maybe Text
$sel:url:HttpEndpointDescription' :: HttpEndpointDescription -> Maybe (Sensitive Text)
$sel:name:HttpEndpointDescription' :: HttpEndpointDescription -> Maybe Text
..} =
    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 Maybe (Sensitive Text)
url