{-# 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.S3.Types.AnalyticsExportDestination
-- 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.S3.Types.AnalyticsExportDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.AnalyticsS3BucketDestination

-- | Where to publish the analytics results.
--
-- /See:/ 'newAnalyticsExportDestination' smart constructor.
data AnalyticsExportDestination = AnalyticsExportDestination'
  { -- | A destination signifying output to an S3 bucket.
    AnalyticsExportDestination -> AnalyticsS3BucketDestination
s3BucketDestination :: AnalyticsS3BucketDestination
  }
  deriving (AnalyticsExportDestination -> AnalyticsExportDestination -> Bool
(AnalyticsExportDestination -> AnalyticsExportDestination -> Bool)
-> (AnalyticsExportDestination
    -> AnalyticsExportDestination -> Bool)
-> Eq AnalyticsExportDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnalyticsExportDestination -> AnalyticsExportDestination -> Bool
$c/= :: AnalyticsExportDestination -> AnalyticsExportDestination -> Bool
== :: AnalyticsExportDestination -> AnalyticsExportDestination -> Bool
$c== :: AnalyticsExportDestination -> AnalyticsExportDestination -> Bool
Prelude.Eq, ReadPrec [AnalyticsExportDestination]
ReadPrec AnalyticsExportDestination
Int -> ReadS AnalyticsExportDestination
ReadS [AnalyticsExportDestination]
(Int -> ReadS AnalyticsExportDestination)
-> ReadS [AnalyticsExportDestination]
-> ReadPrec AnalyticsExportDestination
-> ReadPrec [AnalyticsExportDestination]
-> Read AnalyticsExportDestination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AnalyticsExportDestination]
$creadListPrec :: ReadPrec [AnalyticsExportDestination]
readPrec :: ReadPrec AnalyticsExportDestination
$creadPrec :: ReadPrec AnalyticsExportDestination
readList :: ReadS [AnalyticsExportDestination]
$creadList :: ReadS [AnalyticsExportDestination]
readsPrec :: Int -> ReadS AnalyticsExportDestination
$creadsPrec :: Int -> ReadS AnalyticsExportDestination
Prelude.Read, Int -> AnalyticsExportDestination -> ShowS
[AnalyticsExportDestination] -> ShowS
AnalyticsExportDestination -> String
(Int -> AnalyticsExportDestination -> ShowS)
-> (AnalyticsExportDestination -> String)
-> ([AnalyticsExportDestination] -> ShowS)
-> Show AnalyticsExportDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnalyticsExportDestination] -> ShowS
$cshowList :: [AnalyticsExportDestination] -> ShowS
show :: AnalyticsExportDestination -> String
$cshow :: AnalyticsExportDestination -> String
showsPrec :: Int -> AnalyticsExportDestination -> ShowS
$cshowsPrec :: Int -> AnalyticsExportDestination -> ShowS
Prelude.Show, (forall x.
 AnalyticsExportDestination -> Rep AnalyticsExportDestination x)
-> (forall x.
    Rep AnalyticsExportDestination x -> AnalyticsExportDestination)
-> Generic AnalyticsExportDestination
forall x.
Rep AnalyticsExportDestination x -> AnalyticsExportDestination
forall x.
AnalyticsExportDestination -> Rep AnalyticsExportDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnalyticsExportDestination x -> AnalyticsExportDestination
$cfrom :: forall x.
AnalyticsExportDestination -> Rep AnalyticsExportDestination x
Prelude.Generic)

-- |
-- Create a value of 'AnalyticsExportDestination' 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:
--
-- 's3BucketDestination', 'analyticsExportDestination_s3BucketDestination' - A destination signifying output to an S3 bucket.
newAnalyticsExportDestination ::
  -- | 's3BucketDestination'
  AnalyticsS3BucketDestination ->
  AnalyticsExportDestination
newAnalyticsExportDestination :: AnalyticsS3BucketDestination -> AnalyticsExportDestination
newAnalyticsExportDestination AnalyticsS3BucketDestination
pS3BucketDestination_ =
  AnalyticsExportDestination' :: AnalyticsS3BucketDestination -> AnalyticsExportDestination
AnalyticsExportDestination'
    { $sel:s3BucketDestination:AnalyticsExportDestination' :: AnalyticsS3BucketDestination
s3BucketDestination =
        AnalyticsS3BucketDestination
pS3BucketDestination_
    }

-- | A destination signifying output to an S3 bucket.
analyticsExportDestination_s3BucketDestination :: Lens.Lens' AnalyticsExportDestination AnalyticsS3BucketDestination
analyticsExportDestination_s3BucketDestination :: (AnalyticsS3BucketDestination -> f AnalyticsS3BucketDestination)
-> AnalyticsExportDestination -> f AnalyticsExportDestination
analyticsExportDestination_s3BucketDestination = (AnalyticsExportDestination -> AnalyticsS3BucketDestination)
-> (AnalyticsExportDestination
    -> AnalyticsS3BucketDestination -> AnalyticsExportDestination)
-> Lens
     AnalyticsExportDestination
     AnalyticsExportDestination
     AnalyticsS3BucketDestination
     AnalyticsS3BucketDestination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AnalyticsExportDestination' {AnalyticsS3BucketDestination
s3BucketDestination :: AnalyticsS3BucketDestination
$sel:s3BucketDestination:AnalyticsExportDestination' :: AnalyticsExportDestination -> AnalyticsS3BucketDestination
s3BucketDestination} -> AnalyticsS3BucketDestination
s3BucketDestination) (\s :: AnalyticsExportDestination
s@AnalyticsExportDestination' {} AnalyticsS3BucketDestination
a -> AnalyticsExportDestination
s {$sel:s3BucketDestination:AnalyticsExportDestination' :: AnalyticsS3BucketDestination
s3BucketDestination = AnalyticsS3BucketDestination
a} :: AnalyticsExportDestination)

instance Core.FromXML AnalyticsExportDestination where
  parseXML :: [Node] -> Either String AnalyticsExportDestination
parseXML [Node]
x =
    AnalyticsS3BucketDestination -> AnalyticsExportDestination
AnalyticsExportDestination'
      (AnalyticsS3BucketDestination -> AnalyticsExportDestination)
-> Either String AnalyticsS3BucketDestination
-> Either String AnalyticsExportDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String AnalyticsS3BucketDestination
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"S3BucketDestination")

instance Prelude.Hashable AnalyticsExportDestination

instance Prelude.NFData AnalyticsExportDestination

instance Core.ToXML AnalyticsExportDestination where
  toXML :: AnalyticsExportDestination -> XML
toXML AnalyticsExportDestination' {AnalyticsS3BucketDestination
s3BucketDestination :: AnalyticsS3BucketDestination
$sel:s3BucketDestination:AnalyticsExportDestination' :: AnalyticsExportDestination -> AnalyticsS3BucketDestination
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"S3BucketDestination" Name -> AnalyticsS3BucketDestination -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= AnalyticsS3BucketDestination
s3BucketDestination]