{-# 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.Backup.Types.ReportDestination
-- 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.Backup.Types.ReportDestination where

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

-- | Contains information from your report job about your report destination.
--
-- /See:/ 'newReportDestination' smart constructor.
data ReportDestination = ReportDestination'
  { -- | The unique name of the Amazon S3 bucket that receives your reports.
    ReportDestination -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The object key that uniquely identifies your reports in your S3 bucket.
    ReportDestination -> Maybe [Text]
s3Keys :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ReportDestination -> ReportDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportDestination -> ReportDestination -> Bool
$c/= :: ReportDestination -> ReportDestination -> Bool
== :: ReportDestination -> ReportDestination -> Bool
$c== :: ReportDestination -> ReportDestination -> Bool
Prelude.Eq, ReadPrec [ReportDestination]
ReadPrec ReportDestination
Int -> ReadS ReportDestination
ReadS [ReportDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportDestination]
$creadListPrec :: ReadPrec [ReportDestination]
readPrec :: ReadPrec ReportDestination
$creadPrec :: ReadPrec ReportDestination
readList :: ReadS [ReportDestination]
$creadList :: ReadS [ReportDestination]
readsPrec :: Int -> ReadS ReportDestination
$creadsPrec :: Int -> ReadS ReportDestination
Prelude.Read, Int -> ReportDestination -> ShowS
[ReportDestination] -> ShowS
ReportDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportDestination] -> ShowS
$cshowList :: [ReportDestination] -> ShowS
show :: ReportDestination -> String
$cshow :: ReportDestination -> String
showsPrec :: Int -> ReportDestination -> ShowS
$cshowsPrec :: Int -> ReportDestination -> ShowS
Prelude.Show, forall x. Rep ReportDestination x -> ReportDestination
forall x. ReportDestination -> Rep ReportDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportDestination x -> ReportDestination
$cfrom :: forall x. ReportDestination -> Rep ReportDestination x
Prelude.Generic)

-- |
-- Create a value of 'ReportDestination' 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:
--
-- 's3BucketName', 'reportDestination_s3BucketName' - The unique name of the Amazon S3 bucket that receives your reports.
--
-- 's3Keys', 'reportDestination_s3Keys' - The object key that uniquely identifies your reports in your S3 bucket.
newReportDestination ::
  ReportDestination
newReportDestination :: ReportDestination
newReportDestination =
  ReportDestination'
    { $sel:s3BucketName:ReportDestination' :: Maybe Text
s3BucketName = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Keys:ReportDestination' :: Maybe [Text]
s3Keys = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique name of the Amazon S3 bucket that receives your reports.
reportDestination_s3BucketName :: Lens.Lens' ReportDestination (Prelude.Maybe Prelude.Text)
reportDestination_s3BucketName :: Lens' ReportDestination (Maybe Text)
reportDestination_s3BucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDestination' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:ReportDestination' :: ReportDestination -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: ReportDestination
s@ReportDestination' {} Maybe Text
a -> ReportDestination
s {$sel:s3BucketName:ReportDestination' :: Maybe Text
s3BucketName = Maybe Text
a} :: ReportDestination)

-- | The object key that uniquely identifies your reports in your S3 bucket.
reportDestination_s3Keys :: Lens.Lens' ReportDestination (Prelude.Maybe [Prelude.Text])
reportDestination_s3Keys :: Lens' ReportDestination (Maybe [Text])
reportDestination_s3Keys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportDestination' {Maybe [Text]
s3Keys :: Maybe [Text]
$sel:s3Keys:ReportDestination' :: ReportDestination -> Maybe [Text]
s3Keys} -> Maybe [Text]
s3Keys) (\s :: ReportDestination
s@ReportDestination' {} Maybe [Text]
a -> ReportDestination
s {$sel:s3Keys:ReportDestination' :: Maybe [Text]
s3Keys = Maybe [Text]
a} :: ReportDestination) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ReportDestination where
  parseJSON :: Value -> Parser ReportDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReportDestination"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> ReportDestination
ReportDestination'
            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
"S3BucketName")
            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
"S3Keys" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ReportDestination where
  hashWithSalt :: Int -> ReportDestination -> Int
hashWithSalt Int
_salt ReportDestination' {Maybe [Text]
Maybe Text
s3Keys :: Maybe [Text]
s3BucketName :: Maybe Text
$sel:s3Keys:ReportDestination' :: ReportDestination -> Maybe [Text]
$sel:s3BucketName:ReportDestination' :: ReportDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3BucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
s3Keys

instance Prelude.NFData ReportDestination where
  rnf :: ReportDestination -> ()
rnf ReportDestination' {Maybe [Text]
Maybe Text
s3Keys :: Maybe [Text]
s3BucketName :: Maybe Text
$sel:s3Keys:ReportDestination' :: ReportDestination -> Maybe [Text]
$sel:s3BucketName:ReportDestination' :: ReportDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3BucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
s3Keys