{-# 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.MediaPackage.Types.HarvestJob
-- 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.MediaPackage.Types.HarvestJob where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaPackage.Types.S3Destination
import Amazonka.MediaPackage.Types.Status
import qualified Amazonka.Prelude as Prelude

-- | A HarvestJob resource configuration
--
-- /See:/ 'newHarvestJob' smart constructor.
data HarvestJob = HarvestJob'
  { -- | The current status of the HarvestJob. Consider setting up a CloudWatch
    -- Event to listen for HarvestJobs as they succeed or fail. In the event of
    -- failure, the CloudWatch Event will include an explanation of why the
    -- HarvestJob failed.
    HarvestJob -> Maybe Status
status :: Prelude.Maybe Status,
    -- | The ID of the OriginEndpoint that the HarvestJob will harvest from. This
    -- cannot be changed after the HarvestJob is submitted.
    HarvestJob -> Maybe Text
originEndpointId :: Prelude.Maybe Prelude.Text,
    -- | The start of the time-window which will be harvested.
    HarvestJob -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) assigned to the HarvestJob.
    HarvestJob -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time the HarvestJob was submitted
    HarvestJob -> Maybe Text
createdAt :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Channel that the HarvestJob will harvest from.
    HarvestJob -> Maybe Text
channelId :: Prelude.Maybe Prelude.Text,
    HarvestJob -> Maybe S3Destination
s3Destination :: Prelude.Maybe S3Destination,
    -- | The end of the time-window which will be harvested.
    HarvestJob -> Maybe Text
endTime :: Prelude.Maybe Prelude.Text,
    -- | The ID of the HarvestJob. The ID must be unique within the region and it
    -- cannot be changed after the HarvestJob is submitted.
    HarvestJob -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (HarvestJob -> HarvestJob -> Bool
(HarvestJob -> HarvestJob -> Bool)
-> (HarvestJob -> HarvestJob -> Bool) -> Eq HarvestJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HarvestJob -> HarvestJob -> Bool
$c/= :: HarvestJob -> HarvestJob -> Bool
== :: HarvestJob -> HarvestJob -> Bool
$c== :: HarvestJob -> HarvestJob -> Bool
Prelude.Eq, ReadPrec [HarvestJob]
ReadPrec HarvestJob
Int -> ReadS HarvestJob
ReadS [HarvestJob]
(Int -> ReadS HarvestJob)
-> ReadS [HarvestJob]
-> ReadPrec HarvestJob
-> ReadPrec [HarvestJob]
-> Read HarvestJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HarvestJob]
$creadListPrec :: ReadPrec [HarvestJob]
readPrec :: ReadPrec HarvestJob
$creadPrec :: ReadPrec HarvestJob
readList :: ReadS [HarvestJob]
$creadList :: ReadS [HarvestJob]
readsPrec :: Int -> ReadS HarvestJob
$creadsPrec :: Int -> ReadS HarvestJob
Prelude.Read, Int -> HarvestJob -> ShowS
[HarvestJob] -> ShowS
HarvestJob -> String
(Int -> HarvestJob -> ShowS)
-> (HarvestJob -> String)
-> ([HarvestJob] -> ShowS)
-> Show HarvestJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HarvestJob] -> ShowS
$cshowList :: [HarvestJob] -> ShowS
show :: HarvestJob -> String
$cshow :: HarvestJob -> String
showsPrec :: Int -> HarvestJob -> ShowS
$cshowsPrec :: Int -> HarvestJob -> ShowS
Prelude.Show, (forall x. HarvestJob -> Rep HarvestJob x)
-> (forall x. Rep HarvestJob x -> HarvestJob) -> Generic HarvestJob
forall x. Rep HarvestJob x -> HarvestJob
forall x. HarvestJob -> Rep HarvestJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HarvestJob x -> HarvestJob
$cfrom :: forall x. HarvestJob -> Rep HarvestJob x
Prelude.Generic)

-- |
-- Create a value of 'HarvestJob' 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:
--
-- 'status', 'harvestJob_status' - The current status of the HarvestJob. Consider setting up a CloudWatch
-- Event to listen for HarvestJobs as they succeed or fail. In the event of
-- failure, the CloudWatch Event will include an explanation of why the
-- HarvestJob failed.
--
-- 'originEndpointId', 'harvestJob_originEndpointId' - The ID of the OriginEndpoint that the HarvestJob will harvest from. This
-- cannot be changed after the HarvestJob is submitted.
--
-- 'startTime', 'harvestJob_startTime' - The start of the time-window which will be harvested.
--
-- 'arn', 'harvestJob_arn' - The Amazon Resource Name (ARN) assigned to the HarvestJob.
--
-- 'createdAt', 'harvestJob_createdAt' - The time the HarvestJob was submitted
--
-- 'channelId', 'harvestJob_channelId' - The ID of the Channel that the HarvestJob will harvest from.
--
-- 's3Destination', 'harvestJob_s3Destination' - Undocumented member.
--
-- 'endTime', 'harvestJob_endTime' - The end of the time-window which will be harvested.
--
-- 'id', 'harvestJob_id' - The ID of the HarvestJob. The ID must be unique within the region and it
-- cannot be changed after the HarvestJob is submitted.
newHarvestJob ::
  HarvestJob
newHarvestJob :: HarvestJob
newHarvestJob =
  HarvestJob' :: Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe S3Destination
-> Maybe Text
-> Maybe Text
-> HarvestJob
HarvestJob'
    { $sel:status:HarvestJob' :: Maybe Status
status = Maybe Status
forall a. Maybe a
Prelude.Nothing,
      $sel:originEndpointId:HarvestJob' :: Maybe Text
originEndpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:HarvestJob' :: Maybe Text
startTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:HarvestJob' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:HarvestJob' :: Maybe Text
createdAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelId:HarvestJob' :: Maybe Text
channelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Destination:HarvestJob' :: Maybe S3Destination
s3Destination = Maybe S3Destination
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:HarvestJob' :: Maybe Text
endTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:HarvestJob' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current status of the HarvestJob. Consider setting up a CloudWatch
-- Event to listen for HarvestJobs as they succeed or fail. In the event of
-- failure, the CloudWatch Event will include an explanation of why the
-- HarvestJob failed.
harvestJob_status :: Lens.Lens' HarvestJob (Prelude.Maybe Status)
harvestJob_status :: (Maybe Status -> f (Maybe Status)) -> HarvestJob -> f HarvestJob
harvestJob_status = (HarvestJob -> Maybe Status)
-> (HarvestJob -> Maybe Status -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Status) (Maybe Status)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Status
status :: Maybe Status
$sel:status:HarvestJob' :: HarvestJob -> Maybe Status
status} -> Maybe Status
status) (\s :: HarvestJob
s@HarvestJob' {} Maybe Status
a -> HarvestJob
s {$sel:status:HarvestJob' :: Maybe Status
status = Maybe Status
a} :: HarvestJob)

-- | The ID of the OriginEndpoint that the HarvestJob will harvest from. This
-- cannot be changed after the HarvestJob is submitted.
harvestJob_originEndpointId :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_originEndpointId :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_originEndpointId = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
originEndpointId :: Maybe Text
$sel:originEndpointId:HarvestJob' :: HarvestJob -> Maybe Text
originEndpointId} -> Maybe Text
originEndpointId) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:originEndpointId:HarvestJob' :: Maybe Text
originEndpointId = Maybe Text
a} :: HarvestJob)

-- | The start of the time-window which will be harvested.
harvestJob_startTime :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_startTime :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_startTime = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
startTime :: Maybe Text
$sel:startTime:HarvestJob' :: HarvestJob -> Maybe Text
startTime} -> Maybe Text
startTime) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:startTime:HarvestJob' :: Maybe Text
startTime = Maybe Text
a} :: HarvestJob)

-- | The Amazon Resource Name (ARN) assigned to the HarvestJob.
harvestJob_arn :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_arn :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_arn = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
arn :: Maybe Text
$sel:arn:HarvestJob' :: HarvestJob -> Maybe Text
arn} -> Maybe Text
arn) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:arn:HarvestJob' :: Maybe Text
arn = Maybe Text
a} :: HarvestJob)

-- | The time the HarvestJob was submitted
harvestJob_createdAt :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_createdAt :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_createdAt = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
createdAt :: Maybe Text
$sel:createdAt:HarvestJob' :: HarvestJob -> Maybe Text
createdAt} -> Maybe Text
createdAt) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:createdAt:HarvestJob' :: Maybe Text
createdAt = Maybe Text
a} :: HarvestJob)

-- | The ID of the Channel that the HarvestJob will harvest from.
harvestJob_channelId :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_channelId :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_channelId = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
channelId :: Maybe Text
$sel:channelId:HarvestJob' :: HarvestJob -> Maybe Text
channelId} -> Maybe Text
channelId) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:channelId:HarvestJob' :: Maybe Text
channelId = Maybe Text
a} :: HarvestJob)

-- | Undocumented member.
harvestJob_s3Destination :: Lens.Lens' HarvestJob (Prelude.Maybe S3Destination)
harvestJob_s3Destination :: (Maybe S3Destination -> f (Maybe S3Destination))
-> HarvestJob -> f HarvestJob
harvestJob_s3Destination = (HarvestJob -> Maybe S3Destination)
-> (HarvestJob -> Maybe S3Destination -> HarvestJob)
-> Lens
     HarvestJob HarvestJob (Maybe S3Destination) (Maybe S3Destination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe S3Destination
s3Destination :: Maybe S3Destination
$sel:s3Destination:HarvestJob' :: HarvestJob -> Maybe S3Destination
s3Destination} -> Maybe S3Destination
s3Destination) (\s :: HarvestJob
s@HarvestJob' {} Maybe S3Destination
a -> HarvestJob
s {$sel:s3Destination:HarvestJob' :: Maybe S3Destination
s3Destination = Maybe S3Destination
a} :: HarvestJob)

-- | The end of the time-window which will be harvested.
harvestJob_endTime :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_endTime :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_endTime = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
endTime :: Maybe Text
$sel:endTime:HarvestJob' :: HarvestJob -> Maybe Text
endTime} -> Maybe Text
endTime) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:endTime:HarvestJob' :: Maybe Text
endTime = Maybe Text
a} :: HarvestJob)

-- | The ID of the HarvestJob. The ID must be unique within the region and it
-- cannot be changed after the HarvestJob is submitted.
harvestJob_id :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_id :: (Maybe Text -> f (Maybe Text)) -> HarvestJob -> f HarvestJob
harvestJob_id = (HarvestJob -> Maybe Text)
-> (HarvestJob -> Maybe Text -> HarvestJob)
-> Lens HarvestJob HarvestJob (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HarvestJob' {Maybe Text
id :: Maybe Text
$sel:id:HarvestJob' :: HarvestJob -> Maybe Text
id} -> Maybe Text
id) (\s :: HarvestJob
s@HarvestJob' {} Maybe Text
a -> HarvestJob
s {$sel:id:HarvestJob' :: Maybe Text
id = Maybe Text
a} :: HarvestJob)

instance Core.FromJSON HarvestJob where
  parseJSON :: Value -> Parser HarvestJob
parseJSON =
    String
-> (Object -> Parser HarvestJob) -> Value -> Parser HarvestJob
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HarvestJob"
      ( \Object
x ->
          Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe S3Destination
-> Maybe Text
-> Maybe Text
-> HarvestJob
HarvestJob'
            (Maybe Status
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe S3Destination
 -> Maybe Text
 -> Maybe Text
 -> HarvestJob)
-> Parser (Maybe Status)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe S3Destination
      -> Maybe Text
      -> Maybe Text
      -> HarvestJob)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe S3Destination
   -> Maybe Text
   -> Maybe Text
   -> HarvestJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe S3Destination
      -> Maybe Text
      -> Maybe Text
      -> HarvestJob)
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
"originEndpointId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe S3Destination
   -> Maybe Text
   -> Maybe Text
   -> HarvestJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe S3Destination
      -> Maybe Text
      -> Maybe Text
      -> HarvestJob)
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
"startTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe S3Destination
   -> Maybe Text
   -> Maybe Text
   -> HarvestJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe S3Destination
      -> Maybe Text
      -> Maybe Text
      -> HarvestJob)
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
"arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe S3Destination
   -> Maybe Text
   -> Maybe Text
   -> HarvestJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe S3Destination -> Maybe Text -> Maybe Text -> HarvestJob)
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
"createdAt")
            Parser
  (Maybe Text
   -> Maybe S3Destination -> Maybe Text -> Maybe Text -> HarvestJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe S3Destination -> Maybe Text -> Maybe Text -> HarvestJob)
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
"channelId")
            Parser
  (Maybe S3Destination -> Maybe Text -> Maybe Text -> HarvestJob)
-> Parser (Maybe S3Destination)
-> Parser (Maybe Text -> Maybe Text -> HarvestJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3Destination)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3Destination")
            Parser (Maybe Text -> Maybe Text -> HarvestJob)
-> Parser (Maybe Text) -> Parser (Maybe Text -> HarvestJob)
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
"endTime")
            Parser (Maybe Text -> HarvestJob)
-> Parser (Maybe Text) -> Parser HarvestJob
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")
      )

instance Prelude.Hashable HarvestJob

instance Prelude.NFData HarvestJob