{-# 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.MediaLive.Types.OutputDestination
-- 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.MediaLive.Types.OutputDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.MediaPackageOutputDestinationSettings
import Amazonka.MediaLive.Types.MultiplexProgramChannelDestinationSettings
import Amazonka.MediaLive.Types.OutputDestinationSettings
import qualified Amazonka.Prelude as Prelude

-- | Placeholder documentation for OutputDestination
--
-- /See:/ 'newOutputDestination' smart constructor.
data OutputDestination = OutputDestination'
  { -- | Destination settings for a standard output; one destination for each
    -- redundant encoder.
    OutputDestination -> Maybe [OutputDestinationSettings]
settings :: Prelude.Maybe [OutputDestinationSettings],
    -- | Destination settings for a MediaPackage output; one destination for both
    -- encoders.
    OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings :: Prelude.Maybe [MediaPackageOutputDestinationSettings],
    -- | User-specified id. This is used in an output group or an output.
    OutputDestination -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Destination settings for a Multiplex output; one destination for both
    -- encoders.
    OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings :: Prelude.Maybe MultiplexProgramChannelDestinationSettings
  }
  deriving (OutputDestination -> OutputDestination -> Bool
(OutputDestination -> OutputDestination -> Bool)
-> (OutputDestination -> OutputDestination -> Bool)
-> Eq OutputDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputDestination -> OutputDestination -> Bool
$c/= :: OutputDestination -> OutputDestination -> Bool
== :: OutputDestination -> OutputDestination -> Bool
$c== :: OutputDestination -> OutputDestination -> Bool
Prelude.Eq, ReadPrec [OutputDestination]
ReadPrec OutputDestination
Int -> ReadS OutputDestination
ReadS [OutputDestination]
(Int -> ReadS OutputDestination)
-> ReadS [OutputDestination]
-> ReadPrec OutputDestination
-> ReadPrec [OutputDestination]
-> Read OutputDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputDestination]
$creadListPrec :: ReadPrec [OutputDestination]
readPrec :: ReadPrec OutputDestination
$creadPrec :: ReadPrec OutputDestination
readList :: ReadS [OutputDestination]
$creadList :: ReadS [OutputDestination]
readsPrec :: Int -> ReadS OutputDestination
$creadsPrec :: Int -> ReadS OutputDestination
Prelude.Read, Int -> OutputDestination -> ShowS
[OutputDestination] -> ShowS
OutputDestination -> String
(Int -> OutputDestination -> ShowS)
-> (OutputDestination -> String)
-> ([OutputDestination] -> ShowS)
-> Show OutputDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputDestination] -> ShowS
$cshowList :: [OutputDestination] -> ShowS
show :: OutputDestination -> String
$cshow :: OutputDestination -> String
showsPrec :: Int -> OutputDestination -> ShowS
$cshowsPrec :: Int -> OutputDestination -> ShowS
Prelude.Show, (forall x. OutputDestination -> Rep OutputDestination x)
-> (forall x. Rep OutputDestination x -> OutputDestination)
-> Generic OutputDestination
forall x. Rep OutputDestination x -> OutputDestination
forall x. OutputDestination -> Rep OutputDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputDestination x -> OutputDestination
$cfrom :: forall x. OutputDestination -> Rep OutputDestination x
Prelude.Generic)

-- |
-- Create a value of 'OutputDestination' 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:
--
-- 'settings', 'outputDestination_settings' - Destination settings for a standard output; one destination for each
-- redundant encoder.
--
-- 'mediaPackageSettings', 'outputDestination_mediaPackageSettings' - Destination settings for a MediaPackage output; one destination for both
-- encoders.
--
-- 'id', 'outputDestination_id' - User-specified id. This is used in an output group or an output.
--
-- 'multiplexSettings', 'outputDestination_multiplexSettings' - Destination settings for a Multiplex output; one destination for both
-- encoders.
newOutputDestination ::
  OutputDestination
newOutputDestination :: OutputDestination
newOutputDestination =
  OutputDestination' :: Maybe [OutputDestinationSettings]
-> Maybe [MediaPackageOutputDestinationSettings]
-> Maybe Text
-> Maybe MultiplexProgramChannelDestinationSettings
-> OutputDestination
OutputDestination'
    { $sel:settings:OutputDestination' :: Maybe [OutputDestinationSettings]
settings = Maybe [OutputDestinationSettings]
forall a. Maybe a
Prelude.Nothing,
      $sel:mediaPackageSettings:OutputDestination' :: Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings = Maybe [MediaPackageOutputDestinationSettings]
forall a. Maybe a
Prelude.Nothing,
      $sel:id:OutputDestination' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:multiplexSettings:OutputDestination' :: Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings = Maybe MultiplexProgramChannelDestinationSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Destination settings for a standard output; one destination for each
-- redundant encoder.
outputDestination_settings :: Lens.Lens' OutputDestination (Prelude.Maybe [OutputDestinationSettings])
outputDestination_settings :: (Maybe [OutputDestinationSettings]
 -> f (Maybe [OutputDestinationSettings]))
-> OutputDestination -> f OutputDestination
outputDestination_settings = (OutputDestination -> Maybe [OutputDestinationSettings])
-> (OutputDestination
    -> Maybe [OutputDestinationSettings] -> OutputDestination)
-> Lens
     OutputDestination
     OutputDestination
     (Maybe [OutputDestinationSettings])
     (Maybe [OutputDestinationSettings])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe [OutputDestinationSettings]
settings :: Maybe [OutputDestinationSettings]
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
settings} -> Maybe [OutputDestinationSettings]
settings) (\s :: OutputDestination
s@OutputDestination' {} Maybe [OutputDestinationSettings]
a -> OutputDestination
s {$sel:settings:OutputDestination' :: Maybe [OutputDestinationSettings]
settings = Maybe [OutputDestinationSettings]
a} :: OutputDestination) ((Maybe [OutputDestinationSettings]
  -> f (Maybe [OutputDestinationSettings]))
 -> OutputDestination -> f OutputDestination)
-> ((Maybe [OutputDestinationSettings]
     -> f (Maybe [OutputDestinationSettings]))
    -> Maybe [OutputDestinationSettings]
    -> f (Maybe [OutputDestinationSettings]))
-> (Maybe [OutputDestinationSettings]
    -> f (Maybe [OutputDestinationSettings]))
-> OutputDestination
-> f OutputDestination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OutputDestinationSettings]
  [OutputDestinationSettings]
  [OutputDestinationSettings]
  [OutputDestinationSettings]
-> Iso
     (Maybe [OutputDestinationSettings])
     (Maybe [OutputDestinationSettings])
     (Maybe [OutputDestinationSettings])
     (Maybe [OutputDestinationSettings])
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
  [OutputDestinationSettings]
  [OutputDestinationSettings]
  [OutputDestinationSettings]
  [OutputDestinationSettings]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Destination settings for a MediaPackage output; one destination for both
-- encoders.
outputDestination_mediaPackageSettings :: Lens.Lens' OutputDestination (Prelude.Maybe [MediaPackageOutputDestinationSettings])
outputDestination_mediaPackageSettings :: (Maybe [MediaPackageOutputDestinationSettings]
 -> f (Maybe [MediaPackageOutputDestinationSettings]))
-> OutputDestination -> f OutputDestination
outputDestination_mediaPackageSettings = (OutputDestination
 -> Maybe [MediaPackageOutputDestinationSettings])
-> (OutputDestination
    -> Maybe [MediaPackageOutputDestinationSettings]
    -> OutputDestination)
-> Lens
     OutputDestination
     OutputDestination
     (Maybe [MediaPackageOutputDestinationSettings])
     (Maybe [MediaPackageOutputDestinationSettings])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings} -> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings) (\s :: OutputDestination
s@OutputDestination' {} Maybe [MediaPackageOutputDestinationSettings]
a -> OutputDestination
s {$sel:mediaPackageSettings:OutputDestination' :: Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings = Maybe [MediaPackageOutputDestinationSettings]
a} :: OutputDestination) ((Maybe [MediaPackageOutputDestinationSettings]
  -> f (Maybe [MediaPackageOutputDestinationSettings]))
 -> OutputDestination -> f OutputDestination)
-> ((Maybe [MediaPackageOutputDestinationSettings]
     -> f (Maybe [MediaPackageOutputDestinationSettings]))
    -> Maybe [MediaPackageOutputDestinationSettings]
    -> f (Maybe [MediaPackageOutputDestinationSettings]))
-> (Maybe [MediaPackageOutputDestinationSettings]
    -> f (Maybe [MediaPackageOutputDestinationSettings]))
-> OutputDestination
-> f OutputDestination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
-> Iso
     (Maybe [MediaPackageOutputDestinationSettings])
     (Maybe [MediaPackageOutputDestinationSettings])
     (Maybe [MediaPackageOutputDestinationSettings])
     (Maybe [MediaPackageOutputDestinationSettings])
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
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
  [MediaPackageOutputDestinationSettings]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | User-specified id. This is used in an output group or an output.
outputDestination_id :: Lens.Lens' OutputDestination (Prelude.Maybe Prelude.Text)
outputDestination_id :: (Maybe Text -> f (Maybe Text))
-> OutputDestination -> f OutputDestination
outputDestination_id = (OutputDestination -> Maybe Text)
-> (OutputDestination -> Maybe Text -> OutputDestination)
-> Lens
     OutputDestination OutputDestination (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe Text
id :: Maybe Text
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
id} -> Maybe Text
id) (\s :: OutputDestination
s@OutputDestination' {} Maybe Text
a -> OutputDestination
s {$sel:id:OutputDestination' :: Maybe Text
id = Maybe Text
a} :: OutputDestination)

-- | Destination settings for a Multiplex output; one destination for both
-- encoders.
outputDestination_multiplexSettings :: Lens.Lens' OutputDestination (Prelude.Maybe MultiplexProgramChannelDestinationSettings)
outputDestination_multiplexSettings :: (Maybe MultiplexProgramChannelDestinationSettings
 -> f (Maybe MultiplexProgramChannelDestinationSettings))
-> OutputDestination -> f OutputDestination
outputDestination_multiplexSettings = (OutputDestination
 -> Maybe MultiplexProgramChannelDestinationSettings)
-> (OutputDestination
    -> Maybe MultiplexProgramChannelDestinationSettings
    -> OutputDestination)
-> Lens
     OutputDestination
     OutputDestination
     (Maybe MultiplexProgramChannelDestinationSettings)
     (Maybe MultiplexProgramChannelDestinationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestination' {Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings} -> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings) (\s :: OutputDestination
s@OutputDestination' {} Maybe MultiplexProgramChannelDestinationSettings
a -> OutputDestination
s {$sel:multiplexSettings:OutputDestination' :: Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings = Maybe MultiplexProgramChannelDestinationSettings
a} :: OutputDestination)

instance Core.FromJSON OutputDestination where
  parseJSON :: Value -> Parser OutputDestination
parseJSON =
    String
-> (Object -> Parser OutputDestination)
-> Value
-> Parser OutputDestination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputDestination"
      ( \Object
x ->
          Maybe [OutputDestinationSettings]
-> Maybe [MediaPackageOutputDestinationSettings]
-> Maybe Text
-> Maybe MultiplexProgramChannelDestinationSettings
-> OutputDestination
OutputDestination'
            (Maybe [OutputDestinationSettings]
 -> Maybe [MediaPackageOutputDestinationSettings]
 -> Maybe Text
 -> Maybe MultiplexProgramChannelDestinationSettings
 -> OutputDestination)
-> Parser (Maybe [OutputDestinationSettings])
-> Parser
     (Maybe [MediaPackageOutputDestinationSettings]
      -> Maybe Text
      -> Maybe MultiplexProgramChannelDestinationSettings
      -> OutputDestination)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe [OutputDestinationSettings]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"settings" Parser (Maybe (Maybe [OutputDestinationSettings]))
-> Maybe [OutputDestinationSettings]
-> Parser (Maybe [OutputDestinationSettings])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OutputDestinationSettings]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [MediaPackageOutputDestinationSettings]
   -> Maybe Text
   -> Maybe MultiplexProgramChannelDestinationSettings
   -> OutputDestination)
-> Parser (Maybe [MediaPackageOutputDestinationSettings])
-> Parser
     (Maybe Text
      -> Maybe MultiplexProgramChannelDestinationSettings
      -> OutputDestination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe [MediaPackageOutputDestinationSettings]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"mediaPackageSettings"
                            Parser (Maybe (Maybe [MediaPackageOutputDestinationSettings]))
-> Maybe [MediaPackageOutputDestinationSettings]
-> Parser (Maybe [MediaPackageOutputDestinationSettings])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MediaPackageOutputDestinationSettings]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe MultiplexProgramChannelDestinationSettings
   -> OutputDestination)
-> Parser (Maybe Text)
-> Parser
     (Maybe MultiplexProgramChannelDestinationSettings
      -> OutputDestination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
            Parser
  (Maybe MultiplexProgramChannelDestinationSettings
   -> OutputDestination)
-> Parser (Maybe MultiplexProgramChannelDestinationSettings)
-> Parser OutputDestination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Parser (Maybe MultiplexProgramChannelDestinationSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"multiplexSettings")
      )

instance Prelude.Hashable OutputDestination

instance Prelude.NFData OutputDestination

instance Core.ToJSON OutputDestination where
  toJSON :: OutputDestination -> Value
toJSON OutputDestination' {Maybe [MediaPackageOutputDestinationSettings]
Maybe [OutputDestinationSettings]
Maybe Text
Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings :: Maybe MultiplexProgramChannelDestinationSettings
id :: Maybe Text
mediaPackageSettings :: Maybe [MediaPackageOutputDestinationSettings]
settings :: Maybe [OutputDestinationSettings]
$sel:multiplexSettings:OutputDestination' :: OutputDestination
-> Maybe MultiplexProgramChannelDestinationSettings
$sel:id:OutputDestination' :: OutputDestination -> Maybe Text
$sel:mediaPackageSettings:OutputDestination' :: OutputDestination -> Maybe [MediaPackageOutputDestinationSettings]
$sel:settings:OutputDestination' :: OutputDestination -> Maybe [OutputDestinationSettings]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"settings" Text -> [OutputDestinationSettings] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OutputDestinationSettings] -> Pair)
-> Maybe [OutputDestinationSettings] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OutputDestinationSettings]
settings,
            (Text
"mediaPackageSettings" Text -> [MediaPackageOutputDestinationSettings] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([MediaPackageOutputDestinationSettings] -> Pair)
-> Maybe [MediaPackageOutputDestinationSettings] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MediaPackageOutputDestinationSettings]
mediaPackageSettings,
            (Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
id,
            (Text
"multiplexSettings" Text -> MultiplexProgramChannelDestinationSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MultiplexProgramChannelDestinationSettings -> Pair)
-> Maybe MultiplexProgramChannelDestinationSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MultiplexProgramChannelDestinationSettings
multiplexSettings
          ]
      )