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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information from your report job about your report destination.
--
-- /See:/ 'newReportDestination' smart constructor.
data ReportDestination = ReportDestination'
  { -- | The object key that uniquely identifies your reports in your S3 bucket.
    ReportDestination -> Maybe [Text]
s3Keys :: Prelude.Maybe [Prelude.Text],
    -- | The unique name of the Amazon S3 bucket that receives your reports.
    ReportDestination -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text
  }
  deriving (ReportDestination -> ReportDestination -> Bool
(ReportDestination -> ReportDestination -> Bool)
-> (ReportDestination -> ReportDestination -> Bool)
-> Eq ReportDestination
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]
(Int -> ReadS ReportDestination)
-> ReadS [ReportDestination]
-> ReadPrec ReportDestination
-> ReadPrec [ReportDestination]
-> Read 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
(Int -> ReportDestination -> ShowS)
-> (ReportDestination -> String)
-> ([ReportDestination] -> ShowS)
-> Show ReportDestination
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. ReportDestination -> Rep ReportDestination x)
-> (forall x. Rep ReportDestination x -> ReportDestination)
-> Generic ReportDestination
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:
--
-- 's3Keys', 'reportDestination_s3Keys' - The object key that uniquely identifies your reports in your S3 bucket.
--
-- 's3BucketName', 'reportDestination_s3BucketName' - The unique name of the Amazon S3 bucket that receives your reports.
newReportDestination ::
  ReportDestination
newReportDestination :: ReportDestination
newReportDestination =
  ReportDestination' :: Maybe [Text] -> Maybe Text -> ReportDestination
ReportDestination'
    { $sel:s3Keys:ReportDestination' :: Maybe [Text]
s3Keys = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:ReportDestination' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The object key that uniquely identifies your reports in your S3 bucket.
reportDestination_s3Keys :: Lens.Lens' ReportDestination (Prelude.Maybe [Prelude.Text])
reportDestination_s3Keys :: (Maybe [Text] -> f (Maybe [Text]))
-> ReportDestination -> f ReportDestination
reportDestination_s3Keys = (ReportDestination -> Maybe [Text])
-> (ReportDestination -> Maybe [Text] -> ReportDestination)
-> Lens
     ReportDestination ReportDestination (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> ReportDestination -> f ReportDestination)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ReportDestination
-> f ReportDestination
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique name of the Amazon S3 bucket that receives your reports.
reportDestination_s3BucketName :: Lens.Lens' ReportDestination (Prelude.Maybe Prelude.Text)
reportDestination_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> ReportDestination -> f ReportDestination
reportDestination_s3BucketName = (ReportDestination -> Maybe Text)
-> (ReportDestination -> Maybe Text -> ReportDestination)
-> Lens
     ReportDestination ReportDestination (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable ReportDestination

instance Prelude.NFData ReportDestination