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

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

-- | Reference to an OutputDestination ID defined in the channel
--
-- /See:/ 'newOutputLocationRef' smart constructor.
data OutputLocationRef = OutputLocationRef'
  { OutputLocationRef -> Maybe Text
destinationRefId :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputLocationRef -> OutputLocationRef -> Bool
(OutputLocationRef -> OutputLocationRef -> Bool)
-> (OutputLocationRef -> OutputLocationRef -> Bool)
-> Eq OutputLocationRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputLocationRef -> OutputLocationRef -> Bool
$c/= :: OutputLocationRef -> OutputLocationRef -> Bool
== :: OutputLocationRef -> OutputLocationRef -> Bool
$c== :: OutputLocationRef -> OutputLocationRef -> Bool
Prelude.Eq, ReadPrec [OutputLocationRef]
ReadPrec OutputLocationRef
Int -> ReadS OutputLocationRef
ReadS [OutputLocationRef]
(Int -> ReadS OutputLocationRef)
-> ReadS [OutputLocationRef]
-> ReadPrec OutputLocationRef
-> ReadPrec [OutputLocationRef]
-> Read OutputLocationRef
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputLocationRef]
$creadListPrec :: ReadPrec [OutputLocationRef]
readPrec :: ReadPrec OutputLocationRef
$creadPrec :: ReadPrec OutputLocationRef
readList :: ReadS [OutputLocationRef]
$creadList :: ReadS [OutputLocationRef]
readsPrec :: Int -> ReadS OutputLocationRef
$creadsPrec :: Int -> ReadS OutputLocationRef
Prelude.Read, Int -> OutputLocationRef -> ShowS
[OutputLocationRef] -> ShowS
OutputLocationRef -> String
(Int -> OutputLocationRef -> ShowS)
-> (OutputLocationRef -> String)
-> ([OutputLocationRef] -> ShowS)
-> Show OutputLocationRef
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputLocationRef] -> ShowS
$cshowList :: [OutputLocationRef] -> ShowS
show :: OutputLocationRef -> String
$cshow :: OutputLocationRef -> String
showsPrec :: Int -> OutputLocationRef -> ShowS
$cshowsPrec :: Int -> OutputLocationRef -> ShowS
Prelude.Show, (forall x. OutputLocationRef -> Rep OutputLocationRef x)
-> (forall x. Rep OutputLocationRef x -> OutputLocationRef)
-> Generic OutputLocationRef
forall x. Rep OutputLocationRef x -> OutputLocationRef
forall x. OutputLocationRef -> Rep OutputLocationRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputLocationRef x -> OutputLocationRef
$cfrom :: forall x. OutputLocationRef -> Rep OutputLocationRef x
Prelude.Generic)

-- |
-- Create a value of 'OutputLocationRef' 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:
--
-- 'destinationRefId', 'outputLocationRef_destinationRefId' - Undocumented member.
newOutputLocationRef ::
  OutputLocationRef
newOutputLocationRef :: OutputLocationRef
newOutputLocationRef =
  OutputLocationRef' :: Maybe Text -> OutputLocationRef
OutputLocationRef'
    { $sel:destinationRefId:OutputLocationRef' :: Maybe Text
destinationRefId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
outputLocationRef_destinationRefId :: Lens.Lens' OutputLocationRef (Prelude.Maybe Prelude.Text)
outputLocationRef_destinationRefId :: (Maybe Text -> f (Maybe Text))
-> OutputLocationRef -> f OutputLocationRef
outputLocationRef_destinationRefId = (OutputLocationRef -> Maybe Text)
-> (OutputLocationRef -> Maybe Text -> OutputLocationRef)
-> Lens
     OutputLocationRef OutputLocationRef (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputLocationRef' {Maybe Text
destinationRefId :: Maybe Text
$sel:destinationRefId:OutputLocationRef' :: OutputLocationRef -> Maybe Text
destinationRefId} -> Maybe Text
destinationRefId) (\s :: OutputLocationRef
s@OutputLocationRef' {} Maybe Text
a -> OutputLocationRef
s {$sel:destinationRefId:OutputLocationRef' :: Maybe Text
destinationRefId = Maybe Text
a} :: OutputLocationRef)

instance Core.FromJSON OutputLocationRef where
  parseJSON :: Value -> Parser OutputLocationRef
parseJSON =
    String
-> (Object -> Parser OutputLocationRef)
-> Value
-> Parser OutputLocationRef
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputLocationRef"
      ( \Object
x ->
          Maybe Text -> OutputLocationRef
OutputLocationRef'
            (Maybe Text -> OutputLocationRef)
-> Parser (Maybe Text) -> Parser OutputLocationRef
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
"destinationRefId")
      )

instance Prelude.Hashable OutputLocationRef

instance Prelude.NFData OutputLocationRef

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