{-# 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.MigrationHubReFactorSpaces.Types.UrlEndpointConfig
-- 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.MigrationHubReFactorSpaces.Types.UrlEndpointConfig 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

-- | The configuration for the URL endpoint type.
--
-- /See:/ 'newUrlEndpointConfig' smart constructor.
data UrlEndpointConfig = UrlEndpointConfig'
  { -- | The health check URL of the URL endpoint type.
    UrlEndpointConfig -> Maybe Text
healthUrl :: Prelude.Maybe Prelude.Text,
    -- | The HTTP URL endpoint.
    UrlEndpointConfig -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (UrlEndpointConfig -> UrlEndpointConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UrlEndpointConfig -> UrlEndpointConfig -> Bool
$c/= :: UrlEndpointConfig -> UrlEndpointConfig -> Bool
== :: UrlEndpointConfig -> UrlEndpointConfig -> Bool
$c== :: UrlEndpointConfig -> UrlEndpointConfig -> Bool
Prelude.Eq, ReadPrec [UrlEndpointConfig]
ReadPrec UrlEndpointConfig
Int -> ReadS UrlEndpointConfig
ReadS [UrlEndpointConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UrlEndpointConfig]
$creadListPrec :: ReadPrec [UrlEndpointConfig]
readPrec :: ReadPrec UrlEndpointConfig
$creadPrec :: ReadPrec UrlEndpointConfig
readList :: ReadS [UrlEndpointConfig]
$creadList :: ReadS [UrlEndpointConfig]
readsPrec :: Int -> ReadS UrlEndpointConfig
$creadsPrec :: Int -> ReadS UrlEndpointConfig
Prelude.Read, Int -> UrlEndpointConfig -> ShowS
[UrlEndpointConfig] -> ShowS
UrlEndpointConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UrlEndpointConfig] -> ShowS
$cshowList :: [UrlEndpointConfig] -> ShowS
show :: UrlEndpointConfig -> String
$cshow :: UrlEndpointConfig -> String
showsPrec :: Int -> UrlEndpointConfig -> ShowS
$cshowsPrec :: Int -> UrlEndpointConfig -> ShowS
Prelude.Show, forall x. Rep UrlEndpointConfig x -> UrlEndpointConfig
forall x. UrlEndpointConfig -> Rep UrlEndpointConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UrlEndpointConfig x -> UrlEndpointConfig
$cfrom :: forall x. UrlEndpointConfig -> Rep UrlEndpointConfig x
Prelude.Generic)

-- |
-- Create a value of 'UrlEndpointConfig' 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:
--
-- 'healthUrl', 'urlEndpointConfig_healthUrl' - The health check URL of the URL endpoint type.
--
-- 'url', 'urlEndpointConfig_url' - The HTTP URL endpoint.
newUrlEndpointConfig ::
  UrlEndpointConfig
newUrlEndpointConfig :: UrlEndpointConfig
newUrlEndpointConfig =
  UrlEndpointConfig'
    { $sel:healthUrl:UrlEndpointConfig' :: Maybe Text
healthUrl = forall a. Maybe a
Prelude.Nothing,
      $sel:url:UrlEndpointConfig' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | The health check URL of the URL endpoint type.
urlEndpointConfig_healthUrl :: Lens.Lens' UrlEndpointConfig (Prelude.Maybe Prelude.Text)
urlEndpointConfig_healthUrl :: Lens' UrlEndpointConfig (Maybe Text)
urlEndpointConfig_healthUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UrlEndpointConfig' {Maybe Text
healthUrl :: Maybe Text
$sel:healthUrl:UrlEndpointConfig' :: UrlEndpointConfig -> Maybe Text
healthUrl} -> Maybe Text
healthUrl) (\s :: UrlEndpointConfig
s@UrlEndpointConfig' {} Maybe Text
a -> UrlEndpointConfig
s {$sel:healthUrl:UrlEndpointConfig' :: Maybe Text
healthUrl = Maybe Text
a} :: UrlEndpointConfig)

-- | The HTTP URL endpoint.
urlEndpointConfig_url :: Lens.Lens' UrlEndpointConfig (Prelude.Maybe Prelude.Text)
urlEndpointConfig_url :: Lens' UrlEndpointConfig (Maybe Text)
urlEndpointConfig_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UrlEndpointConfig' {Maybe Text
url :: Maybe Text
$sel:url:UrlEndpointConfig' :: UrlEndpointConfig -> Maybe Text
url} -> Maybe Text
url) (\s :: UrlEndpointConfig
s@UrlEndpointConfig' {} Maybe Text
a -> UrlEndpointConfig
s {$sel:url:UrlEndpointConfig' :: Maybe Text
url = Maybe Text
a} :: UrlEndpointConfig)

instance Data.FromJSON UrlEndpointConfig where
  parseJSON :: Value -> Parser UrlEndpointConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UrlEndpointConfig"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> UrlEndpointConfig
UrlEndpointConfig'
            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
"HealthUrl")
            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 UrlEndpointConfig where
  hashWithSalt :: Int -> UrlEndpointConfig -> Int
hashWithSalt Int
_salt UrlEndpointConfig' {Maybe Text
url :: Maybe Text
healthUrl :: Maybe Text
$sel:url:UrlEndpointConfig' :: UrlEndpointConfig -> Maybe Text
$sel:healthUrl:UrlEndpointConfig' :: UrlEndpointConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
healthUrl
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

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