{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 timestamp of when the export job was created.
    RecommendationExportJob -> Maybe POSIX
creationTimestamp :: Prelude.Maybe Data.POSIX,
    -- | An object that describes the destination of the export file.
    RecommendationExportJob -> Maybe ExportDestination
destination :: Prelude.Maybe ExportDestination,
    -- | The reason for an export job failure.
    RecommendationExportJob -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The identification number of the export job.
    RecommendationExportJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when the export job was last updated.
    RecommendationExportJob -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The resource type of the exported recommendations.
    RecommendationExportJob -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | The status of the export job.
    RecommendationExportJob -> Maybe JobStatus
status :: Prelude.Maybe JobStatus
  }
  deriving (RecommendationExportJob -> RecommendationExportJob -> Bool
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]
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
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. 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:
--
-- 'creationTimestamp', 'recommendationExportJob_creationTimestamp' - The timestamp of when the export job was created.
--
-- 'destination', 'recommendationExportJob_destination' - An object that describes the destination of the export file.
--
-- 'failureReason', 'recommendationExportJob_failureReason' - The reason for an export job failure.
--
-- 'jobId', 'recommendationExportJob_jobId' - The identification number of the export job.
--
-- 'lastUpdatedTimestamp', 'recommendationExportJob_lastUpdatedTimestamp' - The timestamp of when the export job was last updated.
--
-- 'resourceType', 'recommendationExportJob_resourceType' - The resource type of the exported recommendations.
--
-- 'status', 'recommendationExportJob_status' - The status of the export job.
newRecommendationExportJob ::
  RecommendationExportJob
newRecommendationExportJob :: RecommendationExportJob
newRecommendationExportJob =
  RecommendationExportJob'
    { $sel:creationTimestamp:RecommendationExportJob' :: Maybe POSIX
creationTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:destination:RecommendationExportJob' :: Maybe ExportDestination
destination = forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:RecommendationExportJob' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:RecommendationExportJob' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:RecommendationExportJob' :: Maybe POSIX
lastUpdatedTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:RecommendationExportJob' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:RecommendationExportJob' :: Maybe JobStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp of when the export job was created.
recommendationExportJob_creationTimestamp :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.UTCTime)
recommendationExportJob_creationTimestamp :: Lens' RecommendationExportJob (Maybe UTCTime)
recommendationExportJob_creationTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | An object that describes the destination of the export file.
recommendationExportJob_destination :: Lens.Lens' RecommendationExportJob (Prelude.Maybe ExportDestination)
recommendationExportJob_destination :: Lens' RecommendationExportJob (Maybe ExportDestination)
recommendationExportJob_destination = 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 reason for an export job failure.
recommendationExportJob_failureReason :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.Text)
recommendationExportJob_failureReason :: Lens' RecommendationExportJob (Maybe Text)
recommendationExportJob_failureReason = 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)

-- | The identification number of the export job.
recommendationExportJob_jobId :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.Text)
recommendationExportJob_jobId :: Lens' RecommendationExportJob (Maybe Text)
recommendationExportJob_jobId = 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 timestamp of when the export job was last updated.
recommendationExportJob_lastUpdatedTimestamp :: Lens.Lens' RecommendationExportJob (Prelude.Maybe Prelude.UTCTime)
recommendationExportJob_lastUpdatedTimestamp :: Lens' RecommendationExportJob (Maybe UTCTime)
recommendationExportJob_lastUpdatedTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The resource type of the exported recommendations.
recommendationExportJob_resourceType :: Lens.Lens' RecommendationExportJob (Prelude.Maybe ResourceType)
recommendationExportJob_resourceType :: Lens' RecommendationExportJob (Maybe ResourceType)
recommendationExportJob_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 status of the export job.
recommendationExportJob_status :: Lens.Lens' RecommendationExportJob (Prelude.Maybe JobStatus)
recommendationExportJob_status :: Lens' RecommendationExportJob (Maybe JobStatus)
recommendationExportJob_status = 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)

instance Data.FromJSON RecommendationExportJob where
  parseJSON :: Value -> Parser RecommendationExportJob
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RecommendationExportJob"
      ( \Object
x ->
          Maybe POSIX
-> Maybe ExportDestination
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe ResourceType
-> Maybe JobStatus
-> RecommendationExportJob
RecommendationExportJob'
            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
"creationTimestamp")
            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
"destination")
            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
"failureReason")
            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
"jobId")
            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
"lastUpdatedTimestamp")
            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
"resourceType")
            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 RecommendationExportJob where
  hashWithSalt :: Int -> RecommendationExportJob -> Int
hashWithSalt Int
_salt RecommendationExportJob' {Maybe Text
Maybe POSIX
Maybe JobStatus
Maybe ResourceType
Maybe ExportDestination
status :: Maybe JobStatus
resourceType :: Maybe ResourceType
lastUpdatedTimestamp :: Maybe POSIX
jobId :: Maybe Text
failureReason :: Maybe Text
destination :: Maybe ExportDestination
creationTimestamp :: Maybe POSIX
$sel:status:RecommendationExportJob' :: RecommendationExportJob -> Maybe JobStatus
$sel:resourceType:RecommendationExportJob' :: RecommendationExportJob -> Maybe ResourceType
$sel:lastUpdatedTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
$sel:jobId:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
$sel:failureReason:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
$sel:destination:RecommendationExportJob' :: RecommendationExportJob -> Maybe ExportDestination
$sel:creationTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExportDestination
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JobStatus
status

instance Prelude.NFData RecommendationExportJob where
  rnf :: RecommendationExportJob -> ()
rnf RecommendationExportJob' {Maybe Text
Maybe POSIX
Maybe JobStatus
Maybe ResourceType
Maybe ExportDestination
status :: Maybe JobStatus
resourceType :: Maybe ResourceType
lastUpdatedTimestamp :: Maybe POSIX
jobId :: Maybe Text
failureReason :: Maybe Text
destination :: Maybe ExportDestination
creationTimestamp :: Maybe POSIX
$sel:status:RecommendationExportJob' :: RecommendationExportJob -> Maybe JobStatus
$sel:resourceType:RecommendationExportJob' :: RecommendationExportJob -> Maybe ResourceType
$sel:lastUpdatedTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
$sel:jobId:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
$sel:failureReason:RecommendationExportJob' :: RecommendationExportJob -> Maybe Text
$sel:destination:RecommendationExportJob' :: RecommendationExportJob -> Maybe ExportDestination
$sel:creationTimestamp:RecommendationExportJob' :: RecommendationExportJob -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportDestination
destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JobStatus
status