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

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

-- | Describes the HTTP endpoint selected as the destination.
--
-- /See:/ 'newHttpEndpointDescription' smart constructor.
data HttpEndpointDescription = HttpEndpointDescription'
  { -- | The URL of the HTTP endpoint selected as the destination.
    HttpEndpointDescription -> Maybe (Sensitive Text)
url :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name of the HTTP endpoint selected as the destination.
    HttpEndpointDescription -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (HttpEndpointDescription -> HttpEndpointDescription -> Bool
(HttpEndpointDescription -> HttpEndpointDescription -> Bool)
-> (HttpEndpointDescription -> HttpEndpointDescription -> Bool)
-> Eq HttpEndpointDescription
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
(Int -> HttpEndpointDescription -> ShowS)
-> (HttpEndpointDescription -> String)
-> ([HttpEndpointDescription] -> ShowS)
-> Show HttpEndpointDescription
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.
 HttpEndpointDescription -> Rep HttpEndpointDescription x)
-> (forall x.
    Rep HttpEndpointDescription x -> HttpEndpointDescription)
-> Generic HttpEndpointDescription
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:
--
-- 'url', 'httpEndpointDescription_url' - The URL of the HTTP endpoint selected as the destination.
--
-- 'name', 'httpEndpointDescription_name' - The name of the HTTP endpoint selected as the destination.
newHttpEndpointDescription ::
  HttpEndpointDescription
newHttpEndpointDescription :: HttpEndpointDescription
newHttpEndpointDescription =
  HttpEndpointDescription' :: Maybe (Sensitive Text) -> Maybe Text -> HttpEndpointDescription
HttpEndpointDescription'
    { $sel:url:HttpEndpointDescription' :: Maybe (Sensitive Text)
url = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:HttpEndpointDescription' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The URL of the HTTP endpoint selected as the destination.
httpEndpointDescription_url :: Lens.Lens' HttpEndpointDescription (Prelude.Maybe Prelude.Text)
httpEndpointDescription_url :: (Maybe Text -> f (Maybe Text))
-> HttpEndpointDescription -> f HttpEndpointDescription
httpEndpointDescription_url = (HttpEndpointDescription -> Maybe (Sensitive Text))
-> (HttpEndpointDescription
    -> Maybe (Sensitive Text) -> HttpEndpointDescription)
-> Lens
     HttpEndpointDescription
     HttpEndpointDescription
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> HttpEndpointDescription -> f HttpEndpointDescription)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> HttpEndpointDescription
-> f HttpEndpointDescription
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 name of the HTTP endpoint selected as the destination.
httpEndpointDescription_name :: Lens.Lens' HttpEndpointDescription (Prelude.Maybe Prelude.Text)
httpEndpointDescription_name :: (Maybe Text -> f (Maybe Text))
-> HttpEndpointDescription -> f HttpEndpointDescription
httpEndpointDescription_name = (HttpEndpointDescription -> Maybe Text)
-> (HttpEndpointDescription
    -> Maybe Text -> HttpEndpointDescription)
-> Lens
     HttpEndpointDescription
     HttpEndpointDescription
     (Maybe Text)
     (Maybe Text)
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)

instance Core.FromJSON HttpEndpointDescription where
  parseJSON :: Value -> Parser HttpEndpointDescription
parseJSON =
    String
-> (Object -> Parser HttpEndpointDescription)
-> Value
-> Parser HttpEndpointDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HttpEndpointDescription"
      ( \Object
x ->
          Maybe (Sensitive Text) -> Maybe Text -> HttpEndpointDescription
HttpEndpointDescription'
            (Maybe (Sensitive Text) -> Maybe Text -> HttpEndpointDescription)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe Text -> HttpEndpointDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Url") Parser (Maybe Text -> HttpEndpointDescription)
-> Parser (Maybe Text) -> Parser HttpEndpointDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
      )

instance Prelude.Hashable HttpEndpointDescription

instance Prelude.NFData HttpEndpointDescription