{-# 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.ApplicationCostProfiler.Types.ReportDefinition
-- 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.ApplicationCostProfiler.Types.ReportDefinition where

import Amazonka.ApplicationCostProfiler.Types.Format
import Amazonka.ApplicationCostProfiler.Types.ReportFrequency
import Amazonka.ApplicationCostProfiler.Types.S3Location
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The configuration of a report in AWS Application Cost Profiler.
--
-- /See:/ 'newReportDefinition' smart constructor.
data ReportDefinition = ReportDefinition'
  { -- | Timestamp (milliseconds) when this report definition was last updated.
    ReportDefinition -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | Timestamp (milliseconds) when this report definition was created.
    ReportDefinition -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The ID of the report.
    ReportDefinition -> Maybe Text
reportId :: Prelude.Maybe Prelude.Text,
    -- | The format used for the generated reports.
    ReportDefinition -> Maybe Format
format :: Prelude.Maybe Format,
    -- | The cadence at which the report is generated.
    ReportDefinition -> Maybe ReportFrequency
reportFrequency :: Prelude.Maybe ReportFrequency,
    -- | Description of the report
    ReportDefinition -> Maybe Text
reportDescription :: Prelude.Maybe Prelude.Text,
    -- | The location in Amazon Simple Storage Service (Amazon S3) the reports
    -- should be saved to.
    ReportDefinition -> Maybe S3Location
destinationS3Location :: Prelude.Maybe S3Location
  }
  deriving (ReportDefinition -> ReportDefinition -> Bool
(ReportDefinition -> ReportDefinition -> Bool)
-> (ReportDefinition -> ReportDefinition -> Bool)
-> Eq ReportDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportDefinition -> ReportDefinition -> Bool
$c/= :: ReportDefinition -> ReportDefinition -> Bool
== :: ReportDefinition -> ReportDefinition -> Bool
$c== :: ReportDefinition -> ReportDefinition -> Bool
Prelude.Eq, ReadPrec [ReportDefinition]
ReadPrec ReportDefinition
Int -> ReadS ReportDefinition
ReadS [ReportDefinition]
(Int -> ReadS ReportDefinition)
-> ReadS [ReportDefinition]
-> ReadPrec ReportDefinition
-> ReadPrec [ReportDefinition]
-> Read ReportDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportDefinition]
$creadListPrec :: ReadPrec [ReportDefinition]
readPrec :: ReadPrec ReportDefinition
$creadPrec :: ReadPrec ReportDefinition
readList :: ReadS [ReportDefinition]
$creadList :: ReadS [ReportDefinition]
readsPrec :: Int -> ReadS ReportDefinition
$creadsPrec :: Int -> ReadS ReportDefinition
Prelude.Read, Int -> ReportDefinition -> ShowS
[ReportDefinition] -> ShowS
ReportDefinition -> String
(Int -> ReportDefinition -> ShowS)
-> (ReportDefinition -> String)
-> ([ReportDefinition] -> ShowS)
-> Show ReportDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportDefinition] -> ShowS
$cshowList :: [ReportDefinition] -> ShowS
show :: ReportDefinition -> String
$cshow :: ReportDefinition -> String
showsPrec :: Int -> ReportDefinition -> ShowS
$cshowsPrec :: Int -> ReportDefinition -> ShowS
Prelude.Show, (forall x. ReportDefinition -> Rep ReportDefinition x)
-> (forall x. Rep ReportDefinition x -> ReportDefinition)
-> Generic ReportDefinition
forall x. Rep ReportDefinition x -> ReportDefinition
forall x. ReportDefinition -> Rep ReportDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportDefinition x -> ReportDefinition
$cfrom :: forall x. ReportDefinition -> Rep ReportDefinition x
Prelude.Generic)

-- |
-- Create a value of 'ReportDefinition' 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:
--
-- 'lastUpdatedAt', 'reportDefinition_lastUpdatedAt' - Timestamp (milliseconds) when this report definition was last updated.
--
-- 'createdAt', 'reportDefinition_createdAt' - Timestamp (milliseconds) when this report definition was created.
--
-- 'reportId', 'reportDefinition_reportId' - The ID of the report.
--
-- 'format', 'reportDefinition_format' - The format used for the generated reports.
--
-- 'reportFrequency', 'reportDefinition_reportFrequency' - The cadence at which the report is generated.
--
-- 'reportDescription', 'reportDefinition_reportDescription' - Description of the report
--
-- 'destinationS3Location', 'reportDefinition_destinationS3Location' - The location in Amazon Simple Storage Service (Amazon S3) the reports
-- should be saved to.
newReportDefinition ::
  ReportDefinition
newReportDefinition :: ReportDefinition
newReportDefinition =
  ReportDefinition' :: Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Format
-> Maybe ReportFrequency
-> Maybe Text
-> Maybe S3Location
-> ReportDefinition
ReportDefinition'
    { $sel:lastUpdatedAt:ReportDefinition' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ReportDefinition' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:reportId:ReportDefinition' :: Maybe Text
reportId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:format:ReportDefinition' :: Maybe Format
format = Maybe Format
forall a. Maybe a
Prelude.Nothing,
      $sel:reportFrequency:ReportDefinition' :: Maybe ReportFrequency
reportFrequency = Maybe ReportFrequency
forall a. Maybe a
Prelude.Nothing,
      $sel:reportDescription:ReportDefinition' :: Maybe Text
reportDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationS3Location:ReportDefinition' :: Maybe S3Location
destinationS3Location = Maybe S3Location
forall a. Maybe a
Prelude.Nothing
    }

-- | Timestamp (milliseconds) when this report definition was last updated.
reportDefinition_lastUpdatedAt :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.UTCTime)
reportDefinition_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReportDefinition -> f ReportDefinition
reportDefinition_lastUpdatedAt = (ReportDefinition -> Maybe POSIX)
-> (ReportDefinition -> Maybe POSIX -> ReportDefinition)
-> Lens
     ReportDefinition ReportDefinition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe POSIX
a -> ReportDefinition
s {$sel:lastUpdatedAt:ReportDefinition' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: ReportDefinition) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReportDefinition -> f ReportDefinition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReportDefinition
-> f ReportDefinition
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

-- | Timestamp (milliseconds) when this report definition was created.
reportDefinition_createdAt :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.UTCTime)
reportDefinition_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReportDefinition -> f ReportDefinition
reportDefinition_createdAt = (ReportDefinition -> Maybe POSIX)
-> (ReportDefinition -> Maybe POSIX -> ReportDefinition)
-> Lens
     ReportDefinition ReportDefinition (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe POSIX
a -> ReportDefinition
s {$sel:createdAt:ReportDefinition' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ReportDefinition) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReportDefinition -> f ReportDefinition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReportDefinition
-> f ReportDefinition
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 ID of the report.
reportDefinition_reportId :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Text)
reportDefinition_reportId :: (Maybe Text -> f (Maybe Text))
-> ReportDefinition -> f ReportDefinition
reportDefinition_reportId = (ReportDefinition -> Maybe Text)
-> (ReportDefinition -> Maybe Text -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe Text
reportId :: Maybe Text
$sel:reportId:ReportDefinition' :: ReportDefinition -> Maybe Text
reportId} -> Maybe Text
reportId) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe Text
a -> ReportDefinition
s {$sel:reportId:ReportDefinition' :: Maybe Text
reportId = Maybe Text
a} :: ReportDefinition)

-- | The format used for the generated reports.
reportDefinition_format :: Lens.Lens' ReportDefinition (Prelude.Maybe Format)
reportDefinition_format :: (Maybe Format -> f (Maybe Format))
-> ReportDefinition -> f ReportDefinition
reportDefinition_format = (ReportDefinition -> Maybe Format)
-> (ReportDefinition -> Maybe Format -> ReportDefinition)
-> Lens
     ReportDefinition ReportDefinition (Maybe Format) (Maybe Format)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe Format
format :: Maybe Format
$sel:format:ReportDefinition' :: ReportDefinition -> Maybe Format
format} -> Maybe Format
format) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe Format
a -> ReportDefinition
s {$sel:format:ReportDefinition' :: Maybe Format
format = Maybe Format
a} :: ReportDefinition)

-- | The cadence at which the report is generated.
reportDefinition_reportFrequency :: Lens.Lens' ReportDefinition (Prelude.Maybe ReportFrequency)
reportDefinition_reportFrequency :: (Maybe ReportFrequency -> f (Maybe ReportFrequency))
-> ReportDefinition -> f ReportDefinition
reportDefinition_reportFrequency = (ReportDefinition -> Maybe ReportFrequency)
-> (ReportDefinition -> Maybe ReportFrequency -> ReportDefinition)
-> Lens
     ReportDefinition
     ReportDefinition
     (Maybe ReportFrequency)
     (Maybe ReportFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe ReportFrequency
reportFrequency :: Maybe ReportFrequency
$sel:reportFrequency:ReportDefinition' :: ReportDefinition -> Maybe ReportFrequency
reportFrequency} -> Maybe ReportFrequency
reportFrequency) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe ReportFrequency
a -> ReportDefinition
s {$sel:reportFrequency:ReportDefinition' :: Maybe ReportFrequency
reportFrequency = Maybe ReportFrequency
a} :: ReportDefinition)

-- | Description of the report
reportDefinition_reportDescription :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Text)
reportDefinition_reportDescription :: (Maybe Text -> f (Maybe Text))
-> ReportDefinition -> f ReportDefinition
reportDefinition_reportDescription = (ReportDefinition -> Maybe Text)
-> (ReportDefinition -> Maybe Text -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe Text
reportDescription :: Maybe Text
$sel:reportDescription:ReportDefinition' :: ReportDefinition -> Maybe Text
reportDescription} -> Maybe Text
reportDescription) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe Text
a -> ReportDefinition
s {$sel:reportDescription:ReportDefinition' :: Maybe Text
reportDescription = Maybe Text
a} :: ReportDefinition)

-- | The location in Amazon Simple Storage Service (Amazon S3) the reports
-- should be saved to.
reportDefinition_destinationS3Location :: Lens.Lens' ReportDefinition (Prelude.Maybe S3Location)
reportDefinition_destinationS3Location :: (Maybe S3Location -> f (Maybe S3Location))
-> ReportDefinition -> f ReportDefinition
reportDefinition_destinationS3Location = (ReportDefinition -> Maybe S3Location)
-> (ReportDefinition -> Maybe S3Location -> ReportDefinition)
-> Lens
     ReportDefinition
     ReportDefinition
     (Maybe S3Location)
     (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe S3Location
destinationS3Location :: Maybe S3Location
$sel:destinationS3Location:ReportDefinition' :: ReportDefinition -> Maybe S3Location
destinationS3Location} -> Maybe S3Location
destinationS3Location) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe S3Location
a -> ReportDefinition
s {$sel:destinationS3Location:ReportDefinition' :: Maybe S3Location
destinationS3Location = Maybe S3Location
a} :: ReportDefinition)

instance Core.FromJSON ReportDefinition where
  parseJSON :: Value -> Parser ReportDefinition
parseJSON =
    String
-> (Object -> Parser ReportDefinition)
-> Value
-> Parser ReportDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReportDefinition"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Format
-> Maybe ReportFrequency
-> Maybe Text
-> Maybe S3Location
-> ReportDefinition
ReportDefinition'
            (Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Format
 -> Maybe ReportFrequency
 -> Maybe Text
 -> Maybe S3Location
 -> ReportDefinition)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Format
      -> Maybe ReportFrequency
      -> Maybe Text
      -> Maybe S3Location
      -> ReportDefinition)
forall (f :: * -> *) a b. Functor 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
"lastUpdatedAt")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Format
   -> Maybe ReportFrequency
   -> Maybe Text
   -> Maybe S3Location
   -> ReportDefinition)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Format
      -> Maybe ReportFrequency
      -> Maybe Text
      -> Maybe S3Location
      -> ReportDefinition)
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
"createdAt")
            Parser
  (Maybe Text
   -> Maybe Format
   -> Maybe ReportFrequency
   -> Maybe Text
   -> Maybe S3Location
   -> ReportDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Format
      -> Maybe ReportFrequency
      -> Maybe Text
      -> Maybe S3Location
      -> ReportDefinition)
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
"reportId")
            Parser
  (Maybe Format
   -> Maybe ReportFrequency
   -> Maybe Text
   -> Maybe S3Location
   -> ReportDefinition)
-> Parser (Maybe Format)
-> Parser
     (Maybe ReportFrequency
      -> Maybe Text -> Maybe S3Location -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Format)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"format")
            Parser
  (Maybe ReportFrequency
   -> Maybe Text -> Maybe S3Location -> ReportDefinition)
-> Parser (Maybe ReportFrequency)
-> Parser (Maybe Text -> Maybe S3Location -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReportFrequency)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"reportFrequency")
            Parser (Maybe Text -> Maybe S3Location -> ReportDefinition)
-> Parser (Maybe Text)
-> Parser (Maybe S3Location -> ReportDefinition)
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
"reportDescription")
            Parser (Maybe S3Location -> ReportDefinition)
-> Parser (Maybe S3Location) -> Parser ReportDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3Location)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"destinationS3Location")
      )

instance Prelude.Hashable ReportDefinition

instance Prelude.NFData ReportDefinition