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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types.HttpPackageConfiguration
import qualified Amazonka.Prelude as Prelude

-- | VOD source configuration parameters.
--
-- /See:/ 'newVodSource' smart constructor.
data VodSource = VodSource'
  { -- | The timestamp that indicates when the VOD source was created.
    VodSource -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The timestamp that indicates when the VOD source was last modified.
    VodSource -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Core.POSIX,
    -- | The tags assigned to the VOD source.
    VodSource -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the VOD source.
    VodSource -> Text
vodSourceName :: Prelude.Text,
    -- | The name of the source location that the VOD source is associated with.
    VodSource -> Text
sourceLocationName :: Prelude.Text,
    -- | The HTTP package configurations for the VOD source.
    VodSource -> [HttpPackageConfiguration]
httpPackageConfigurations :: [HttpPackageConfiguration],
    -- | The ARN for the VOD source.
    VodSource -> Text
arn :: Prelude.Text
  }
  deriving (VodSource -> VodSource -> Bool
(VodSource -> VodSource -> Bool)
-> (VodSource -> VodSource -> Bool) -> Eq VodSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VodSource -> VodSource -> Bool
$c/= :: VodSource -> VodSource -> Bool
== :: VodSource -> VodSource -> Bool
$c== :: VodSource -> VodSource -> Bool
Prelude.Eq, ReadPrec [VodSource]
ReadPrec VodSource
Int -> ReadS VodSource
ReadS [VodSource]
(Int -> ReadS VodSource)
-> ReadS [VodSource]
-> ReadPrec VodSource
-> ReadPrec [VodSource]
-> Read VodSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VodSource]
$creadListPrec :: ReadPrec [VodSource]
readPrec :: ReadPrec VodSource
$creadPrec :: ReadPrec VodSource
readList :: ReadS [VodSource]
$creadList :: ReadS [VodSource]
readsPrec :: Int -> ReadS VodSource
$creadsPrec :: Int -> ReadS VodSource
Prelude.Read, Int -> VodSource -> ShowS
[VodSource] -> ShowS
VodSource -> String
(Int -> VodSource -> ShowS)
-> (VodSource -> String)
-> ([VodSource] -> ShowS)
-> Show VodSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VodSource] -> ShowS
$cshowList :: [VodSource] -> ShowS
show :: VodSource -> String
$cshow :: VodSource -> String
showsPrec :: Int -> VodSource -> ShowS
$cshowsPrec :: Int -> VodSource -> ShowS
Prelude.Show, (forall x. VodSource -> Rep VodSource x)
-> (forall x. Rep VodSource x -> VodSource) -> Generic VodSource
forall x. Rep VodSource x -> VodSource
forall x. VodSource -> Rep VodSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VodSource x -> VodSource
$cfrom :: forall x. VodSource -> Rep VodSource x
Prelude.Generic)

-- |
-- Create a value of 'VodSource' 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:
--
-- 'creationTime', 'vodSource_creationTime' - The timestamp that indicates when the VOD source was created.
--
-- 'lastModifiedTime', 'vodSource_lastModifiedTime' - The timestamp that indicates when the VOD source was last modified.
--
-- 'tags', 'vodSource_tags' - The tags assigned to the VOD source.
--
-- 'vodSourceName', 'vodSource_vodSourceName' - The name of the VOD source.
--
-- 'sourceLocationName', 'vodSource_sourceLocationName' - The name of the source location that the VOD source is associated with.
--
-- 'httpPackageConfigurations', 'vodSource_httpPackageConfigurations' - The HTTP package configurations for the VOD source.
--
-- 'arn', 'vodSource_arn' - The ARN for the VOD source.
newVodSource ::
  -- | 'vodSourceName'
  Prelude.Text ->
  -- | 'sourceLocationName'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  VodSource
newVodSource :: Text -> Text -> Text -> VodSource
newVodSource
  Text
pVodSourceName_
  Text
pSourceLocationName_
  Text
pArn_ =
    VodSource' :: Maybe POSIX
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> [HttpPackageConfiguration]
-> Text
-> VodSource
VodSource'
      { $sel:creationTime:VodSource' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedTime:VodSource' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:VodSource' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:vodSourceName:VodSource' :: Text
vodSourceName = Text
pVodSourceName_,
        $sel:sourceLocationName:VodSource' :: Text
sourceLocationName = Text
pSourceLocationName_,
        $sel:httpPackageConfigurations:VodSource' :: [HttpPackageConfiguration]
httpPackageConfigurations = [HttpPackageConfiguration]
forall a. Monoid a => a
Prelude.mempty,
        $sel:arn:VodSource' :: Text
arn = Text
pArn_
      }

-- | The timestamp that indicates when the VOD source was created.
vodSource_creationTime :: Lens.Lens' VodSource (Prelude.Maybe Prelude.UTCTime)
vodSource_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> VodSource -> f VodSource
vodSource_creationTime = (VodSource -> Maybe POSIX)
-> (VodSource -> Maybe POSIX -> VodSource)
-> Lens VodSource VodSource (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:VodSource' :: VodSource -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: VodSource
s@VodSource' {} Maybe POSIX
a -> VodSource
s {$sel:creationTime:VodSource' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: VodSource) ((Maybe POSIX -> f (Maybe POSIX)) -> VodSource -> f VodSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VodSource
-> f VodSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The timestamp that indicates when the VOD source was last modified.
vodSource_lastModifiedTime :: Lens.Lens' VodSource (Prelude.Maybe Prelude.UTCTime)
vodSource_lastModifiedTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> VodSource -> f VodSource
vodSource_lastModifiedTime = (VodSource -> Maybe POSIX)
-> (VodSource -> Maybe POSIX -> VodSource)
-> Lens VodSource VodSource (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:VodSource' :: VodSource -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: VodSource
s@VodSource' {} Maybe POSIX
a -> VodSource
s {$sel:lastModifiedTime:VodSource' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: VodSource) ((Maybe POSIX -> f (Maybe POSIX)) -> VodSource -> f VodSource)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> VodSource
-> f VodSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The tags assigned to the VOD source.
vodSource_tags :: Lens.Lens' VodSource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
vodSource_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VodSource -> f VodSource
vodSource_tags = (VodSource -> Maybe (HashMap Text Text))
-> (VodSource -> Maybe (HashMap Text Text) -> VodSource)
-> Lens
     VodSource
     VodSource
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:VodSource' :: VodSource -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: VodSource
s@VodSource' {} Maybe (HashMap Text Text)
a -> VodSource
s {$sel:tags:VodSource' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: VodSource) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> VodSource -> f VodSource)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VodSource
-> f VodSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the VOD source.
vodSource_vodSourceName :: Lens.Lens' VodSource Prelude.Text
vodSource_vodSourceName :: (Text -> f Text) -> VodSource -> f VodSource
vodSource_vodSourceName = (VodSource -> Text)
-> (VodSource -> Text -> VodSource)
-> Lens VodSource VodSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Text
vodSourceName :: Text
$sel:vodSourceName:VodSource' :: VodSource -> Text
vodSourceName} -> Text
vodSourceName) (\s :: VodSource
s@VodSource' {} Text
a -> VodSource
s {$sel:vodSourceName:VodSource' :: Text
vodSourceName = Text
a} :: VodSource)

-- | The name of the source location that the VOD source is associated with.
vodSource_sourceLocationName :: Lens.Lens' VodSource Prelude.Text
vodSource_sourceLocationName :: (Text -> f Text) -> VodSource -> f VodSource
vodSource_sourceLocationName = (VodSource -> Text)
-> (VodSource -> Text -> VodSource)
-> Lens VodSource VodSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Text
sourceLocationName :: Text
$sel:sourceLocationName:VodSource' :: VodSource -> Text
sourceLocationName} -> Text
sourceLocationName) (\s :: VodSource
s@VodSource' {} Text
a -> VodSource
s {$sel:sourceLocationName:VodSource' :: Text
sourceLocationName = Text
a} :: VodSource)

-- | The HTTP package configurations for the VOD source.
vodSource_httpPackageConfigurations :: Lens.Lens' VodSource [HttpPackageConfiguration]
vodSource_httpPackageConfigurations :: ([HttpPackageConfiguration] -> f [HttpPackageConfiguration])
-> VodSource -> f VodSource
vodSource_httpPackageConfigurations = (VodSource -> [HttpPackageConfiguration])
-> (VodSource -> [HttpPackageConfiguration] -> VodSource)
-> Lens
     VodSource
     VodSource
     [HttpPackageConfiguration]
     [HttpPackageConfiguration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {[HttpPackageConfiguration]
httpPackageConfigurations :: [HttpPackageConfiguration]
$sel:httpPackageConfigurations:VodSource' :: VodSource -> [HttpPackageConfiguration]
httpPackageConfigurations} -> [HttpPackageConfiguration]
httpPackageConfigurations) (\s :: VodSource
s@VodSource' {} [HttpPackageConfiguration]
a -> VodSource
s {$sel:httpPackageConfigurations:VodSource' :: [HttpPackageConfiguration]
httpPackageConfigurations = [HttpPackageConfiguration]
a} :: VodSource) (([HttpPackageConfiguration] -> f [HttpPackageConfiguration])
 -> VodSource -> f VodSource)
-> (([HttpPackageConfiguration] -> f [HttpPackageConfiguration])
    -> [HttpPackageConfiguration] -> f [HttpPackageConfiguration])
-> ([HttpPackageConfiguration] -> f [HttpPackageConfiguration])
-> VodSource
-> f VodSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HttpPackageConfiguration] -> f [HttpPackageConfiguration])
-> [HttpPackageConfiguration] -> f [HttpPackageConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN for the VOD source.
vodSource_arn :: Lens.Lens' VodSource Prelude.Text
vodSource_arn :: (Text -> f Text) -> VodSource -> f VodSource
vodSource_arn = (VodSource -> Text)
-> (VodSource -> Text -> VodSource)
-> Lens VodSource VodSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VodSource' {Text
arn :: Text
$sel:arn:VodSource' :: VodSource -> Text
arn} -> Text
arn) (\s :: VodSource
s@VodSource' {} Text
a -> VodSource
s {$sel:arn:VodSource' :: Text
arn = Text
a} :: VodSource)

instance Core.FromJSON VodSource where
  parseJSON :: Value -> Parser VodSource
parseJSON =
    String -> (Object -> Parser VodSource) -> Value -> Parser VodSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VodSource"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> [HttpPackageConfiguration]
-> Text
-> VodSource
VodSource'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe (HashMap Text Text)
 -> Text
 -> Text
 -> [HttpPackageConfiguration]
 -> Text
 -> VodSource)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Text
      -> Text
      -> [HttpPackageConfiguration]
      -> Text
      -> VodSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Text
   -> Text
   -> [HttpPackageConfiguration]
   -> Text
   -> VodSource)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe (HashMap Text Text)
      -> Text -> Text -> [HttpPackageConfiguration] -> Text -> VodSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModifiedTime")
            Parser
  (Maybe (HashMap Text Text)
   -> Text -> Text -> [HttpPackageConfiguration] -> Text -> VodSource)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Text -> Text -> [HttpPackageConfiguration] -> Text -> VodSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Text -> Text -> [HttpPackageConfiguration] -> Text -> VodSource)
-> Parser Text
-> Parser (Text -> [HttpPackageConfiguration] -> Text -> VodSource)
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
"VodSourceName")
            Parser (Text -> [HttpPackageConfiguration] -> Text -> VodSource)
-> Parser Text
-> Parser ([HttpPackageConfiguration] -> Text -> VodSource)
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
"SourceLocationName")
            Parser ([HttpPackageConfiguration] -> Text -> VodSource)
-> Parser [HttpPackageConfiguration] -> Parser (Text -> VodSource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [HttpPackageConfiguration])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HttpPackageConfigurations"
                            Parser (Maybe [HttpPackageConfiguration])
-> [HttpPackageConfiguration] -> Parser [HttpPackageConfiguration]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [HttpPackageConfiguration]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> VodSource) -> Parser Text -> Parser VodSource
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
"Arn")
      )

instance Prelude.Hashable VodSource

instance Prelude.NFData VodSource