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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Placeholder documentation for OutputDestinationSettings
--
-- /See:/ 'newOutputDestinationSettings' smart constructor.
data OutputDestinationSettings = OutputDestinationSettings'
  { -- | A URL specifying a destination
    OutputDestinationSettings -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | username for destination
    OutputDestinationSettings -> Maybe Text
username :: Prelude.Maybe Prelude.Text,
    -- | key used to extract the password from EC2 Parameter store
    OutputDestinationSettings -> Maybe Text
passwordParam :: Prelude.Maybe Prelude.Text,
    -- | Stream name for RTMP destinations (URLs of type rtmp:\/\/)
    OutputDestinationSettings -> Maybe Text
streamName :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputDestinationSettings -> OutputDestinationSettings -> Bool
(OutputDestinationSettings -> OutputDestinationSettings -> Bool)
-> (OutputDestinationSettings -> OutputDestinationSettings -> Bool)
-> Eq OutputDestinationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputDestinationSettings -> OutputDestinationSettings -> Bool
$c/= :: OutputDestinationSettings -> OutputDestinationSettings -> Bool
== :: OutputDestinationSettings -> OutputDestinationSettings -> Bool
$c== :: OutputDestinationSettings -> OutputDestinationSettings -> Bool
Prelude.Eq, ReadPrec [OutputDestinationSettings]
ReadPrec OutputDestinationSettings
Int -> ReadS OutputDestinationSettings
ReadS [OutputDestinationSettings]
(Int -> ReadS OutputDestinationSettings)
-> ReadS [OutputDestinationSettings]
-> ReadPrec OutputDestinationSettings
-> ReadPrec [OutputDestinationSettings]
-> Read OutputDestinationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputDestinationSettings]
$creadListPrec :: ReadPrec [OutputDestinationSettings]
readPrec :: ReadPrec OutputDestinationSettings
$creadPrec :: ReadPrec OutputDestinationSettings
readList :: ReadS [OutputDestinationSettings]
$creadList :: ReadS [OutputDestinationSettings]
readsPrec :: Int -> ReadS OutputDestinationSettings
$creadsPrec :: Int -> ReadS OutputDestinationSettings
Prelude.Read, Int -> OutputDestinationSettings -> ShowS
[OutputDestinationSettings] -> ShowS
OutputDestinationSettings -> String
(Int -> OutputDestinationSettings -> ShowS)
-> (OutputDestinationSettings -> String)
-> ([OutputDestinationSettings] -> ShowS)
-> Show OutputDestinationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputDestinationSettings] -> ShowS
$cshowList :: [OutputDestinationSettings] -> ShowS
show :: OutputDestinationSettings -> String
$cshow :: OutputDestinationSettings -> String
showsPrec :: Int -> OutputDestinationSettings -> ShowS
$cshowsPrec :: Int -> OutputDestinationSettings -> ShowS
Prelude.Show, (forall x.
 OutputDestinationSettings -> Rep OutputDestinationSettings x)
-> (forall x.
    Rep OutputDestinationSettings x -> OutputDestinationSettings)
-> Generic OutputDestinationSettings
forall x.
Rep OutputDestinationSettings x -> OutputDestinationSettings
forall x.
OutputDestinationSettings -> Rep OutputDestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OutputDestinationSettings x -> OutputDestinationSettings
$cfrom :: forall x.
OutputDestinationSettings -> Rep OutputDestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'OutputDestinationSettings' 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:
--
-- 'url', 'outputDestinationSettings_url' - A URL specifying a destination
--
-- 'username', 'outputDestinationSettings_username' - username for destination
--
-- 'passwordParam', 'outputDestinationSettings_passwordParam' - key used to extract the password from EC2 Parameter store
--
-- 'streamName', 'outputDestinationSettings_streamName' - Stream name for RTMP destinations (URLs of type rtmp:\/\/)
newOutputDestinationSettings ::
  OutputDestinationSettings
newOutputDestinationSettings :: OutputDestinationSettings
newOutputDestinationSettings =
  OutputDestinationSettings' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OutputDestinationSettings
OutputDestinationSettings'
    { $sel:url:OutputDestinationSettings' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:username:OutputDestinationSettings' :: Maybe Text
username = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:passwordParam:OutputDestinationSettings' :: Maybe Text
passwordParam = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:OutputDestinationSettings' :: Maybe Text
streamName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A URL specifying a destination
outputDestinationSettings_url :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_url :: (Maybe Text -> f (Maybe Text))
-> OutputDestinationSettings -> f OutputDestinationSettings
outputDestinationSettings_url = (OutputDestinationSettings -> Maybe Text)
-> (OutputDestinationSettings
    -> Maybe Text -> OutputDestinationSettings)
-> Lens
     OutputDestinationSettings
     OutputDestinationSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestinationSettings' {Maybe Text
url :: Maybe Text
$sel:url:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
url} -> Maybe Text
url) (\s :: OutputDestinationSettings
s@OutputDestinationSettings' {} Maybe Text
a -> OutputDestinationSettings
s {$sel:url:OutputDestinationSettings' :: Maybe Text
url = Maybe Text
a} :: OutputDestinationSettings)

-- | username for destination
outputDestinationSettings_username :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_username :: (Maybe Text -> f (Maybe Text))
-> OutputDestinationSettings -> f OutputDestinationSettings
outputDestinationSettings_username = (OutputDestinationSettings -> Maybe Text)
-> (OutputDestinationSettings
    -> Maybe Text -> OutputDestinationSettings)
-> Lens
     OutputDestinationSettings
     OutputDestinationSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestinationSettings' {Maybe Text
username :: Maybe Text
$sel:username:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
username} -> Maybe Text
username) (\s :: OutputDestinationSettings
s@OutputDestinationSettings' {} Maybe Text
a -> OutputDestinationSettings
s {$sel:username:OutputDestinationSettings' :: Maybe Text
username = Maybe Text
a} :: OutputDestinationSettings)

-- | key used to extract the password from EC2 Parameter store
outputDestinationSettings_passwordParam :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_passwordParam :: (Maybe Text -> f (Maybe Text))
-> OutputDestinationSettings -> f OutputDestinationSettings
outputDestinationSettings_passwordParam = (OutputDestinationSettings -> Maybe Text)
-> (OutputDestinationSettings
    -> Maybe Text -> OutputDestinationSettings)
-> Lens
     OutputDestinationSettings
     OutputDestinationSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestinationSettings' {Maybe Text
passwordParam :: Maybe Text
$sel:passwordParam:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
passwordParam} -> Maybe Text
passwordParam) (\s :: OutputDestinationSettings
s@OutputDestinationSettings' {} Maybe Text
a -> OutputDestinationSettings
s {$sel:passwordParam:OutputDestinationSettings' :: Maybe Text
passwordParam = Maybe Text
a} :: OutputDestinationSettings)

-- | Stream name for RTMP destinations (URLs of type rtmp:\/\/)
outputDestinationSettings_streamName :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_streamName :: (Maybe Text -> f (Maybe Text))
-> OutputDestinationSettings -> f OutputDestinationSettings
outputDestinationSettings_streamName = (OutputDestinationSettings -> Maybe Text)
-> (OutputDestinationSettings
    -> Maybe Text -> OutputDestinationSettings)
-> Lens
     OutputDestinationSettings
     OutputDestinationSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputDestinationSettings' {Maybe Text
streamName :: Maybe Text
$sel:streamName:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
streamName} -> Maybe Text
streamName) (\s :: OutputDestinationSettings
s@OutputDestinationSettings' {} Maybe Text
a -> OutputDestinationSettings
s {$sel:streamName:OutputDestinationSettings' :: Maybe Text
streamName = Maybe Text
a} :: OutputDestinationSettings)

instance Core.FromJSON OutputDestinationSettings where
  parseJSON :: Value -> Parser OutputDestinationSettings
parseJSON =
    String
-> (Object -> Parser OutputDestinationSettings)
-> Value
-> Parser OutputDestinationSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputDestinationSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> OutputDestinationSettings
OutputDestinationSettings'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> OutputDestinationSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> OutputDestinationSettings)
forall (f :: * -> *) a b. Functor 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
"url")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> OutputDestinationSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> OutputDestinationSettings)
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
"username")
            Parser (Maybe Text -> Maybe Text -> OutputDestinationSettings)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> OutputDestinationSettings)
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
"passwordParam")
            Parser (Maybe Text -> OutputDestinationSettings)
-> Parser (Maybe Text) -> Parser OutputDestinationSettings
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
"streamName")
      )

instance Prelude.Hashable OutputDestinationSettings

instance Prelude.NFData OutputDestinationSettings

instance Core.ToJSON OutputDestinationSettings where
  toJSON :: OutputDestinationSettings -> Value
toJSON OutputDestinationSettings' {Maybe Text
streamName :: Maybe Text
passwordParam :: Maybe Text
username :: Maybe Text
url :: Maybe Text
$sel:streamName:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:passwordParam:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:username:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:url:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"url" 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
url,
            (Text
"username" 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
username,
            (Text
"passwordParam" 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
passwordParam,
            (Text
"streamName" 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
streamName
          ]
      )