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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 streaming protocol for this package configuration. Supported values
    -- are HLS and DASH.
    HttpPackageConfiguration -> Type
type' :: Type,
    -- | The name of the source group. This has to match one of the
    -- Channel::Outputs::SourceGroup.
    HttpPackageConfiguration -> Text
sourceGroup :: Prelude.Text
  }
  deriving (HttpPackageConfiguration -> HttpPackageConfiguration -> Bool
(HttpPackageConfiguration -> HttpPackageConfiguration -> Bool)
-> (HttpPackageConfiguration -> HttpPackageConfiguration -> Bool)
-> Eq HttpPackageConfiguration
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]
(Int -> ReadS HttpPackageConfiguration)
-> ReadS [HttpPackageConfiguration]
-> ReadPrec HttpPackageConfiguration
-> ReadPrec [HttpPackageConfiguration]
-> Read 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
(Int -> HttpPackageConfiguration -> ShowS)
-> (HttpPackageConfiguration -> String)
-> ([HttpPackageConfiguration] -> ShowS)
-> Show HttpPackageConfiguration
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.
 HttpPackageConfiguration -> Rep HttpPackageConfiguration x)
-> (forall x.
    Rep HttpPackageConfiguration x -> HttpPackageConfiguration)
-> Generic HttpPackageConfiguration
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.
--
-- 'type'', 'httpPackageConfiguration_type' - The streaming protocol for this package configuration. Supported values
-- are HLS and DASH.
--
-- 'sourceGroup', 'httpPackageConfiguration_sourceGroup' - The name of the source group. This has to match one of the
-- Channel::Outputs::SourceGroup.
newHttpPackageConfiguration ::
  -- | 'path'
  Prelude.Text ->
  -- | 'type''
  Type ->
  -- | 'sourceGroup'
  Prelude.Text ->
  HttpPackageConfiguration
newHttpPackageConfiguration :: Text -> Type -> Text -> HttpPackageConfiguration
newHttpPackageConfiguration
  Text
pPath_
  Type
pType_
  Text
pSourceGroup_ =
    HttpPackageConfiguration' :: Text -> Type -> Text -> HttpPackageConfiguration
HttpPackageConfiguration'
      { $sel:path:HttpPackageConfiguration' :: Text
path = Text
pPath_,
        $sel:type':HttpPackageConfiguration' :: Type
type' = Type
pType_,
        $sel:sourceGroup:HttpPackageConfiguration' :: Text
sourceGroup = Text
pSourceGroup_
      }

-- | 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 :: (Text -> f Text)
-> HttpPackageConfiguration -> f HttpPackageConfiguration
httpPackageConfiguration_path = (HttpPackageConfiguration -> Text)
-> (HttpPackageConfiguration -> Text -> HttpPackageConfiguration)
-> Lens HttpPackageConfiguration HttpPackageConfiguration Text Text
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 streaming protocol for this package configuration. Supported values
-- are HLS and DASH.
httpPackageConfiguration_type :: Lens.Lens' HttpPackageConfiguration Type
httpPackageConfiguration_type :: (Type -> f Type)
-> HttpPackageConfiguration -> f HttpPackageConfiguration
httpPackageConfiguration_type = (HttpPackageConfiguration -> Type)
-> (HttpPackageConfiguration -> Type -> HttpPackageConfiguration)
-> Lens HttpPackageConfiguration HttpPackageConfiguration Type 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)

-- | 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 :: (Text -> f Text)
-> HttpPackageConfiguration -> f HttpPackageConfiguration
httpPackageConfiguration_sourceGroup = (HttpPackageConfiguration -> Text)
-> (HttpPackageConfiguration -> Text -> HttpPackageConfiguration)
-> Lens HttpPackageConfiguration HttpPackageConfiguration Text Text
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)

instance Core.FromJSON HttpPackageConfiguration where
  parseJSON :: Value -> Parser HttpPackageConfiguration
parseJSON =
    String
-> (Object -> Parser HttpPackageConfiguration)
-> Value
-> Parser HttpPackageConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HttpPackageConfiguration"
      ( \Object
x ->
          Text -> Type -> Text -> HttpPackageConfiguration
HttpPackageConfiguration'
            (Text -> Type -> Text -> HttpPackageConfiguration)
-> Parser Text -> Parser (Type -> Text -> HttpPackageConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Path")
            Parser (Type -> Text -> HttpPackageConfiguration)
-> Parser Type -> Parser (Text -> HttpPackageConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Type
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
            Parser (Text -> HttpPackageConfiguration)
-> Parser Text -> Parser HttpPackageConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SourceGroup")
      )

instance Prelude.Hashable HttpPackageConfiguration

instance Prelude.NFData HttpPackageConfiguration

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