{-# 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.UrlEndpointSummary
-- 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.UrlEndpointSummary 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 summary of the configuration for the URL endpoint type.
--
-- /See:/ 'newUrlEndpointSummary' smart constructor.
data UrlEndpointSummary = UrlEndpointSummary'
  { -- | The health check URL of the URL endpoint type. If the URL is a public
    -- endpoint, the @HealthUrl@ must also be a public endpoint. If the URL is
    -- a private endpoint inside a virtual private cloud (VPC), the health URL
    -- must also be a private endpoint, and the host must be the same as the
    -- URL.
    UrlEndpointSummary -> Maybe Text
healthUrl :: Prelude.Maybe Prelude.Text,
    -- | The URL to route traffic to. The URL must be an
    -- <https://datatracker.ietf.org/doc/html/rfc3986 rfc3986-formatted URL>.
    -- If the host is a domain name, the name must be resolvable over the
    -- public internet. If the scheme is @https@, the top level domain of the
    -- host must be listed in the
    -- <https://www.iana.org/domains/root/db IANA root zone database>.
    UrlEndpointSummary -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (UrlEndpointSummary -> UrlEndpointSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UrlEndpointSummary -> UrlEndpointSummary -> Bool
$c/= :: UrlEndpointSummary -> UrlEndpointSummary -> Bool
== :: UrlEndpointSummary -> UrlEndpointSummary -> Bool
$c== :: UrlEndpointSummary -> UrlEndpointSummary -> Bool
Prelude.Eq, ReadPrec [UrlEndpointSummary]
ReadPrec UrlEndpointSummary
Int -> ReadS UrlEndpointSummary
ReadS [UrlEndpointSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UrlEndpointSummary]
$creadListPrec :: ReadPrec [UrlEndpointSummary]
readPrec :: ReadPrec UrlEndpointSummary
$creadPrec :: ReadPrec UrlEndpointSummary
readList :: ReadS [UrlEndpointSummary]
$creadList :: ReadS [UrlEndpointSummary]
readsPrec :: Int -> ReadS UrlEndpointSummary
$creadsPrec :: Int -> ReadS UrlEndpointSummary
Prelude.Read, Int -> UrlEndpointSummary -> ShowS
[UrlEndpointSummary] -> ShowS
UrlEndpointSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UrlEndpointSummary] -> ShowS
$cshowList :: [UrlEndpointSummary] -> ShowS
show :: UrlEndpointSummary -> String
$cshow :: UrlEndpointSummary -> String
showsPrec :: Int -> UrlEndpointSummary -> ShowS
$cshowsPrec :: Int -> UrlEndpointSummary -> ShowS
Prelude.Show, forall x. Rep UrlEndpointSummary x -> UrlEndpointSummary
forall x. UrlEndpointSummary -> Rep UrlEndpointSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UrlEndpointSummary x -> UrlEndpointSummary
$cfrom :: forall x. UrlEndpointSummary -> Rep UrlEndpointSummary x
Prelude.Generic)

-- |
-- Create a value of 'UrlEndpointSummary' 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', 'urlEndpointSummary_healthUrl' - The health check URL of the URL endpoint type. If the URL is a public
-- endpoint, the @HealthUrl@ must also be a public endpoint. If the URL is
-- a private endpoint inside a virtual private cloud (VPC), the health URL
-- must also be a private endpoint, and the host must be the same as the
-- URL.
--
-- 'url', 'urlEndpointSummary_url' - The URL to route traffic to. The URL must be an
-- <https://datatracker.ietf.org/doc/html/rfc3986 rfc3986-formatted URL>.
-- If the host is a domain name, the name must be resolvable over the
-- public internet. If the scheme is @https@, the top level domain of the
-- host must be listed in the
-- <https://www.iana.org/domains/root/db IANA root zone database>.
newUrlEndpointSummary ::
  UrlEndpointSummary
newUrlEndpointSummary :: UrlEndpointSummary
newUrlEndpointSummary =
  UrlEndpointSummary'
    { $sel:healthUrl:UrlEndpointSummary' :: Maybe Text
healthUrl = forall a. Maybe a
Prelude.Nothing,
      $sel:url:UrlEndpointSummary' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | The health check URL of the URL endpoint type. If the URL is a public
-- endpoint, the @HealthUrl@ must also be a public endpoint. If the URL is
-- a private endpoint inside a virtual private cloud (VPC), the health URL
-- must also be a private endpoint, and the host must be the same as the
-- URL.
urlEndpointSummary_healthUrl :: Lens.Lens' UrlEndpointSummary (Prelude.Maybe Prelude.Text)
urlEndpointSummary_healthUrl :: Lens' UrlEndpointSummary (Maybe Text)
urlEndpointSummary_healthUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UrlEndpointSummary' {Maybe Text
healthUrl :: Maybe Text
$sel:healthUrl:UrlEndpointSummary' :: UrlEndpointSummary -> Maybe Text
healthUrl} -> Maybe Text
healthUrl) (\s :: UrlEndpointSummary
s@UrlEndpointSummary' {} Maybe Text
a -> UrlEndpointSummary
s {$sel:healthUrl:UrlEndpointSummary' :: Maybe Text
healthUrl = Maybe Text
a} :: UrlEndpointSummary)

-- | The URL to route traffic to. The URL must be an
-- <https://datatracker.ietf.org/doc/html/rfc3986 rfc3986-formatted URL>.
-- If the host is a domain name, the name must be resolvable over the
-- public internet. If the scheme is @https@, the top level domain of the
-- host must be listed in the
-- <https://www.iana.org/domains/root/db IANA root zone database>.
urlEndpointSummary_url :: Lens.Lens' UrlEndpointSummary (Prelude.Maybe Prelude.Text)
urlEndpointSummary_url :: Lens' UrlEndpointSummary (Maybe Text)
urlEndpointSummary_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UrlEndpointSummary' {Maybe Text
url :: Maybe Text
$sel:url:UrlEndpointSummary' :: UrlEndpointSummary -> Maybe Text
url} -> Maybe Text
url) (\s :: UrlEndpointSummary
s@UrlEndpointSummary' {} Maybe Text
a -> UrlEndpointSummary
s {$sel:url:UrlEndpointSummary' :: Maybe Text
url = Maybe Text
a} :: UrlEndpointSummary)

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