{-# 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.MediaConvert.Types.QueueTransition
-- 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.MediaConvert.Types.QueueTransition where

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

-- | Description of the source and destination queues between which the job
-- has moved, along with the timestamp of the move
--
-- /See:/ 'newQueueTransition' smart constructor.
data QueueTransition = QueueTransition'
  { -- | The queue that the job was on before the transition.
    QueueTransition -> Maybe Text
sourceQueue :: Prelude.Maybe Prelude.Text,
    -- | The queue that the job was on after the transition.
    QueueTransition -> Maybe Text
destinationQueue :: Prelude.Maybe Prelude.Text,
    -- | The time, in Unix epoch format, that the job moved from the source queue
    -- to the destination queue.
    QueueTransition -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (QueueTransition -> QueueTransition -> Bool
(QueueTransition -> QueueTransition -> Bool)
-> (QueueTransition -> QueueTransition -> Bool)
-> Eq QueueTransition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueueTransition -> QueueTransition -> Bool
$c/= :: QueueTransition -> QueueTransition -> Bool
== :: QueueTransition -> QueueTransition -> Bool
$c== :: QueueTransition -> QueueTransition -> Bool
Prelude.Eq, ReadPrec [QueueTransition]
ReadPrec QueueTransition
Int -> ReadS QueueTransition
ReadS [QueueTransition]
(Int -> ReadS QueueTransition)
-> ReadS [QueueTransition]
-> ReadPrec QueueTransition
-> ReadPrec [QueueTransition]
-> Read QueueTransition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueueTransition]
$creadListPrec :: ReadPrec [QueueTransition]
readPrec :: ReadPrec QueueTransition
$creadPrec :: ReadPrec QueueTransition
readList :: ReadS [QueueTransition]
$creadList :: ReadS [QueueTransition]
readsPrec :: Int -> ReadS QueueTransition
$creadsPrec :: Int -> ReadS QueueTransition
Prelude.Read, Int -> QueueTransition -> ShowS
[QueueTransition] -> ShowS
QueueTransition -> String
(Int -> QueueTransition -> ShowS)
-> (QueueTransition -> String)
-> ([QueueTransition] -> ShowS)
-> Show QueueTransition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueueTransition] -> ShowS
$cshowList :: [QueueTransition] -> ShowS
show :: QueueTransition -> String
$cshow :: QueueTransition -> String
showsPrec :: Int -> QueueTransition -> ShowS
$cshowsPrec :: Int -> QueueTransition -> ShowS
Prelude.Show, (forall x. QueueTransition -> Rep QueueTransition x)
-> (forall x. Rep QueueTransition x -> QueueTransition)
-> Generic QueueTransition
forall x. Rep QueueTransition x -> QueueTransition
forall x. QueueTransition -> Rep QueueTransition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueueTransition x -> QueueTransition
$cfrom :: forall x. QueueTransition -> Rep QueueTransition x
Prelude.Generic)

-- |
-- Create a value of 'QueueTransition' 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:
--
-- 'sourceQueue', 'queueTransition_sourceQueue' - The queue that the job was on before the transition.
--
-- 'destinationQueue', 'queueTransition_destinationQueue' - The queue that the job was on after the transition.
--
-- 'timestamp', 'queueTransition_timestamp' - The time, in Unix epoch format, that the job moved from the source queue
-- to the destination queue.
newQueueTransition ::
  QueueTransition
newQueueTransition :: QueueTransition
newQueueTransition =
  QueueTransition' :: Maybe Text -> Maybe Text -> Maybe POSIX -> QueueTransition
QueueTransition'
    { $sel:sourceQueue:QueueTransition' :: Maybe Text
sourceQueue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationQueue:QueueTransition' :: Maybe Text
destinationQueue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timestamp:QueueTransition' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The queue that the job was on before the transition.
queueTransition_sourceQueue :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.Text)
queueTransition_sourceQueue :: (Maybe Text -> f (Maybe Text))
-> QueueTransition -> f QueueTransition
queueTransition_sourceQueue = (QueueTransition -> Maybe Text)
-> (QueueTransition -> Maybe Text -> QueueTransition)
-> Lens QueueTransition QueueTransition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe Text
sourceQueue :: Maybe Text
$sel:sourceQueue:QueueTransition' :: QueueTransition -> Maybe Text
sourceQueue} -> Maybe Text
sourceQueue) (\s :: QueueTransition
s@QueueTransition' {} Maybe Text
a -> QueueTransition
s {$sel:sourceQueue:QueueTransition' :: Maybe Text
sourceQueue = Maybe Text
a} :: QueueTransition)

-- | The queue that the job was on after the transition.
queueTransition_destinationQueue :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.Text)
queueTransition_destinationQueue :: (Maybe Text -> f (Maybe Text))
-> QueueTransition -> f QueueTransition
queueTransition_destinationQueue = (QueueTransition -> Maybe Text)
-> (QueueTransition -> Maybe Text -> QueueTransition)
-> Lens QueueTransition QueueTransition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe Text
destinationQueue :: Maybe Text
$sel:destinationQueue:QueueTransition' :: QueueTransition -> Maybe Text
destinationQueue} -> Maybe Text
destinationQueue) (\s :: QueueTransition
s@QueueTransition' {} Maybe Text
a -> QueueTransition
s {$sel:destinationQueue:QueueTransition' :: Maybe Text
destinationQueue = Maybe Text
a} :: QueueTransition)

-- | The time, in Unix epoch format, that the job moved from the source queue
-- to the destination queue.
queueTransition_timestamp :: Lens.Lens' QueueTransition (Prelude.Maybe Prelude.UTCTime)
queueTransition_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> QueueTransition -> f QueueTransition
queueTransition_timestamp = (QueueTransition -> Maybe POSIX)
-> (QueueTransition -> Maybe POSIX -> QueueTransition)
-> Lens QueueTransition QueueTransition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueueTransition' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:QueueTransition' :: QueueTransition -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: QueueTransition
s@QueueTransition' {} Maybe POSIX
a -> QueueTransition
s {$sel:timestamp:QueueTransition' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: QueueTransition) ((Maybe POSIX -> f (Maybe POSIX))
 -> QueueTransition -> f QueueTransition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> QueueTransition
-> f QueueTransition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON QueueTransition where
  parseJSON :: Value -> Parser QueueTransition
parseJSON =
    String
-> (Object -> Parser QueueTransition)
-> Value
-> Parser QueueTransition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"QueueTransition"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe POSIX -> QueueTransition
QueueTransition'
            (Maybe Text -> Maybe Text -> Maybe POSIX -> QueueTransition)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> QueueTransition)
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
"sourceQueue")
            Parser (Maybe Text -> Maybe POSIX -> QueueTransition)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> QueueTransition)
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
"destinationQueue")
            Parser (Maybe POSIX -> QueueTransition)
-> Parser (Maybe POSIX) -> Parser QueueTransition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timestamp")
      )

instance Prelude.Hashable QueueTransition

instance Prelude.NFData QueueTransition