{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaLive.Types.OutputDestinationSettings where

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

-- | Placeholder documentation for OutputDestinationSettings
--
-- /See:/ 'newOutputDestinationSettings' smart constructor.
data OutputDestinationSettings = OutputDestinationSettings'
  { -- | 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,
    -- | A URL specifying a destination
    OutputDestinationSettings -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | username for destination
    OutputDestinationSettings -> Maybe Text
username :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputDestinationSettings -> OutputDestinationSettings -> Bool
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]
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
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.
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:
--
-- '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:\/\/)
--
-- 'url', 'outputDestinationSettings_url' - A URL specifying a destination
--
-- 'username', 'outputDestinationSettings_username' - username for destination
newOutputDestinationSettings ::
  OutputDestinationSettings
newOutputDestinationSettings :: OutputDestinationSettings
newOutputDestinationSettings =
  OutputDestinationSettings'
    { $sel:passwordParam:OutputDestinationSettings' :: Maybe Text
passwordParam =
        forall a. Maybe a
Prelude.Nothing,
      $sel:streamName:OutputDestinationSettings' :: Maybe Text
streamName = forall a. Maybe a
Prelude.Nothing,
      $sel:url:OutputDestinationSettings' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:username:OutputDestinationSettings' :: Maybe Text
username = forall a. Maybe a
Prelude.Nothing
    }

-- | key used to extract the password from EC2 Parameter store
outputDestinationSettings_passwordParam :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_passwordParam :: Lens' OutputDestinationSettings (Maybe Text)
outputDestinationSettings_passwordParam = 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 :: Lens' OutputDestinationSettings (Maybe Text)
outputDestinationSettings_streamName = 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)

-- | A URL specifying a destination
outputDestinationSettings_url :: Lens.Lens' OutputDestinationSettings (Prelude.Maybe Prelude.Text)
outputDestinationSettings_url :: Lens' OutputDestinationSettings (Maybe Text)
outputDestinationSettings_url = 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 :: Lens' OutputDestinationSettings (Maybe Text)
outputDestinationSettings_username = 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)

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

instance Prelude.Hashable OutputDestinationSettings where
  hashWithSalt :: Int -> OutputDestinationSettings -> Int
hashWithSalt Int
_salt OutputDestinationSettings' {Maybe Text
username :: Maybe Text
url :: Maybe Text
streamName :: Maybe Text
passwordParam :: Maybe Text
$sel:username:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:url:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:streamName:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:passwordParam:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
passwordParam
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
username

instance Prelude.NFData OutputDestinationSettings where
  rnf :: OutputDestinationSettings -> ()
rnf OutputDestinationSettings' {Maybe Text
username :: Maybe Text
url :: Maybe Text
streamName :: Maybe Text
passwordParam :: Maybe Text
$sel:username:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:url:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:streamName:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:passwordParam:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
passwordParam
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
username

instance Data.ToJSON OutputDestinationSettings where
  toJSON :: OutputDestinationSettings -> Value
toJSON OutputDestinationSettings' {Maybe Text
username :: Maybe Text
url :: Maybe Text
streamName :: Maybe Text
passwordParam :: Maybe Text
$sel:username:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:url:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:streamName:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
$sel:passwordParam:OutputDestinationSettings' :: OutputDestinationSettings -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"passwordParam" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
passwordParam,
            (Key
"streamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamName,
            (Key
"url" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url,
            (Key
"username" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
username
          ]
      )