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

import qualified Amazonka.Core as Core
import Amazonka.CostAndUsageReport.Types.AWSRegion
import Amazonka.CostAndUsageReport.Types.AdditionalArtifact
import Amazonka.CostAndUsageReport.Types.CompressionFormat
import Amazonka.CostAndUsageReport.Types.ReportFormat
import Amazonka.CostAndUsageReport.Types.ReportVersioning
import Amazonka.CostAndUsageReport.Types.SchemaElement
import Amazonka.CostAndUsageReport.Types.TimeUnit
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The definition of AWS Cost and Usage Report. You can specify the report
-- name, time unit, report format, compression format, S3 bucket,
-- additional artifacts, and schema elements in the definition.
--
-- /See:/ 'newReportDefinition' smart constructor.
data ReportDefinition = ReportDefinition'
  { -- | Whether you want Amazon Web Services to overwrite the previous version
    -- of each report or to deliver the report in addition to the previous
    -- versions.
    ReportDefinition -> Maybe ReportVersioning
reportVersioning :: Prelude.Maybe ReportVersioning,
    -- | The Amazon resource name of the billing view. You can get this value by
    -- using the billing view service public APIs.
    ReportDefinition -> Maybe Text
billingViewArn :: Prelude.Maybe Prelude.Text,
    -- | A list of manifests that you want Amazon Web Services to create for this
    -- report.
    ReportDefinition -> Maybe [AdditionalArtifact]
additionalArtifacts :: Prelude.Maybe [AdditionalArtifact],
    -- | Whether you want Amazon Web Services to update your reports after they
    -- have been finalized if Amazon Web Services detects charges related to
    -- previous months. These charges can include refunds, credits, or support
    -- fees.
    ReportDefinition -> Maybe Bool
refreshClosedReports :: Prelude.Maybe Prelude.Bool,
    ReportDefinition -> Text
reportName :: Prelude.Text,
    ReportDefinition -> TimeUnit
timeUnit :: TimeUnit,
    ReportDefinition -> ReportFormat
format :: ReportFormat,
    ReportDefinition -> CompressionFormat
compression :: CompressionFormat,
    -- | A list of strings that indicate additional content that Amazon Web
    -- Services includes in the report, such as individual resource IDs.
    ReportDefinition -> [SchemaElement]
additionalSchemaElements :: [SchemaElement],
    ReportDefinition -> Text
s3Bucket :: Prelude.Text,
    ReportDefinition -> Text
s3Prefix :: Prelude.Text,
    ReportDefinition -> AWSRegion
s3Region :: AWSRegion
  }
  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:
--
-- 'reportVersioning', 'reportDefinition_reportVersioning' - Whether you want Amazon Web Services to overwrite the previous version
-- of each report or to deliver the report in addition to the previous
-- versions.
--
-- 'billingViewArn', 'reportDefinition_billingViewArn' - The Amazon resource name of the billing view. You can get this value by
-- using the billing view service public APIs.
--
-- 'additionalArtifacts', 'reportDefinition_additionalArtifacts' - A list of manifests that you want Amazon Web Services to create for this
-- report.
--
-- 'refreshClosedReports', 'reportDefinition_refreshClosedReports' - Whether you want Amazon Web Services to update your reports after they
-- have been finalized if Amazon Web Services detects charges related to
-- previous months. These charges can include refunds, credits, or support
-- fees.
--
-- 'reportName', 'reportDefinition_reportName' - Undocumented member.
--
-- 'timeUnit', 'reportDefinition_timeUnit' - Undocumented member.
--
-- 'format', 'reportDefinition_format' - Undocumented member.
--
-- 'compression', 'reportDefinition_compression' - Undocumented member.
--
-- 'additionalSchemaElements', 'reportDefinition_additionalSchemaElements' - A list of strings that indicate additional content that Amazon Web
-- Services includes in the report, such as individual resource IDs.
--
-- 's3Bucket', 'reportDefinition_s3Bucket' - Undocumented member.
--
-- 's3Prefix', 'reportDefinition_s3Prefix' - Undocumented member.
--
-- 's3Region', 'reportDefinition_s3Region' - Undocumented member.
newReportDefinition ::
  -- | 'reportName'
  Prelude.Text ->
  -- | 'timeUnit'
  TimeUnit ->
  -- | 'format'
  ReportFormat ->
  -- | 'compression'
  CompressionFormat ->
  -- | 's3Bucket'
  Prelude.Text ->
  -- | 's3Prefix'
  Prelude.Text ->
  -- | 's3Region'
  AWSRegion ->
  ReportDefinition
newReportDefinition :: Text
-> TimeUnit
-> ReportFormat
-> CompressionFormat
-> Text
-> Text
-> AWSRegion
-> ReportDefinition
newReportDefinition
  Text
pReportName_
  TimeUnit
pTimeUnit_
  ReportFormat
pFormat_
  CompressionFormat
pCompression_
  Text
pS3Bucket_
  Text
pS3Prefix_
  AWSRegion
pS3Region_ =
    ReportDefinition' :: Maybe ReportVersioning
-> Maybe Text
-> Maybe [AdditionalArtifact]
-> Maybe Bool
-> Text
-> TimeUnit
-> ReportFormat
-> CompressionFormat
-> [SchemaElement]
-> Text
-> Text
-> AWSRegion
-> ReportDefinition
ReportDefinition'
      { $sel:reportVersioning:ReportDefinition' :: Maybe ReportVersioning
reportVersioning =
          Maybe ReportVersioning
forall a. Maybe a
Prelude.Nothing,
        $sel:billingViewArn:ReportDefinition' :: Maybe Text
billingViewArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:additionalArtifacts:ReportDefinition' :: Maybe [AdditionalArtifact]
additionalArtifacts = Maybe [AdditionalArtifact]
forall a. Maybe a
Prelude.Nothing,
        $sel:refreshClosedReports:ReportDefinition' :: Maybe Bool
refreshClosedReports = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:reportName:ReportDefinition' :: Text
reportName = Text
pReportName_,
        $sel:timeUnit:ReportDefinition' :: TimeUnit
timeUnit = TimeUnit
pTimeUnit_,
        $sel:format:ReportDefinition' :: ReportFormat
format = ReportFormat
pFormat_,
        $sel:compression:ReportDefinition' :: CompressionFormat
compression = CompressionFormat
pCompression_,
        $sel:additionalSchemaElements:ReportDefinition' :: [SchemaElement]
additionalSchemaElements = [SchemaElement]
forall a. Monoid a => a
Prelude.mempty,
        $sel:s3Bucket:ReportDefinition' :: Text
s3Bucket = Text
pS3Bucket_,
        $sel:s3Prefix:ReportDefinition' :: Text
s3Prefix = Text
pS3Prefix_,
        $sel:s3Region:ReportDefinition' :: AWSRegion
s3Region = AWSRegion
pS3Region_
      }

-- | Whether you want Amazon Web Services to overwrite the previous version
-- of each report or to deliver the report in addition to the previous
-- versions.
reportDefinition_reportVersioning :: Lens.Lens' ReportDefinition (Prelude.Maybe ReportVersioning)
reportDefinition_reportVersioning :: (Maybe ReportVersioning -> f (Maybe ReportVersioning))
-> ReportDefinition -> f ReportDefinition
reportDefinition_reportVersioning = (ReportDefinition -> Maybe ReportVersioning)
-> (ReportDefinition -> Maybe ReportVersioning -> ReportDefinition)
-> Lens
     ReportDefinition
     ReportDefinition
     (Maybe ReportVersioning)
     (Maybe ReportVersioning)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe ReportVersioning
reportVersioning :: Maybe ReportVersioning
$sel:reportVersioning:ReportDefinition' :: ReportDefinition -> Maybe ReportVersioning
reportVersioning} -> Maybe ReportVersioning
reportVersioning) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe ReportVersioning
a -> ReportDefinition
s {$sel:reportVersioning:ReportDefinition' :: Maybe ReportVersioning
reportVersioning = Maybe ReportVersioning
a} :: ReportDefinition)

-- | The Amazon resource name of the billing view. You can get this value by
-- using the billing view service public APIs.
reportDefinition_billingViewArn :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Text)
reportDefinition_billingViewArn :: (Maybe Text -> f (Maybe Text))
-> ReportDefinition -> f ReportDefinition
reportDefinition_billingViewArn = (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
billingViewArn :: Maybe Text
$sel:billingViewArn:ReportDefinition' :: ReportDefinition -> Maybe Text
billingViewArn} -> Maybe Text
billingViewArn) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe Text
a -> ReportDefinition
s {$sel:billingViewArn:ReportDefinition' :: Maybe Text
billingViewArn = Maybe Text
a} :: ReportDefinition)

-- | A list of manifests that you want Amazon Web Services to create for this
-- report.
reportDefinition_additionalArtifacts :: Lens.Lens' ReportDefinition (Prelude.Maybe [AdditionalArtifact])
reportDefinition_additionalArtifacts :: (Maybe [AdditionalArtifact] -> f (Maybe [AdditionalArtifact]))
-> ReportDefinition -> f ReportDefinition
reportDefinition_additionalArtifacts = (ReportDefinition -> Maybe [AdditionalArtifact])
-> (ReportDefinition
    -> Maybe [AdditionalArtifact] -> ReportDefinition)
-> Lens
     ReportDefinition
     ReportDefinition
     (Maybe [AdditionalArtifact])
     (Maybe [AdditionalArtifact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe [AdditionalArtifact]
additionalArtifacts :: Maybe [AdditionalArtifact]
$sel:additionalArtifacts:ReportDefinition' :: ReportDefinition -> Maybe [AdditionalArtifact]
additionalArtifacts} -> Maybe [AdditionalArtifact]
additionalArtifacts) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe [AdditionalArtifact]
a -> ReportDefinition
s {$sel:additionalArtifacts:ReportDefinition' :: Maybe [AdditionalArtifact]
additionalArtifacts = Maybe [AdditionalArtifact]
a} :: ReportDefinition) ((Maybe [AdditionalArtifact] -> f (Maybe [AdditionalArtifact]))
 -> ReportDefinition -> f ReportDefinition)
-> ((Maybe [AdditionalArtifact] -> f (Maybe [AdditionalArtifact]))
    -> Maybe [AdditionalArtifact] -> f (Maybe [AdditionalArtifact]))
-> (Maybe [AdditionalArtifact] -> f (Maybe [AdditionalArtifact]))
-> ReportDefinition
-> f ReportDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AdditionalArtifact]
  [AdditionalArtifact]
  [AdditionalArtifact]
  [AdditionalArtifact]
-> Iso
     (Maybe [AdditionalArtifact])
     (Maybe [AdditionalArtifact])
     (Maybe [AdditionalArtifact])
     (Maybe [AdditionalArtifact])
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
  [AdditionalArtifact]
  [AdditionalArtifact]
  [AdditionalArtifact]
  [AdditionalArtifact]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Whether you want Amazon Web Services to update your reports after they
-- have been finalized if Amazon Web Services detects charges related to
-- previous months. These charges can include refunds, credits, or support
-- fees.
reportDefinition_refreshClosedReports :: Lens.Lens' ReportDefinition (Prelude.Maybe Prelude.Bool)
reportDefinition_refreshClosedReports :: (Maybe Bool -> f (Maybe Bool))
-> ReportDefinition -> f ReportDefinition
reportDefinition_refreshClosedReports = (ReportDefinition -> Maybe Bool)
-> (ReportDefinition -> Maybe Bool -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Maybe Bool
refreshClosedReports :: Maybe Bool
$sel:refreshClosedReports:ReportDefinition' :: ReportDefinition -> Maybe Bool
refreshClosedReports} -> Maybe Bool
refreshClosedReports) (\s :: ReportDefinition
s@ReportDefinition' {} Maybe Bool
a -> ReportDefinition
s {$sel:refreshClosedReports:ReportDefinition' :: Maybe Bool
refreshClosedReports = Maybe Bool
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_reportName :: Lens.Lens' ReportDefinition Prelude.Text
reportDefinition_reportName :: (Text -> f Text) -> ReportDefinition -> f ReportDefinition
reportDefinition_reportName = (ReportDefinition -> Text)
-> (ReportDefinition -> Text -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Text
reportName :: Text
$sel:reportName:ReportDefinition' :: ReportDefinition -> Text
reportName} -> Text
reportName) (\s :: ReportDefinition
s@ReportDefinition' {} Text
a -> ReportDefinition
s {$sel:reportName:ReportDefinition' :: Text
reportName = Text
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_timeUnit :: Lens.Lens' ReportDefinition TimeUnit
reportDefinition_timeUnit :: (TimeUnit -> f TimeUnit) -> ReportDefinition -> f ReportDefinition
reportDefinition_timeUnit = (ReportDefinition -> TimeUnit)
-> (ReportDefinition -> TimeUnit -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition TimeUnit TimeUnit
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {TimeUnit
timeUnit :: TimeUnit
$sel:timeUnit:ReportDefinition' :: ReportDefinition -> TimeUnit
timeUnit} -> TimeUnit
timeUnit) (\s :: ReportDefinition
s@ReportDefinition' {} TimeUnit
a -> ReportDefinition
s {$sel:timeUnit:ReportDefinition' :: TimeUnit
timeUnit = TimeUnit
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_format :: Lens.Lens' ReportDefinition ReportFormat
reportDefinition_format :: (ReportFormat -> f ReportFormat)
-> ReportDefinition -> f ReportDefinition
reportDefinition_format = (ReportDefinition -> ReportFormat)
-> (ReportDefinition -> ReportFormat -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition ReportFormat ReportFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {ReportFormat
format :: ReportFormat
$sel:format:ReportDefinition' :: ReportDefinition -> ReportFormat
format} -> ReportFormat
format) (\s :: ReportDefinition
s@ReportDefinition' {} ReportFormat
a -> ReportDefinition
s {$sel:format:ReportDefinition' :: ReportFormat
format = ReportFormat
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_compression :: Lens.Lens' ReportDefinition CompressionFormat
reportDefinition_compression :: (CompressionFormat -> f CompressionFormat)
-> ReportDefinition -> f ReportDefinition
reportDefinition_compression = (ReportDefinition -> CompressionFormat)
-> (ReportDefinition -> CompressionFormat -> ReportDefinition)
-> Lens
     ReportDefinition
     ReportDefinition
     CompressionFormat
     CompressionFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {CompressionFormat
compression :: CompressionFormat
$sel:compression:ReportDefinition' :: ReportDefinition -> CompressionFormat
compression} -> CompressionFormat
compression) (\s :: ReportDefinition
s@ReportDefinition' {} CompressionFormat
a -> ReportDefinition
s {$sel:compression:ReportDefinition' :: CompressionFormat
compression = CompressionFormat
a} :: ReportDefinition)

-- | A list of strings that indicate additional content that Amazon Web
-- Services includes in the report, such as individual resource IDs.
reportDefinition_additionalSchemaElements :: Lens.Lens' ReportDefinition [SchemaElement]
reportDefinition_additionalSchemaElements :: ([SchemaElement] -> f [SchemaElement])
-> ReportDefinition -> f ReportDefinition
reportDefinition_additionalSchemaElements = (ReportDefinition -> [SchemaElement])
-> (ReportDefinition -> [SchemaElement] -> ReportDefinition)
-> Lens
     ReportDefinition ReportDefinition [SchemaElement] [SchemaElement]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {[SchemaElement]
additionalSchemaElements :: [SchemaElement]
$sel:additionalSchemaElements:ReportDefinition' :: ReportDefinition -> [SchemaElement]
additionalSchemaElements} -> [SchemaElement]
additionalSchemaElements) (\s :: ReportDefinition
s@ReportDefinition' {} [SchemaElement]
a -> ReportDefinition
s {$sel:additionalSchemaElements:ReportDefinition' :: [SchemaElement]
additionalSchemaElements = [SchemaElement]
a} :: ReportDefinition) (([SchemaElement] -> f [SchemaElement])
 -> ReportDefinition -> f ReportDefinition)
-> (([SchemaElement] -> f [SchemaElement])
    -> [SchemaElement] -> f [SchemaElement])
-> ([SchemaElement] -> f [SchemaElement])
-> ReportDefinition
-> f ReportDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SchemaElement] -> f [SchemaElement])
-> [SchemaElement] -> f [SchemaElement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
reportDefinition_s3Bucket :: Lens.Lens' ReportDefinition Prelude.Text
reportDefinition_s3Bucket :: (Text -> f Text) -> ReportDefinition -> f ReportDefinition
reportDefinition_s3Bucket = (ReportDefinition -> Text)
-> (ReportDefinition -> Text -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Text
s3Bucket :: Text
$sel:s3Bucket:ReportDefinition' :: ReportDefinition -> Text
s3Bucket} -> Text
s3Bucket) (\s :: ReportDefinition
s@ReportDefinition' {} Text
a -> ReportDefinition
s {$sel:s3Bucket:ReportDefinition' :: Text
s3Bucket = Text
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_s3Prefix :: Lens.Lens' ReportDefinition Prelude.Text
reportDefinition_s3Prefix :: (Text -> f Text) -> ReportDefinition -> f ReportDefinition
reportDefinition_s3Prefix = (ReportDefinition -> Text)
-> (ReportDefinition -> Text -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {Text
s3Prefix :: Text
$sel:s3Prefix:ReportDefinition' :: ReportDefinition -> Text
s3Prefix} -> Text
s3Prefix) (\s :: ReportDefinition
s@ReportDefinition' {} Text
a -> ReportDefinition
s {$sel:s3Prefix:ReportDefinition' :: Text
s3Prefix = Text
a} :: ReportDefinition)

-- | Undocumented member.
reportDefinition_s3Region :: Lens.Lens' ReportDefinition AWSRegion
reportDefinition_s3Region :: (AWSRegion -> f AWSRegion)
-> ReportDefinition -> f ReportDefinition
reportDefinition_s3Region = (ReportDefinition -> AWSRegion)
-> (ReportDefinition -> AWSRegion -> ReportDefinition)
-> Lens ReportDefinition ReportDefinition AWSRegion AWSRegion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDefinition' {AWSRegion
s3Region :: AWSRegion
$sel:s3Region:ReportDefinition' :: ReportDefinition -> AWSRegion
s3Region} -> AWSRegion
s3Region) (\s :: ReportDefinition
s@ReportDefinition' {} AWSRegion
a -> ReportDefinition
s {$sel:s3Region:ReportDefinition' :: AWSRegion
s3Region = AWSRegion
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 ReportVersioning
-> Maybe Text
-> Maybe [AdditionalArtifact]
-> Maybe Bool
-> Text
-> TimeUnit
-> ReportFormat
-> CompressionFormat
-> [SchemaElement]
-> Text
-> Text
-> AWSRegion
-> ReportDefinition
ReportDefinition'
            (Maybe ReportVersioning
 -> Maybe Text
 -> Maybe [AdditionalArtifact]
 -> Maybe Bool
 -> Text
 -> TimeUnit
 -> ReportFormat
 -> CompressionFormat
 -> [SchemaElement]
 -> Text
 -> Text
 -> AWSRegion
 -> ReportDefinition)
-> Parser (Maybe ReportVersioning)
-> Parser
     (Maybe Text
      -> Maybe [AdditionalArtifact]
      -> Maybe Bool
      -> Text
      -> TimeUnit
      -> ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ReportVersioning)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReportVersioning")
            Parser
  (Maybe Text
   -> Maybe [AdditionalArtifact]
   -> Maybe Bool
   -> Text
   -> TimeUnit
   -> ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe [AdditionalArtifact]
      -> Maybe Bool
      -> Text
      -> TimeUnit
      -> ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> 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
"BillingViewArn")
            Parser
  (Maybe [AdditionalArtifact]
   -> Maybe Bool
   -> Text
   -> TimeUnit
   -> ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser (Maybe [AdditionalArtifact])
-> Parser
     (Maybe Bool
      -> Text
      -> TimeUnit
      -> ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AdditionalArtifact]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdditionalArtifacts"
                            Parser (Maybe (Maybe [AdditionalArtifact]))
-> Maybe [AdditionalArtifact]
-> Parser (Maybe [AdditionalArtifact])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AdditionalArtifact]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Bool
   -> Text
   -> TimeUnit
   -> ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser (Maybe Bool)
-> Parser
     (Text
      -> TimeUnit
      -> ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RefreshClosedReports")
            Parser
  (Text
   -> TimeUnit
   -> ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser Text
-> Parser
     (TimeUnit
      -> ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ReportName")
            Parser
  (TimeUnit
   -> ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser TimeUnit
-> Parser
     (ReportFormat
      -> CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TimeUnit
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TimeUnit")
            Parser
  (ReportFormat
   -> CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser ReportFormat
-> Parser
     (CompressionFormat
      -> [SchemaElement]
      -> Text
      -> Text
      -> AWSRegion
      -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ReportFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Format")
            Parser
  (CompressionFormat
   -> [SchemaElement]
   -> Text
   -> Text
   -> AWSRegion
   -> ReportDefinition)
-> Parser CompressionFormat
-> Parser
     ([SchemaElement] -> Text -> Text -> AWSRegion -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser CompressionFormat
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Compression")
            Parser
  ([SchemaElement] -> Text -> Text -> AWSRegion -> ReportDefinition)
-> Parser [SchemaElement]
-> Parser (Text -> Text -> AWSRegion -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [SchemaElement])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AdditionalSchemaElements"
                            Parser (Maybe [SchemaElement])
-> [SchemaElement] -> Parser [SchemaElement]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [SchemaElement]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Text -> Text -> AWSRegion -> ReportDefinition)
-> Parser Text -> Parser (Text -> AWSRegion -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Bucket")
            Parser (Text -> AWSRegion -> ReportDefinition)
-> Parser Text -> Parser (AWSRegion -> ReportDefinition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Prefix")
            Parser (AWSRegion -> ReportDefinition)
-> Parser AWSRegion -> Parser ReportDefinition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AWSRegion
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Region")
      )

instance Prelude.Hashable ReportDefinition

instance Prelude.NFData ReportDefinition

instance Core.ToJSON ReportDefinition where
  toJSON :: ReportDefinition -> Value
toJSON ReportDefinition' {[SchemaElement]
Maybe Bool
Maybe [AdditionalArtifact]
Maybe Text
Maybe ReportVersioning
Text
AWSRegion
CompressionFormat
ReportFormat
TimeUnit
s3Region :: AWSRegion
s3Prefix :: Text
s3Bucket :: Text
additionalSchemaElements :: [SchemaElement]
compression :: CompressionFormat
format :: ReportFormat
timeUnit :: TimeUnit
reportName :: Text
refreshClosedReports :: Maybe Bool
additionalArtifacts :: Maybe [AdditionalArtifact]
billingViewArn :: Maybe Text
reportVersioning :: Maybe ReportVersioning
$sel:s3Region:ReportDefinition' :: ReportDefinition -> AWSRegion
$sel:s3Prefix:ReportDefinition' :: ReportDefinition -> Text
$sel:s3Bucket:ReportDefinition' :: ReportDefinition -> Text
$sel:additionalSchemaElements:ReportDefinition' :: ReportDefinition -> [SchemaElement]
$sel:compression:ReportDefinition' :: ReportDefinition -> CompressionFormat
$sel:format:ReportDefinition' :: ReportDefinition -> ReportFormat
$sel:timeUnit:ReportDefinition' :: ReportDefinition -> TimeUnit
$sel:reportName:ReportDefinition' :: ReportDefinition -> Text
$sel:refreshClosedReports:ReportDefinition' :: ReportDefinition -> Maybe Bool
$sel:additionalArtifacts:ReportDefinition' :: ReportDefinition -> Maybe [AdditionalArtifact]
$sel:billingViewArn:ReportDefinition' :: ReportDefinition -> Maybe Text
$sel:reportVersioning:ReportDefinition' :: ReportDefinition -> Maybe ReportVersioning
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ReportVersioning" Text -> ReportVersioning -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReportVersioning -> Pair) -> Maybe ReportVersioning -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReportVersioning
reportVersioning,
            (Text
"BillingViewArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingViewArn,
            (Text
"AdditionalArtifacts" Text -> [AdditionalArtifact] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AdditionalArtifact] -> Pair)
-> Maybe [AdditionalArtifact] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AdditionalArtifact]
additionalArtifacts,
            (Text
"RefreshClosedReports" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
refreshClosedReports,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ReportName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
reportName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TimeUnit" Text -> TimeUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TimeUnit
timeUnit),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Format" Text -> ReportFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReportFormat
format),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Compression" Text -> CompressionFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CompressionFormat
compression),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"AdditionalSchemaElements"
                  Text -> [SchemaElement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [SchemaElement]
additionalSchemaElements
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Bucket),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Prefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Prefix),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Region" Text -> AWSRegion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AWSRegion
s3Region)
          ]
      )