{-# 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.MediaTailor.Types.HttpConfiguration
-- 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.MediaTailor.Types.HttpConfiguration 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 HTTP configuration for the source location.
--
-- /See:/ 'newHttpConfiguration' smart constructor.
data HttpConfiguration = HttpConfiguration'
  { -- | The base URL for the source location host server. This string must
    -- include the protocol, such as __https:\/\/__.
    HttpConfiguration -> Text
baseUrl :: Prelude.Text
  }
  deriving (HttpConfiguration -> HttpConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpConfiguration -> HttpConfiguration -> Bool
$c/= :: HttpConfiguration -> HttpConfiguration -> Bool
== :: HttpConfiguration -> HttpConfiguration -> Bool
$c== :: HttpConfiguration -> HttpConfiguration -> Bool
Prelude.Eq, ReadPrec [HttpConfiguration]
ReadPrec HttpConfiguration
Int -> ReadS HttpConfiguration
ReadS [HttpConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpConfiguration]
$creadListPrec :: ReadPrec [HttpConfiguration]
readPrec :: ReadPrec HttpConfiguration
$creadPrec :: ReadPrec HttpConfiguration
readList :: ReadS [HttpConfiguration]
$creadList :: ReadS [HttpConfiguration]
readsPrec :: Int -> ReadS HttpConfiguration
$creadsPrec :: Int -> ReadS HttpConfiguration
Prelude.Read, Int -> HttpConfiguration -> ShowS
[HttpConfiguration] -> ShowS
HttpConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpConfiguration] -> ShowS
$cshowList :: [HttpConfiguration] -> ShowS
show :: HttpConfiguration -> String
$cshow :: HttpConfiguration -> String
showsPrec :: Int -> HttpConfiguration -> ShowS
$cshowsPrec :: Int -> HttpConfiguration -> ShowS
Prelude.Show, forall x. Rep HttpConfiguration x -> HttpConfiguration
forall x. HttpConfiguration -> Rep HttpConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HttpConfiguration x -> HttpConfiguration
$cfrom :: forall x. HttpConfiguration -> Rep HttpConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'HttpConfiguration' 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:
--
-- 'baseUrl', 'httpConfiguration_baseUrl' - The base URL for the source location host server. This string must
-- include the protocol, such as __https:\/\/__.
newHttpConfiguration ::
  -- | 'baseUrl'
  Prelude.Text ->
  HttpConfiguration
newHttpConfiguration :: Text -> HttpConfiguration
newHttpConfiguration Text
pBaseUrl_ =
  HttpConfiguration' {$sel:baseUrl:HttpConfiguration' :: Text
baseUrl = Text
pBaseUrl_}

-- | The base URL for the source location host server. This string must
-- include the protocol, such as __https:\/\/__.
httpConfiguration_baseUrl :: Lens.Lens' HttpConfiguration Prelude.Text
httpConfiguration_baseUrl :: Lens' HttpConfiguration Text
httpConfiguration_baseUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpConfiguration' {Text
baseUrl :: Text
$sel:baseUrl:HttpConfiguration' :: HttpConfiguration -> Text
baseUrl} -> Text
baseUrl) (\s :: HttpConfiguration
s@HttpConfiguration' {} Text
a -> HttpConfiguration
s {$sel:baseUrl:HttpConfiguration' :: Text
baseUrl = Text
a} :: HttpConfiguration)

instance Data.FromJSON HttpConfiguration where
  parseJSON :: Value -> Parser HttpConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HttpConfiguration"
      ( \Object
x ->
          Text -> HttpConfiguration
HttpConfiguration' forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"BaseUrl")
      )

instance Prelude.Hashable HttpConfiguration where
  hashWithSalt :: Int -> HttpConfiguration -> Int
hashWithSalt Int
_salt HttpConfiguration' {Text
baseUrl :: Text
$sel:baseUrl:HttpConfiguration' :: HttpConfiguration -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
baseUrl

instance Prelude.NFData HttpConfiguration where
  rnf :: HttpConfiguration -> ()
rnf HttpConfiguration' {Text
baseUrl :: Text
$sel:baseUrl:HttpConfiguration' :: HttpConfiguration -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
baseUrl

instance Data.ToJSON HttpConfiguration where
  toJSON :: HttpConfiguration -> Value
toJSON HttpConfiguration' {Text
baseUrl :: Text
$sel:baseUrl:HttpConfiguration' :: HttpConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"BaseUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
baseUrl)]
      )