{-# 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-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.VodSource 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.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 Data.POSIX,
    -- | The timestamp that indicates when the VOD source was last modified.
    VodSource -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The tags assigned to the VOD source. Tags are key-value pairs that you
    -- can associate with Amazon resources to help with organization, access
    -- control, and cost tracking. For more information, see
    -- <https://docs.aws.amazon.com/mediatailor/latest/ug/tagging.html Tagging AWS Elemental MediaTailor Resources>.
    VodSource -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN for the VOD source.
    VodSource -> Text
arn :: Prelude.Text,
    -- | The HTTP package configurations for the VOD source.
    VodSource -> [HttpPackageConfiguration]
httpPackageConfigurations :: [HttpPackageConfiguration],
    -- | The name of the source location that the VOD source is associated with.
    VodSource -> Text
sourceLocationName :: Prelude.Text,
    -- | The name of the VOD source.
    VodSource -> Text
vodSourceName :: Prelude.Text
  }
  deriving (VodSource -> VodSource -> Bool
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]
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
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. 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. Tags are key-value pairs that you
-- can associate with Amazon resources to help with organization, access
-- control, and cost tracking. For more information, see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/tagging.html Tagging AWS Elemental MediaTailor Resources>.
--
-- 'arn', 'vodSource_arn' - The ARN for the VOD source.
--
-- 'httpPackageConfigurations', 'vodSource_httpPackageConfigurations' - The HTTP package configurations for the VOD source.
--
-- 'sourceLocationName', 'vodSource_sourceLocationName' - The name of the source location that the VOD source is associated with.
--
-- 'vodSourceName', 'vodSource_vodSourceName' - The name of the VOD source.
newVodSource ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'sourceLocationName'
  Prelude.Text ->
  -- | 'vodSourceName'
  Prelude.Text ->
  VodSource
newVodSource :: Text -> Text -> Text -> VodSource
newVodSource
  Text
pArn_
  Text
pSourceLocationName_
  Text
pVodSourceName_ =
    VodSource'
      { $sel:creationTime:VodSource' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedTime:VodSource' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:VodSource' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:VodSource' :: Text
arn = Text
pArn_,
        $sel:httpPackageConfigurations:VodSource' :: [HttpPackageConfiguration]
httpPackageConfigurations = forall a. Monoid a => a
Prelude.mempty,
        $sel:sourceLocationName:VodSource' :: Text
sourceLocationName = Text
pSourceLocationName_,
        $sel:vodSourceName:VodSource' :: Text
vodSourceName = Text
pVodSourceName_
      }

-- | The timestamp that indicates when the VOD source was created.
vodSource_creationTime :: Lens.Lens' VodSource (Prelude.Maybe Prelude.UTCTime)
vodSource_creationTime :: Lens' VodSource (Maybe UTCTime)
vodSource_creationTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The timestamp that indicates when the VOD source was last modified.
vodSource_lastModifiedTime :: Lens.Lens' VodSource (Prelude.Maybe Prelude.UTCTime)
vodSource_lastModifiedTime :: Lens' VodSource (Maybe UTCTime)
vodSource_lastModifiedTime = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The tags assigned to the VOD source. Tags are key-value pairs that you
-- can associate with Amazon resources to help with organization, access
-- control, and cost tracking. For more information, see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/tagging.html Tagging AWS Elemental MediaTailor Resources>.
vodSource_tags :: Lens.Lens' VodSource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
vodSource_tags :: Lens' VodSource (Maybe (HashMap Text Text))
vodSource_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' VodSource Text
vodSource_arn = 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)

-- | The HTTP package configurations for the VOD source.
vodSource_httpPackageConfigurations :: Lens.Lens' VodSource [HttpPackageConfiguration]
vodSource_httpPackageConfigurations :: Lens' VodSource [HttpPackageConfiguration]
vodSource_httpPackageConfigurations = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the source location that the VOD source is associated with.
vodSource_sourceLocationName :: Lens.Lens' VodSource Prelude.Text
vodSource_sourceLocationName :: Lens' VodSource Text
vodSource_sourceLocationName = 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 name of the VOD source.
vodSource_vodSourceName :: Lens.Lens' VodSource Prelude.Text
vodSource_vodSourceName :: Lens' VodSource Text
vodSource_vodSourceName = 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)

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

instance Prelude.Hashable VodSource where
  hashWithSalt :: Int -> VodSource -> Int
hashWithSalt Int
_salt VodSource' {[HttpPackageConfiguration]
Maybe (HashMap Text Text)
Maybe POSIX
Text
vodSourceName :: Text
sourceLocationName :: Text
httpPackageConfigurations :: [HttpPackageConfiguration]
arn :: Text
tags :: Maybe (HashMap Text Text)
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:vodSourceName:VodSource' :: VodSource -> Text
$sel:sourceLocationName:VodSource' :: VodSource -> Text
$sel:httpPackageConfigurations:VodSource' :: VodSource -> [HttpPackageConfiguration]
$sel:arn:VodSource' :: VodSource -> Text
$sel:tags:VodSource' :: VodSource -> Maybe (HashMap Text Text)
$sel:lastModifiedTime:VodSource' :: VodSource -> Maybe POSIX
$sel:creationTime:VodSource' :: VodSource -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [HttpPackageConfiguration]
httpPackageConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceLocationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vodSourceName

instance Prelude.NFData VodSource where
  rnf :: VodSource -> ()
rnf VodSource' {[HttpPackageConfiguration]
Maybe (HashMap Text Text)
Maybe POSIX
Text
vodSourceName :: Text
sourceLocationName :: Text
httpPackageConfigurations :: [HttpPackageConfiguration]
arn :: Text
tags :: Maybe (HashMap Text Text)
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:vodSourceName:VodSource' :: VodSource -> Text
$sel:sourceLocationName:VodSource' :: VodSource -> Text
$sel:httpPackageConfigurations:VodSource' :: VodSource -> [HttpPackageConfiguration]
$sel:arn:VodSource' :: VodSource -> Text
$sel:tags:VodSource' :: VodSource -> Maybe (HashMap Text Text)
$sel:lastModifiedTime:VodSource' :: VodSource -> Maybe POSIX
$sel:creationTime:VodSource' :: VodSource -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [HttpPackageConfiguration]
httpPackageConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceLocationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vodSourceName