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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaTailor.Types.Type
import qualified Amazonka.Prelude as Prelude

-- | The HTTP package configuration properties for the requested VOD source.
--
-- /See:/ 'newHttpPackageConfiguration' smart constructor.
data HttpPackageConfiguration = HttpPackageConfiguration'
  { -- | The relative path to the URL for this VOD source. This is combined with
    -- @SourceLocation::HttpConfiguration::BaseUrl@ to form a valid URL.
    HttpPackageConfiguration -> Text
path :: Prelude.Text,
    -- | The name of the source group. This has to match one of the
    -- @Channel::Outputs::SourceGroup@.
    HttpPackageConfiguration -> Text
sourceGroup :: Prelude.Text,
    -- | The streaming protocol for this package configuration. Supported values
    -- are @HLS@ and @DASH@.
    HttpPackageConfiguration -> Type
type' :: Type
  }
  deriving (HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
$c/= :: HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
== :: HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
$c== :: HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
Prelude.Eq, ReadPrec [HttpPackageConfiguration]
ReadPrec HttpPackageConfiguration
Int -> ReadS HttpPackageConfiguration
ReadS [HttpPackageConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpPackageConfiguration]
$creadListPrec :: ReadPrec [HttpPackageConfiguration]
readPrec :: ReadPrec HttpPackageConfiguration
$creadPrec :: ReadPrec HttpPackageConfiguration
readList :: ReadS [HttpPackageConfiguration]
$creadList :: ReadS [HttpPackageConfiguration]
readsPrec :: Int -> ReadS HttpPackageConfiguration
$creadsPrec :: Int -> ReadS HttpPackageConfiguration
Prelude.Read, Int -> HttpPackageConfiguration -> ShowS
[HttpPackageConfiguration] -> ShowS
HttpPackageConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpPackageConfiguration] -> ShowS
$cshowList :: [HttpPackageConfiguration] -> ShowS
show :: HttpPackageConfiguration -> String
$cshow :: HttpPackageConfiguration -> String
showsPrec :: Int -> HttpPackageConfiguration -> ShowS
$cshowsPrec :: Int -> HttpPackageConfiguration -> ShowS
Prelude.Show, forall x.
Rep HttpPackageConfiguration x -> HttpPackageConfiguration
forall x.
HttpPackageConfiguration -> Rep HttpPackageConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HttpPackageConfiguration x -> HttpPackageConfiguration
$cfrom :: forall x.
HttpPackageConfiguration -> Rep HttpPackageConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'HttpPackageConfiguration' 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:
--
-- 'path', 'httpPackageConfiguration_path' - The relative path to the URL for this VOD source. This is combined with
-- @SourceLocation::HttpConfiguration::BaseUrl@ to form a valid URL.
--
-- 'sourceGroup', 'httpPackageConfiguration_sourceGroup' - The name of the source group. This has to match one of the
-- @Channel::Outputs::SourceGroup@.
--
-- 'type'', 'httpPackageConfiguration_type' - The streaming protocol for this package configuration. Supported values
-- are @HLS@ and @DASH@.
newHttpPackageConfiguration ::
  -- | 'path'
  Prelude.Text ->
  -- | 'sourceGroup'
  Prelude.Text ->
  -- | 'type''
  Type ->
  HttpPackageConfiguration
newHttpPackageConfiguration :: Text -> Text -> Type -> HttpPackageConfiguration
newHttpPackageConfiguration
  Text
pPath_
  Text
pSourceGroup_
  Type
pType_ =
    HttpPackageConfiguration'
      { $sel:path:HttpPackageConfiguration' :: Text
path = Text
pPath_,
        $sel:sourceGroup:HttpPackageConfiguration' :: Text
sourceGroup = Text
pSourceGroup_,
        $sel:type':HttpPackageConfiguration' :: Type
type' = Type
pType_
      }

-- | The relative path to the URL for this VOD source. This is combined with
-- @SourceLocation::HttpConfiguration::BaseUrl@ to form a valid URL.
httpPackageConfiguration_path :: Lens.Lens' HttpPackageConfiguration Prelude.Text
httpPackageConfiguration_path :: Lens' HttpPackageConfiguration Text
httpPackageConfiguration_path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpPackageConfiguration' {Text
path :: Text
$sel:path:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
path} -> Text
path) (\s :: HttpPackageConfiguration
s@HttpPackageConfiguration' {} Text
a -> HttpPackageConfiguration
s {$sel:path:HttpPackageConfiguration' :: Text
path = Text
a} :: HttpPackageConfiguration)

-- | The name of the source group. This has to match one of the
-- @Channel::Outputs::SourceGroup@.
httpPackageConfiguration_sourceGroup :: Lens.Lens' HttpPackageConfiguration Prelude.Text
httpPackageConfiguration_sourceGroup :: Lens' HttpPackageConfiguration Text
httpPackageConfiguration_sourceGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpPackageConfiguration' {Text
sourceGroup :: Text
$sel:sourceGroup:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
sourceGroup} -> Text
sourceGroup) (\s :: HttpPackageConfiguration
s@HttpPackageConfiguration' {} Text
a -> HttpPackageConfiguration
s {$sel:sourceGroup:HttpPackageConfiguration' :: Text
sourceGroup = Text
a} :: HttpPackageConfiguration)

-- | The streaming protocol for this package configuration. Supported values
-- are @HLS@ and @DASH@.
httpPackageConfiguration_type :: Lens.Lens' HttpPackageConfiguration Type
httpPackageConfiguration_type :: Lens' HttpPackageConfiguration Type
httpPackageConfiguration_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpPackageConfiguration' {Type
type' :: Type
$sel:type':HttpPackageConfiguration' :: HttpPackageConfiguration -> Type
type'} -> Type
type') (\s :: HttpPackageConfiguration
s@HttpPackageConfiguration' {} Type
a -> HttpPackageConfiguration
s {$sel:type':HttpPackageConfiguration' :: Type
type' = Type
a} :: HttpPackageConfiguration)

instance Data.FromJSON HttpPackageConfiguration where
  parseJSON :: Value -> Parser HttpPackageConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HttpPackageConfiguration"
      ( \Object
x ->
          Text -> Text -> Type -> HttpPackageConfiguration
HttpPackageConfiguration'
            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
"Path")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SourceGroup")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Type")
      )

instance Prelude.Hashable HttpPackageConfiguration where
  hashWithSalt :: Int -> HttpPackageConfiguration -> Int
hashWithSalt Int
_salt HttpPackageConfiguration' {Text
Type
type' :: Type
sourceGroup :: Text
path :: Text
$sel:type':HttpPackageConfiguration' :: HttpPackageConfiguration -> Type
$sel:sourceGroup:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
$sel:path:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
path
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceGroup
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Type
type'

instance Prelude.NFData HttpPackageConfiguration where
  rnf :: HttpPackageConfiguration -> ()
rnf HttpPackageConfiguration' {Text
Type
type' :: Type
sourceGroup :: Text
path :: Text
$sel:type':HttpPackageConfiguration' :: HttpPackageConfiguration -> Type
$sel:sourceGroup:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
$sel:path:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
path
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceGroup
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Type
type'

instance Data.ToJSON HttpPackageConfiguration where
  toJSON :: HttpPackageConfiguration -> Value
toJSON HttpPackageConfiguration' {Text
Type
type' :: Type
sourceGroup :: Text
path :: Text
$sel:type':HttpPackageConfiguration' :: HttpPackageConfiguration -> Type
$sel:sourceGroup:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
$sel:path:HttpPackageConfiguration' :: HttpPackageConfiguration -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Path" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
path),
            forall a. a -> Maybe a
Prelude.Just (Key
"SourceGroup" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
sourceGroup),
            forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Type
type')
          ]
      )