{-# 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.ComputeOptimizer.Types.RecommendationExportJob
-- 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.ComputeOptimizer.Types.RecommendationExportJob where

import Amazonka.ComputeOptimizer.Types.ExportDestination
import Amazonka.ComputeOptimizer.Types.JobStatus
import Amazonka.ComputeOptimizer.Types.ResourceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a recommendation export job.
--
-- Use the DescribeRecommendationExportJobs action to view your
-- recommendation export jobs.
--
-- Use the ExportAutoScalingGroupRecommendations or
-- ExportEC2InstanceRecommendations actions to request an export of your
-- recommendations.
--
-- /See:/ 'newRecommendationExportJob' smart constructor.
data RecommendationExportJob = RecommendationExportJob'
  { -- | The reason for an export job failure.
    RecommendationExportJob -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | An object that describes the destination of the export file.
    RecommendationExportJob -> Maybe ExportDestination
destination :: Prelude.Maybe ExportDestination,
    -- | The status of the export job.
    RecommendationExportJob -> Maybe JobStatus
status :: Prelude.Maybe JobStatus,
    -- | The identification number of the export job.
    RecommendationExportJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The resource type of the exported recommendations.
    RecommendationExportJob -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The timestamp of when the export job was created.
    RecommendationExportJob -> Maybe POSIX
creationTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The timestamp of when the export job was last updated.
    RecommendationExportJob -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (RecommendationExportJob -> RecommendationExportJob -> Bool
(RecommendationExportJob -> RecommendationExportJob -> Bool)
-> (RecommendationExportJob -> RecommendationExportJob -> Bool)
-> Eq RecommendationExportJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RecommendationExportJob -> RecommendationExportJob -> Bool
$c/= :: RecommendationExportJob -> RecommendationExportJob -> Bool
== :: RecommendationExportJob -> RecommendationExportJob -> Bool
$c== :: RecommendationExportJob -> RecommendationExportJob -> Bool
Prelude.Eq, ReadPrec [RecommendationExportJob]
ReadPrec RecommendationExportJob
Int -> ReadS RecommendationExportJob
ReadS [RecommendationExportJob]
(Int -> ReadS RecommendationExportJob)
-> ReadS [RecommendationExportJob]
-> ReadPrec RecommendationExportJob
-> ReadPrec [RecommendationExportJob]
-> Read RecommendationExportJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RecommendationExportJob]
$creadListPrec :: ReadPrec [RecommendationExportJob]
readPrec :: ReadPrec RecommendationExportJob
$creadPrec :: ReadPrec RecommendationExportJob
readList :: ReadS [RecommendationExportJob]
$creadList :: ReadS [RecommendationExportJob]
readsPrec :: Int -> ReadS RecommendationExportJob
$creadsPrec :: Int -> ReadS RecommendationExportJob
Prelude.Read, Int -> RecommendationExportJob -> ShowS
[RecommendationExportJob] -> ShowS
RecommendationExportJob -> String
(Int -> RecommendationExportJob -> ShowS)
-> (RecommendationExportJob -> String)
-> ([RecommendationExportJob] -> ShowS)
-> Show RecommendationExportJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RecommendationExportJob] -> ShowS
$cshowList :: [RecommendationExportJob] -> ShowS
show :: RecommendationExportJob -> String
$cshow :: RecommendationExportJob -> String
showsPrec :: Int -> RecommendationExportJob -> ShowS
$cshowsPrec :: Int -> RecommendationExportJob -> ShowS
Prelude.Show, (forall x.
 RecommendationExportJob -> Rep RecommendationExportJob x)
-> (forall x.
    Rep RecommendationExportJob x -> RecommendationExportJob)
-> Generic RecommendationExportJob
forall x. Rep RecommendationExportJob x -> RecommendationExportJob
forall x. RecommendationExportJob -> Rep RecommendationExportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RecommendationExportJob x -> RecommendationExportJob
$cfrom :: forall x. RecommendationExportJob -> Rep RecommendationExportJob x
Prelude.Generic)

-- |
-- Create a value of 'RecommendationExportJob' 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:
--
-- 'failureReason', 'recommendationExportJob_failureReason' - The reason for an export job failure.
--
-- 'destination', 'recommendationExportJob_destination' - An object that describes the destination of the export file.
--
-- 'status', 'recommendationExportJob_status' - The status of the export job.
--
-- 'jobId', 'recommendationExportJob_jobId' - The identification number of the export job.
--
-- 'resourceType', 'recommendationExportJob_resourceType' - The resource type of the exported recommendations.
--
-- 'creationTimestamp', 'recommendationExportJob_creationTimestamp' - The timestamp of when the export job was created.
--
-- 'lastUpdatedTimestamp', 'recommendationExportJob_lastUpdatedTimestamp' - The timestamp of when the export job was last updated.
newRecommendationExportJob ::
  RecommendationExportJob
newRecommendationExportJob :: RecommendationExportJob
newRecommendationExportJob =
  RecommendationExportJob' :: Maybe Text
-> Maybe ExportDestination
-> Maybe JobStatus
-> Maybe Text
-> Maybe ResourceType
-> Maybe POSIX
-> Maybe POSIX
-> RecommendationExportJob
RecommendationExportJob'
    { $sel:failureReason:RecommendationExportJob' :: Maybe Text
failureReason =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destination:RecommendationExportJob' :: Maybe ExportDestination
destination = Maybe ExportDestination
forall a. Maybe a
Prelude.Nothing,
      $sel:status:RecommendationExportJob' :: Maybe JobStatus
status = Maybe JobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:RecommendationExportJob' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:RecommendationExportJob' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:RecommendationExportJob' :: Maybe POSIX
creationTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:RecommendationExportJob' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The reason for an export job failure.
recommendationExportJob_failureReason :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.Text)
recommendationExportJob_failureReason :: (Maybe Text -> f (Maybe Text))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_failureReason = (RecommendationExportJob -> Maybe Text)
-> (RecommendationExportJob
    -> Maybe Text -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe Text
a -> RecommendationExportJob
s {$sel:failureReason:RecommendationExportJob' :: Maybe Text
failureReason = Maybe Text
a} :: RecommendationExportJob)

-- | An object that describes the destination of the export file.
recommendationExportJob_destination :: Lens.Lens' RecommendationExportJob (Prelude.Maybe ExportDestination)
recommendationExportJob_destination :: (Maybe ExportDestination -> f (Maybe ExportDestination))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_destination = (RecommendationExportJob -> Maybe ExportDestination)
-> (RecommendationExportJob
    -> Maybe ExportDestination -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe ExportDestination)
     (Maybe ExportDestination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe ExportDestination
destination :: Maybe ExportDestination
$sel:destination:RecommendationExportJob' :: RecommendationExportJob -> Maybe ExportDestination
destination} -> Maybe ExportDestination
destination) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe ExportDestination
a -> RecommendationExportJob
s {$sel:destination:RecommendationExportJob' :: Maybe ExportDestination
destination = Maybe ExportDestination
a} :: RecommendationExportJob)

-- | The status of the export job.
recommendationExportJob_status :: Lens.Lens' RecommendationExportJob (Prelude.Maybe JobStatus)
recommendationExportJob_status :: (Maybe JobStatus -> f (Maybe JobStatus))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_status = (RecommendationExportJob -> Maybe JobStatus)
-> (RecommendationExportJob
    -> Maybe JobStatus -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe JobStatus)
     (Maybe JobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe JobStatus
status :: Maybe JobStatus
$sel:status:RecommendationExportJob' :: RecommendationExportJob -> Maybe JobStatus
status} -> Maybe JobStatus
status) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe JobStatus
a -> RecommendationExportJob
s {$sel:status:RecommendationExportJob' :: Maybe JobStatus
status = Maybe JobStatus
a} :: RecommendationExportJob)

-- | The identification number of the export job.
recommendationExportJob_jobId :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.Text)
recommendationExportJob_jobId :: (Maybe Text -> f (Maybe Text))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_jobId = (RecommendationExportJob -> Maybe Text)
-> (RecommendationExportJob
    -> Maybe Text -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe Text
jobId :: Maybe Text
$sel:jobId:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe Text
a -> RecommendationExportJob
s {$sel:jobId:RecommendationExportJob' :: Maybe Text
jobId = Maybe Text
a} :: RecommendationExportJob)

-- | The resource type of the exported recommendations.
recommendationExportJob_resourceType :: Lens.Lens' RecommendationExportJob (Prelude.Maybe ResourceType)
recommendationExportJob_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_resourceType = (RecommendationExportJob -> Maybe ResourceType)
-> (RecommendationExportJob
    -> Maybe ResourceType -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe ResourceType)
     (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:RecommendationExportJob' :: RecommendationExportJob -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe ResourceType
a -> RecommendationExportJob
s {$sel:resourceType:RecommendationExportJob' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: RecommendationExportJob)

-- | The timestamp of when the export job was created.
recommendationExportJob_creationTimestamp :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.UTCTime)
recommendationExportJob_creationTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_creationTimestamp = (RecommendationExportJob -> Maybe POSIX)
-> (RecommendationExportJob
    -> Maybe POSIX -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:creationTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
creationTimestamp} -> Maybe POSIX
creationTimestamp) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe POSIX
a -> RecommendationExportJob
s {$sel:creationTimestamp:RecommendationExportJob' :: Maybe POSIX
creationTimestamp = Maybe POSIX
a} :: RecommendationExportJob) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecommendationExportJob -> f RecommendationExportJob)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationExportJob
-> f RecommendationExportJob
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

-- | The timestamp of when the export job was last updated.
recommendationExportJob_lastUpdatedTimestamp :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.UTCTime)
recommendationExportJob_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationExportJob -> f RecommendationExportJob
recommendationExportJob_lastUpdatedTimestamp = (RecommendationExportJob -> Maybe POSIX)
-> (RecommendationExportJob
    -> Maybe POSIX -> RecommendationExportJob)
-> Lens
     RecommendationExportJob
     RecommendationExportJob
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RecommendationExportJob' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: RecommendationExportJob
s@RecommendationExportJob' {} Maybe POSIX
a -> RecommendationExportJob
s {$sel:lastUpdatedTimestamp:RecommendationExportJob' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: RecommendationExportJob) ((Maybe POSIX -> f (Maybe POSIX))
 -> RecommendationExportJob -> f RecommendationExportJob)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RecommendationExportJob
-> f RecommendationExportJob
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 RecommendationExportJob where
  parseJSON :: Value -> Parser RecommendationExportJob
parseJSON =
    String
-> (Object -> Parser RecommendationExportJob)
-> Value
-> Parser RecommendationExportJob
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RecommendationExportJob"
      ( \Object
x ->
          Maybe Text
-> Maybe ExportDestination
-> Maybe JobStatus
-> Maybe Text
-> Maybe ResourceType
-> Maybe POSIX
-> Maybe POSIX
-> RecommendationExportJob
RecommendationExportJob'
            (Maybe Text
 -> Maybe ExportDestination
 -> Maybe JobStatus
 -> Maybe Text
 -> Maybe ResourceType
 -> Maybe POSIX
 -> Maybe POSIX
 -> RecommendationExportJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe ExportDestination
      -> Maybe JobStatus
      -> Maybe Text
      -> Maybe ResourceType
      -> Maybe POSIX
      -> Maybe POSIX
      -> RecommendationExportJob)
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
"failureReason")
            Parser
  (Maybe ExportDestination
   -> Maybe JobStatus
   -> Maybe Text
   -> Maybe ResourceType
   -> Maybe POSIX
   -> Maybe POSIX
   -> RecommendationExportJob)
-> Parser (Maybe ExportDestination)
-> Parser
     (Maybe JobStatus
      -> Maybe Text
      -> Maybe ResourceType
      -> Maybe POSIX
      -> Maybe POSIX
      -> RecommendationExportJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ExportDestination)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destination")
            Parser
  (Maybe JobStatus
   -> Maybe Text
   -> Maybe ResourceType
   -> Maybe POSIX
   -> Maybe POSIX
   -> RecommendationExportJob)
-> Parser (Maybe JobStatus)
-> Parser
     (Maybe Text
      -> Maybe ResourceType
      -> Maybe POSIX
      -> Maybe POSIX
      -> RecommendationExportJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe ResourceType
   -> Maybe POSIX
   -> Maybe POSIX
   -> RecommendationExportJob)
-> Parser (Maybe Text)
-> Parser
     (Maybe ResourceType
      -> Maybe POSIX -> Maybe POSIX -> RecommendationExportJob)
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
"jobId")
            Parser
  (Maybe ResourceType
   -> Maybe POSIX -> Maybe POSIX -> RecommendationExportJob)
-> Parser (Maybe ResourceType)
-> Parser (Maybe POSIX -> Maybe POSIX -> RecommendationExportJob)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
            Parser (Maybe POSIX -> Maybe POSIX -> RecommendationExportJob)
-> Parser (Maybe POSIX)
-> Parser (Maybe POSIX -> RecommendationExportJob)
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
"creationTimestamp")
            Parser (Maybe POSIX -> RecommendationExportJob)
-> Parser (Maybe POSIX) -> Parser RecommendationExportJob
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
"lastUpdatedTimestamp")
      )

instance Prelude.Hashable RecommendationExportJob

instance Prelude.NFData RecommendationExportJob