{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 created.
    ReportDefinition -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The location in Amazon Simple Storage Service (Amazon S3) the reports
    -- should be saved to.
    ReportDefinition -> Maybe S3Location
destinationS3Location :: Prelude.Maybe S3Location,
    -- | The format used for the generated reports.
    ReportDefinition -> Maybe Format
format :: Prelude.Maybe Format,
    -- | Timestamp (milliseconds) when this report definition was last updated.
    ReportDefinition -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Data.POSIX,
    -- | Description of the report
    ReportDefinition -> Maybe Text
reportDescription :: Prelude.Maybe Prelude.Text,
    -- | The cadence at which the report is generated.
    ReportDefinition -> Maybe ReportFrequency
reportFrequency :: Prelude.Maybe ReportFrequency,
    -- | The ID of the report.
    ReportDefinition -> Maybe Text
reportId :: Prelude.Maybe Prelude.Text
  }
  deriving (ReportDefinition -> ReportDefinition -> Bool
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]
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
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. 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:
--
-- 'createdAt', 'reportDefinition_createdAt' - Timestamp (milliseconds) when this report definition was created.
--
-- 'destinationS3Location', 'reportDefinition_destinationS3Location' - The location in Amazon Simple Storage Service (Amazon S3) the reports
-- should be saved to.
--
-- 'format', 'reportDefinition_format' - The format used for the generated reports.
--
-- 'lastUpdatedAt', 'reportDefinition_lastUpdatedAt' - Timestamp (milliseconds) when this report definition was last updated.
--
-- 'reportDescription', 'reportDefinition_reportDescription' - Description of the report
--
-- 'reportFrequency', 'reportDefinition_reportFrequency' - The cadence at which the report is generated.
--
-- 'reportId', 'reportDefinition_reportId' - The ID of the report.
newReportDefinition ::
  ReportDefinition
newReportDefinition :: ReportDefinition
newReportDefinition =
  ReportDefinition'
    { $sel:createdAt:ReportDefinition' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationS3Location:ReportDefinition' :: Maybe S3Location
destinationS3Location = forall a. Maybe a
Prelude.Nothing,
      $sel:format:ReportDefinition' :: Maybe Format
format = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:ReportDefinition' :: Maybe POSIX
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:reportDescription:ReportDefinition' :: Maybe Text
reportDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:reportFrequency:ReportDefinition' :: Maybe ReportFrequency
reportFrequency = forall a. Maybe a
Prelude.Nothing,
      $sel:reportId:ReportDefinition' :: Maybe Text
reportId = forall a. Maybe a
Prelude.Nothing
    }

-- | Timestamp (milliseconds) when this report definition was created.
reportDefinition_createdAt :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.UTCTime)
reportDefinition_createdAt :: Lens' ReportDefinition (Maybe UTCTime)
reportDefinition_createdAt = 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) 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 location in Amazon Simple Storage Service (Amazon S3) the reports
-- should be saved to.
reportDefinition_destinationS3Location :: Lens.Lens' ReportDefinition (Prelude.Maybe S3Location)
reportDefinition_destinationS3Location :: Lens' ReportDefinition (Maybe S3Location)
reportDefinition_destinationS3Location = 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)

-- | The format used for the generated reports.
reportDefinition_format :: Lens.Lens' ReportDefinition (Prelude.Maybe Format)
reportDefinition_format :: Lens' ReportDefinition (Maybe Format)
reportDefinition_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)

-- | Timestamp (milliseconds) when this report definition was last updated.
reportDefinition_lastUpdatedAt :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.UTCTime)
reportDefinition_lastUpdatedAt :: Lens' ReportDefinition (Maybe UTCTime)
reportDefinition_lastUpdatedAt = 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) 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

-- | Description of the report
reportDefinition_reportDescription :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Text)
reportDefinition_reportDescription :: Lens' ReportDefinition (Maybe Text)
reportDefinition_reportDescription = 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 cadence at which the report is generated.
reportDefinition_reportFrequency :: Lens.Lens' ReportDefinition (Prelude.Maybe ReportFrequency)
reportDefinition_reportFrequency :: Lens' ReportDefinition (Maybe ReportFrequency)
reportDefinition_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)

-- | The ID of the report.
reportDefinition_reportId :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Text)
reportDefinition_reportId :: Lens' ReportDefinition (Maybe Text)
reportDefinition_reportId = 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)

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

instance Prelude.Hashable ReportDefinition where
  hashWithSalt :: Int -> ReportDefinition -> Int
hashWithSalt Int
_salt ReportDefinition' {Maybe Text
Maybe POSIX
Maybe Format
Maybe ReportFrequency
Maybe S3Location
reportId :: Maybe Text
reportFrequency :: Maybe ReportFrequency
reportDescription :: Maybe Text
lastUpdatedAt :: Maybe POSIX
format :: Maybe Format
destinationS3Location :: Maybe S3Location
createdAt :: Maybe POSIX
$sel:reportId:ReportDefinition' :: ReportDefinition -> Maybe Text
$sel:reportFrequency:ReportDefinition' :: ReportDefinition -> Maybe ReportFrequency
$sel:reportDescription:ReportDefinition' :: ReportDefinition -> Maybe Text
$sel:lastUpdatedAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
$sel:format:ReportDefinition' :: ReportDefinition -> Maybe Format
$sel:destinationS3Location:ReportDefinition' :: ReportDefinition -> Maybe S3Location
$sel:createdAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3Location
destinationS3Location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Format
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reportDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReportFrequency
reportFrequency
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reportId

instance Prelude.NFData ReportDefinition where
  rnf :: ReportDefinition -> ()
rnf ReportDefinition' {Maybe Text
Maybe POSIX
Maybe Format
Maybe ReportFrequency
Maybe S3Location
reportId :: Maybe Text
reportFrequency :: Maybe ReportFrequency
reportDescription :: Maybe Text
lastUpdatedAt :: Maybe POSIX
format :: Maybe Format
destinationS3Location :: Maybe S3Location
createdAt :: Maybe POSIX
$sel:reportId:ReportDefinition' :: ReportDefinition -> Maybe Text
$sel:reportFrequency:ReportDefinition' :: ReportDefinition -> Maybe ReportFrequency
$sel:reportDescription:ReportDefinition' :: ReportDefinition -> Maybe Text
$sel:lastUpdatedAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
$sel:format:ReportDefinition' :: ReportDefinition -> Maybe Format
$sel:destinationS3Location:ReportDefinition' :: ReportDefinition -> Maybe S3Location
$sel:createdAt:ReportDefinition' :: ReportDefinition -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3Location
destinationS3Location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Format
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reportDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReportFrequency
reportFrequency
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reportId