{-# 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.LiveSource
-- 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.LiveSource 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

-- | Live source configuration parameters.
--
-- /See:/ 'newLiveSource' smart constructor.
data LiveSource = LiveSource'
  { -- | The timestamp that indicates when the live source was created.
    LiveSource -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
    -- | The timestamp that indicates when the live source was last modified.
    LiveSource -> Maybe POSIX
lastModifiedTime :: Prelude.Maybe Data.POSIX,
    -- | The tags assigned to the live 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>.
    LiveSource -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN for the live source.
    LiveSource -> Text
arn :: Prelude.Text,
    -- | The HTTP package configurations for the live source.
    LiveSource -> [HttpPackageConfiguration]
httpPackageConfigurations :: [HttpPackageConfiguration],
    -- | The name that\'s used to refer to a live source.
    LiveSource -> Text
liveSourceName :: Prelude.Text,
    -- | The name of the source location.
    LiveSource -> Text
sourceLocationName :: Prelude.Text
  }
  deriving (LiveSource -> LiveSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LiveSource -> LiveSource -> Bool
$c/= :: LiveSource -> LiveSource -> Bool
== :: LiveSource -> LiveSource -> Bool
$c== :: LiveSource -> LiveSource -> Bool
Prelude.Eq, ReadPrec [LiveSource]
ReadPrec LiveSource
Int -> ReadS LiveSource
ReadS [LiveSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LiveSource]
$creadListPrec :: ReadPrec [LiveSource]
readPrec :: ReadPrec LiveSource
$creadPrec :: ReadPrec LiveSource
readList :: ReadS [LiveSource]
$creadList :: ReadS [LiveSource]
readsPrec :: Int -> ReadS LiveSource
$creadsPrec :: Int -> ReadS LiveSource
Prelude.Read, Int -> LiveSource -> ShowS
[LiveSource] -> ShowS
LiveSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LiveSource] -> ShowS
$cshowList :: [LiveSource] -> ShowS
show :: LiveSource -> String
$cshow :: LiveSource -> String
showsPrec :: Int -> LiveSource -> ShowS
$cshowsPrec :: Int -> LiveSource -> ShowS
Prelude.Show, forall x. Rep LiveSource x -> LiveSource
forall x. LiveSource -> Rep LiveSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LiveSource x -> LiveSource
$cfrom :: forall x. LiveSource -> Rep LiveSource x
Prelude.Generic)

-- |
-- Create a value of 'LiveSource' 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', 'liveSource_creationTime' - The timestamp that indicates when the live source was created.
--
-- 'lastModifiedTime', 'liveSource_lastModifiedTime' - The timestamp that indicates when the live source was last modified.
--
-- 'tags', 'liveSource_tags' - The tags assigned to the live 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', 'liveSource_arn' - The ARN for the live source.
--
-- 'httpPackageConfigurations', 'liveSource_httpPackageConfigurations' - The HTTP package configurations for the live source.
--
-- 'liveSourceName', 'liveSource_liveSourceName' - The name that\'s used to refer to a live source.
--
-- 'sourceLocationName', 'liveSource_sourceLocationName' - The name of the source location.
newLiveSource ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'liveSourceName'
  Prelude.Text ->
  -- | 'sourceLocationName'
  Prelude.Text ->
  LiveSource
newLiveSource :: Text -> Text -> Text -> LiveSource
newLiveSource
  Text
pArn_
  Text
pLiveSourceName_
  Text
pSourceLocationName_ =
    LiveSource'
      { $sel:creationTime:LiveSource' :: Maybe POSIX
creationTime = forall a. Maybe a
Prelude.Nothing,
        $sel:lastModifiedTime:LiveSource' :: Maybe POSIX
lastModifiedTime = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:LiveSource' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:arn:LiveSource' :: Text
arn = Text
pArn_,
        $sel:httpPackageConfigurations:LiveSource' :: [HttpPackageConfiguration]
httpPackageConfigurations = forall a. Monoid a => a
Prelude.mempty,
        $sel:liveSourceName:LiveSource' :: Text
liveSourceName = Text
pLiveSourceName_,
        $sel:sourceLocationName:LiveSource' :: Text
sourceLocationName = Text
pSourceLocationName_
      }

-- | The timestamp that indicates when the live source was created.
liveSource_creationTime :: Lens.Lens' LiveSource (Prelude.Maybe Prelude.UTCTime)
liveSource_creationTime :: Lens' LiveSource (Maybe UTCTime)
liveSource_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:LiveSource' :: LiveSource -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: LiveSource
s@LiveSource' {} Maybe POSIX
a -> LiveSource
s {$sel:creationTime:LiveSource' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: LiveSource) 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 live source was last modified.
liveSource_lastModifiedTime :: Lens.Lens' LiveSource (Prelude.Maybe Prelude.UTCTime)
liveSource_lastModifiedTime :: Lens' LiveSource (Maybe UTCTime)
liveSource_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Maybe POSIX
lastModifiedTime :: Maybe POSIX
$sel:lastModifiedTime:LiveSource' :: LiveSource -> Maybe POSIX
lastModifiedTime} -> Maybe POSIX
lastModifiedTime) (\s :: LiveSource
s@LiveSource' {} Maybe POSIX
a -> LiveSource
s {$sel:lastModifiedTime:LiveSource' :: Maybe POSIX
lastModifiedTime = Maybe POSIX
a} :: LiveSource) 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 live 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>.
liveSource_tags :: Lens.Lens' LiveSource (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
liveSource_tags :: Lens' LiveSource (Maybe (HashMap Text Text))
liveSource_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:LiveSource' :: LiveSource -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: LiveSource
s@LiveSource' {} Maybe (HashMap Text Text)
a -> LiveSource
s {$sel:tags:LiveSource' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: LiveSource) 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 live source.
liveSource_arn :: Lens.Lens' LiveSource Prelude.Text
liveSource_arn :: Lens' LiveSource Text
liveSource_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Text
arn :: Text
$sel:arn:LiveSource' :: LiveSource -> Text
arn} -> Text
arn) (\s :: LiveSource
s@LiveSource' {} Text
a -> LiveSource
s {$sel:arn:LiveSource' :: Text
arn = Text
a} :: LiveSource)

-- | The HTTP package configurations for the live source.
liveSource_httpPackageConfigurations :: Lens.Lens' LiveSource [HttpPackageConfiguration]
liveSource_httpPackageConfigurations :: Lens' LiveSource [HttpPackageConfiguration]
liveSource_httpPackageConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {[HttpPackageConfiguration]
httpPackageConfigurations :: [HttpPackageConfiguration]
$sel:httpPackageConfigurations:LiveSource' :: LiveSource -> [HttpPackageConfiguration]
httpPackageConfigurations} -> [HttpPackageConfiguration]
httpPackageConfigurations) (\s :: LiveSource
s@LiveSource' {} [HttpPackageConfiguration]
a -> LiveSource
s {$sel:httpPackageConfigurations:LiveSource' :: [HttpPackageConfiguration]
httpPackageConfigurations = [HttpPackageConfiguration]
a} :: LiveSource) 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 that\'s used to refer to a live source.
liveSource_liveSourceName :: Lens.Lens' LiveSource Prelude.Text
liveSource_liveSourceName :: Lens' LiveSource Text
liveSource_liveSourceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Text
liveSourceName :: Text
$sel:liveSourceName:LiveSource' :: LiveSource -> Text
liveSourceName} -> Text
liveSourceName) (\s :: LiveSource
s@LiveSource' {} Text
a -> LiveSource
s {$sel:liveSourceName:LiveSource' :: Text
liveSourceName = Text
a} :: LiveSource)

-- | The name of the source location.
liveSource_sourceLocationName :: Lens.Lens' LiveSource Prelude.Text
liveSource_sourceLocationName :: Lens' LiveSource Text
liveSource_sourceLocationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LiveSource' {Text
sourceLocationName :: Text
$sel:sourceLocationName:LiveSource' :: LiveSource -> Text
sourceLocationName} -> Text
sourceLocationName) (\s :: LiveSource
s@LiveSource' {} Text
a -> LiveSource
s {$sel:sourceLocationName:LiveSource' :: Text
sourceLocationName = Text
a} :: LiveSource)

instance Data.FromJSON LiveSource where
  parseJSON :: Value -> Parser LiveSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LiveSource"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Text
-> [HttpPackageConfiguration]
-> Text
-> Text
-> LiveSource
LiveSource'
            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
"LiveSourceName")
            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")
      )

instance Prelude.Hashable LiveSource where
  hashWithSalt :: Int -> LiveSource -> Int
hashWithSalt Int
_salt LiveSource' {[HttpPackageConfiguration]
Maybe (HashMap Text Text)
Maybe POSIX
Text
sourceLocationName :: Text
liveSourceName :: Text
httpPackageConfigurations :: [HttpPackageConfiguration]
arn :: Text
tags :: Maybe (HashMap Text Text)
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:sourceLocationName:LiveSource' :: LiveSource -> Text
$sel:liveSourceName:LiveSource' :: LiveSource -> Text
$sel:httpPackageConfigurations:LiveSource' :: LiveSource -> [HttpPackageConfiguration]
$sel:arn:LiveSource' :: LiveSource -> Text
$sel:tags:LiveSource' :: LiveSource -> Maybe (HashMap Text Text)
$sel:lastModifiedTime:LiveSource' :: LiveSource -> Maybe POSIX
$sel:creationTime:LiveSource' :: LiveSource -> 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
liveSourceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceLocationName

instance Prelude.NFData LiveSource where
  rnf :: LiveSource -> ()
rnf LiveSource' {[HttpPackageConfiguration]
Maybe (HashMap Text Text)
Maybe POSIX
Text
sourceLocationName :: Text
liveSourceName :: Text
httpPackageConfigurations :: [HttpPackageConfiguration]
arn :: Text
tags :: Maybe (HashMap Text Text)
lastModifiedTime :: Maybe POSIX
creationTime :: Maybe POSIX
$sel:sourceLocationName:LiveSource' :: LiveSource -> Text
$sel:liveSourceName:LiveSource' :: LiveSource -> Text
$sel:httpPackageConfigurations:LiveSource' :: LiveSource -> [HttpPackageConfiguration]
$sel:arn:LiveSource' :: LiveSource -> Text
$sel:tags:LiveSource' :: LiveSource -> Maybe (HashMap Text Text)
$sel:lastModifiedTime:LiveSource' :: LiveSource -> Maybe POSIX
$sel:creationTime:LiveSource' :: LiveSource -> 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
liveSourceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceLocationName