{-# 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.StorageClassAnalysisDataExport
-- 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.StorageClassAnalysisDataExport 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.AnalyticsExportDestination
import Amazonka.S3.Types.StorageClassAnalysisSchemaVersion

-- | Container for data related to the storage class analysis for an Amazon
-- S3 bucket for export.
--
-- /See:/ 'newStorageClassAnalysisDataExport' smart constructor.
data StorageClassAnalysisDataExport = StorageClassAnalysisDataExport'
  { -- | The version of the output schema to use when exporting data. Must be
    -- @V_1@.
    StorageClassAnalysisDataExport -> StorageClassAnalysisSchemaVersion
outputSchemaVersion :: StorageClassAnalysisSchemaVersion,
    -- | The place to store the data for an analysis.
    StorageClassAnalysisDataExport -> AnalyticsExportDestination
destination :: AnalyticsExportDestination
  }
  deriving (StorageClassAnalysisDataExport
-> StorageClassAnalysisDataExport -> Bool
(StorageClassAnalysisDataExport
 -> StorageClassAnalysisDataExport -> Bool)
-> (StorageClassAnalysisDataExport
    -> StorageClassAnalysisDataExport -> Bool)
-> Eq StorageClassAnalysisDataExport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageClassAnalysisDataExport
-> StorageClassAnalysisDataExport -> Bool
$c/= :: StorageClassAnalysisDataExport
-> StorageClassAnalysisDataExport -> Bool
== :: StorageClassAnalysisDataExport
-> StorageClassAnalysisDataExport -> Bool
$c== :: StorageClassAnalysisDataExport
-> StorageClassAnalysisDataExport -> Bool
Prelude.Eq, ReadPrec [StorageClassAnalysisDataExport]
ReadPrec StorageClassAnalysisDataExport
Int -> ReadS StorageClassAnalysisDataExport
ReadS [StorageClassAnalysisDataExport]
(Int -> ReadS StorageClassAnalysisDataExport)
-> ReadS [StorageClassAnalysisDataExport]
-> ReadPrec StorageClassAnalysisDataExport
-> ReadPrec [StorageClassAnalysisDataExport]
-> Read StorageClassAnalysisDataExport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageClassAnalysisDataExport]
$creadListPrec :: ReadPrec [StorageClassAnalysisDataExport]
readPrec :: ReadPrec StorageClassAnalysisDataExport
$creadPrec :: ReadPrec StorageClassAnalysisDataExport
readList :: ReadS [StorageClassAnalysisDataExport]
$creadList :: ReadS [StorageClassAnalysisDataExport]
readsPrec :: Int -> ReadS StorageClassAnalysisDataExport
$creadsPrec :: Int -> ReadS StorageClassAnalysisDataExport
Prelude.Read, Int -> StorageClassAnalysisDataExport -> ShowS
[StorageClassAnalysisDataExport] -> ShowS
StorageClassAnalysisDataExport -> String
(Int -> StorageClassAnalysisDataExport -> ShowS)
-> (StorageClassAnalysisDataExport -> String)
-> ([StorageClassAnalysisDataExport] -> ShowS)
-> Show StorageClassAnalysisDataExport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageClassAnalysisDataExport] -> ShowS
$cshowList :: [StorageClassAnalysisDataExport] -> ShowS
show :: StorageClassAnalysisDataExport -> String
$cshow :: StorageClassAnalysisDataExport -> String
showsPrec :: Int -> StorageClassAnalysisDataExport -> ShowS
$cshowsPrec :: Int -> StorageClassAnalysisDataExport -> ShowS
Prelude.Show, (forall x.
 StorageClassAnalysisDataExport
 -> Rep StorageClassAnalysisDataExport x)
-> (forall x.
    Rep StorageClassAnalysisDataExport x
    -> StorageClassAnalysisDataExport)
-> Generic StorageClassAnalysisDataExport
forall x.
Rep StorageClassAnalysisDataExport x
-> StorageClassAnalysisDataExport
forall x.
StorageClassAnalysisDataExport
-> Rep StorageClassAnalysisDataExport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StorageClassAnalysisDataExport x
-> StorageClassAnalysisDataExport
$cfrom :: forall x.
StorageClassAnalysisDataExport
-> Rep StorageClassAnalysisDataExport x
Prelude.Generic)

-- |
-- Create a value of 'StorageClassAnalysisDataExport' 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:
--
-- 'outputSchemaVersion', 'storageClassAnalysisDataExport_outputSchemaVersion' - The version of the output schema to use when exporting data. Must be
-- @V_1@.
--
-- 'destination', 'storageClassAnalysisDataExport_destination' - The place to store the data for an analysis.
newStorageClassAnalysisDataExport ::
  -- | 'outputSchemaVersion'
  StorageClassAnalysisSchemaVersion ->
  -- | 'destination'
  AnalyticsExportDestination ->
  StorageClassAnalysisDataExport
newStorageClassAnalysisDataExport :: StorageClassAnalysisSchemaVersion
-> AnalyticsExportDestination -> StorageClassAnalysisDataExport
newStorageClassAnalysisDataExport
  StorageClassAnalysisSchemaVersion
pOutputSchemaVersion_
  AnalyticsExportDestination
pDestination_ =
    StorageClassAnalysisDataExport' :: StorageClassAnalysisSchemaVersion
-> AnalyticsExportDestination -> StorageClassAnalysisDataExport
StorageClassAnalysisDataExport'
      { $sel:outputSchemaVersion:StorageClassAnalysisDataExport' :: StorageClassAnalysisSchemaVersion
outputSchemaVersion =
          StorageClassAnalysisSchemaVersion
pOutputSchemaVersion_,
        $sel:destination:StorageClassAnalysisDataExport' :: AnalyticsExportDestination
destination = AnalyticsExportDestination
pDestination_
      }

-- | The version of the output schema to use when exporting data. Must be
-- @V_1@.
storageClassAnalysisDataExport_outputSchemaVersion :: Lens.Lens' StorageClassAnalysisDataExport StorageClassAnalysisSchemaVersion
storageClassAnalysisDataExport_outputSchemaVersion :: (StorageClassAnalysisSchemaVersion
 -> f StorageClassAnalysisSchemaVersion)
-> StorageClassAnalysisDataExport
-> f StorageClassAnalysisDataExport
storageClassAnalysisDataExport_outputSchemaVersion = (StorageClassAnalysisDataExport
 -> StorageClassAnalysisSchemaVersion)
-> (StorageClassAnalysisDataExport
    -> StorageClassAnalysisSchemaVersion
    -> StorageClassAnalysisDataExport)
-> Lens
     StorageClassAnalysisDataExport
     StorageClassAnalysisDataExport
     StorageClassAnalysisSchemaVersion
     StorageClassAnalysisSchemaVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageClassAnalysisDataExport' {StorageClassAnalysisSchemaVersion
outputSchemaVersion :: StorageClassAnalysisSchemaVersion
$sel:outputSchemaVersion:StorageClassAnalysisDataExport' :: StorageClassAnalysisDataExport -> StorageClassAnalysisSchemaVersion
outputSchemaVersion} -> StorageClassAnalysisSchemaVersion
outputSchemaVersion) (\s :: StorageClassAnalysisDataExport
s@StorageClassAnalysisDataExport' {} StorageClassAnalysisSchemaVersion
a -> StorageClassAnalysisDataExport
s {$sel:outputSchemaVersion:StorageClassAnalysisDataExport' :: StorageClassAnalysisSchemaVersion
outputSchemaVersion = StorageClassAnalysisSchemaVersion
a} :: StorageClassAnalysisDataExport)

-- | The place to store the data for an analysis.
storageClassAnalysisDataExport_destination :: Lens.Lens' StorageClassAnalysisDataExport AnalyticsExportDestination
storageClassAnalysisDataExport_destination :: (AnalyticsExportDestination -> f AnalyticsExportDestination)
-> StorageClassAnalysisDataExport
-> f StorageClassAnalysisDataExport
storageClassAnalysisDataExport_destination = (StorageClassAnalysisDataExport -> AnalyticsExportDestination)
-> (StorageClassAnalysisDataExport
    -> AnalyticsExportDestination -> StorageClassAnalysisDataExport)
-> Lens
     StorageClassAnalysisDataExport
     StorageClassAnalysisDataExport
     AnalyticsExportDestination
     AnalyticsExportDestination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageClassAnalysisDataExport' {AnalyticsExportDestination
destination :: AnalyticsExportDestination
$sel:destination:StorageClassAnalysisDataExport' :: StorageClassAnalysisDataExport -> AnalyticsExportDestination
destination} -> AnalyticsExportDestination
destination) (\s :: StorageClassAnalysisDataExport
s@StorageClassAnalysisDataExport' {} AnalyticsExportDestination
a -> StorageClassAnalysisDataExport
s {$sel:destination:StorageClassAnalysisDataExport' :: AnalyticsExportDestination
destination = AnalyticsExportDestination
a} :: StorageClassAnalysisDataExport)

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

instance
  Prelude.Hashable
    StorageClassAnalysisDataExport

instance
  Prelude.NFData
    StorageClassAnalysisDataExport

instance Core.ToXML StorageClassAnalysisDataExport where
  toXML :: StorageClassAnalysisDataExport -> XML
toXML StorageClassAnalysisDataExport' {AnalyticsExportDestination
StorageClassAnalysisSchemaVersion
destination :: AnalyticsExportDestination
outputSchemaVersion :: StorageClassAnalysisSchemaVersion
$sel:destination:StorageClassAnalysisDataExport' :: StorageClassAnalysisDataExport -> AnalyticsExportDestination
$sel:outputSchemaVersion:StorageClassAnalysisDataExport' :: StorageClassAnalysisDataExport -> StorageClassAnalysisSchemaVersion
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"OutputSchemaVersion" Name -> StorageClassAnalysisSchemaVersion -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= StorageClassAnalysisSchemaVersion
outputSchemaVersion,
        Name
"Destination" Name -> AnalyticsExportDestination -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= AnalyticsExportDestination
destination
      ]