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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 Amazon Resource Name (ARN) assigned to the HarvestJob.
    HarvestJob -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Channel that the HarvestJob will harvest from.
    HarvestJob -> Maybe Text
channelId :: Prelude.Maybe Prelude.Text,
    -- | The time the HarvestJob was submitted
    HarvestJob -> Maybe Text
createdAt :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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,
    HarvestJob -> Maybe S3Destination
s3Destination :: Prelude.Maybe S3Destination,
    -- | The start of the time-window which will be harvested.
    HarvestJob -> Maybe Text
startTime :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (HarvestJob -> HarvestJob -> Bool
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]
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
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. 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:
--
-- 'arn', 'harvestJob_arn' - The Amazon Resource Name (ARN) assigned to the HarvestJob.
--
-- 'channelId', 'harvestJob_channelId' - The ID of the Channel that the HarvestJob will harvest from.
--
-- 'createdAt', 'harvestJob_createdAt' - The time the HarvestJob was submitted
--
-- '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.
--
-- 'originEndpointId', 'harvestJob_originEndpointId' - The ID of the OriginEndpoint that the HarvestJob will harvest from. This
-- cannot be changed after the HarvestJob is submitted.
--
-- 's3Destination', 'harvestJob_s3Destination' - Undocumented member.
--
-- 'startTime', 'harvestJob_startTime' - The start of the time-window which will be harvested.
--
-- '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.
newHarvestJob ::
  HarvestJob
newHarvestJob :: HarvestJob
newHarvestJob =
  HarvestJob'
    { $sel:arn:HarvestJob' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:channelId:HarvestJob' :: Maybe Text
channelId = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:HarvestJob' :: Maybe Text
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:HarvestJob' :: Maybe Text
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:id:HarvestJob' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:originEndpointId:HarvestJob' :: Maybe Text
originEndpointId = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Destination:HarvestJob' :: Maybe S3Destination
s3Destination = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:HarvestJob' :: Maybe Text
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:HarvestJob' :: Maybe Status
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) assigned to the HarvestJob.
harvestJob_arn :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_arn :: Lens' HarvestJob (Maybe Text)
harvestJob_arn = 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 ID of the Channel that the HarvestJob will harvest from.
harvestJob_channelId :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_channelId :: Lens' HarvestJob (Maybe Text)
harvestJob_channelId = 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)

-- | The time the HarvestJob was submitted
harvestJob_createdAt :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_createdAt :: Lens' HarvestJob (Maybe Text)
harvestJob_createdAt = 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 end of the time-window which will be harvested.
harvestJob_endTime :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_endTime :: Lens' HarvestJob (Maybe Text)
harvestJob_endTime = 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 :: Lens' HarvestJob (Maybe Text)
harvestJob_id = 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)

-- | 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 :: Lens' HarvestJob (Maybe Text)
harvestJob_originEndpointId = 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)

-- | Undocumented member.
harvestJob_s3Destination :: Lens.Lens' HarvestJob (Prelude.Maybe S3Destination)
harvestJob_s3Destination :: Lens' HarvestJob (Maybe S3Destination)
harvestJob_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 start of the time-window which will be harvested.
harvestJob_startTime :: Lens.Lens' HarvestJob (Prelude.Maybe Prelude.Text)
harvestJob_startTime :: Lens' HarvestJob (Maybe Text)
harvestJob_startTime = 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 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 :: Lens' HarvestJob (Maybe Status)
harvestJob_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)

instance Data.FromJSON HarvestJob where
  parseJSON :: Value -> Parser HarvestJob
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HarvestJob"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe S3Destination
-> Maybe Text
-> Maybe Status
-> HarvestJob
HarvestJob'
            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
"arn")
            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
"channelId")
            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
"createdAt")
            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
"endTime")
            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
"id")
            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
"originEndpointId")
            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
"s3Destination")
            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
"startTime")
            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
"status")
      )

instance Prelude.Hashable HarvestJob where
  hashWithSalt :: Int -> HarvestJob -> Int
hashWithSalt Int
_salt HarvestJob' {Maybe Text
Maybe S3Destination
Maybe Status
status :: Maybe Status
startTime :: Maybe Text
s3Destination :: Maybe S3Destination
originEndpointId :: Maybe Text
id :: Maybe Text
endTime :: Maybe Text
createdAt :: Maybe Text
channelId :: Maybe Text
arn :: Maybe Text
$sel:status:HarvestJob' :: HarvestJob -> Maybe Status
$sel:startTime:HarvestJob' :: HarvestJob -> Maybe Text
$sel:s3Destination:HarvestJob' :: HarvestJob -> Maybe S3Destination
$sel:originEndpointId:HarvestJob' :: HarvestJob -> Maybe Text
$sel:id:HarvestJob' :: HarvestJob -> Maybe Text
$sel:endTime:HarvestJob' :: HarvestJob -> Maybe Text
$sel:createdAt:HarvestJob' :: HarvestJob -> Maybe Text
$sel:channelId:HarvestJob' :: HarvestJob -> Maybe Text
$sel:arn:HarvestJob' :: HarvestJob -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
originEndpointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Destination
s3Destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Status
status

instance Prelude.NFData HarvestJob where
  rnf :: HarvestJob -> ()
rnf HarvestJob' {Maybe Text
Maybe S3Destination
Maybe Status
status :: Maybe Status
startTime :: Maybe Text
s3Destination :: Maybe S3Destination
originEndpointId :: Maybe Text
id :: Maybe Text
endTime :: Maybe Text
createdAt :: Maybe Text
channelId :: Maybe Text
arn :: Maybe Text
$sel:status:HarvestJob' :: HarvestJob -> Maybe Status
$sel:startTime:HarvestJob' :: HarvestJob -> Maybe Text
$sel:s3Destination:HarvestJob' :: HarvestJob -> Maybe S3Destination
$sel:originEndpointId:HarvestJob' :: HarvestJob -> Maybe Text
$sel:id:HarvestJob' :: HarvestJob -> Maybe Text
$sel:endTime:HarvestJob' :: HarvestJob -> Maybe Text
$sel:createdAt:HarvestJob' :: HarvestJob -> Maybe Text
$sel:channelId:HarvestJob' :: HarvestJob -> Maybe Text
$sel:arn:HarvestJob' :: HarvestJob -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
originEndpointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Destination
s3Destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Status
status