{-# 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.StorageClassAnalysis
-- 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.StorageClassAnalysis 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.StorageClassAnalysisDataExport

-- | Specifies data related to access patterns to be collected and made
-- available to analyze the tradeoffs between different storage classes for
-- an Amazon S3 bucket.
--
-- /See:/ 'newStorageClassAnalysis' smart constructor.
data StorageClassAnalysis = StorageClassAnalysis'
  { -- | Specifies how data related to the storage class analysis for an Amazon
    -- S3 bucket should be exported.
    StorageClassAnalysis -> Maybe StorageClassAnalysisDataExport
dataExport :: Prelude.Maybe StorageClassAnalysisDataExport
  }
  deriving (StorageClassAnalysis -> StorageClassAnalysis -> Bool
(StorageClassAnalysis -> StorageClassAnalysis -> Bool)
-> (StorageClassAnalysis -> StorageClassAnalysis -> Bool)
-> Eq StorageClassAnalysis
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageClassAnalysis -> StorageClassAnalysis -> Bool
$c/= :: StorageClassAnalysis -> StorageClassAnalysis -> Bool
== :: StorageClassAnalysis -> StorageClassAnalysis -> Bool
$c== :: StorageClassAnalysis -> StorageClassAnalysis -> Bool
Prelude.Eq, ReadPrec [StorageClassAnalysis]
ReadPrec StorageClassAnalysis
Int -> ReadS StorageClassAnalysis
ReadS [StorageClassAnalysis]
(Int -> ReadS StorageClassAnalysis)
-> ReadS [StorageClassAnalysis]
-> ReadPrec StorageClassAnalysis
-> ReadPrec [StorageClassAnalysis]
-> Read StorageClassAnalysis
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageClassAnalysis]
$creadListPrec :: ReadPrec [StorageClassAnalysis]
readPrec :: ReadPrec StorageClassAnalysis
$creadPrec :: ReadPrec StorageClassAnalysis
readList :: ReadS [StorageClassAnalysis]
$creadList :: ReadS [StorageClassAnalysis]
readsPrec :: Int -> ReadS StorageClassAnalysis
$creadsPrec :: Int -> ReadS StorageClassAnalysis
Prelude.Read, Int -> StorageClassAnalysis -> ShowS
[StorageClassAnalysis] -> ShowS
StorageClassAnalysis -> String
(Int -> StorageClassAnalysis -> ShowS)
-> (StorageClassAnalysis -> String)
-> ([StorageClassAnalysis] -> ShowS)
-> Show StorageClassAnalysis
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageClassAnalysis] -> ShowS
$cshowList :: [StorageClassAnalysis] -> ShowS
show :: StorageClassAnalysis -> String
$cshow :: StorageClassAnalysis -> String
showsPrec :: Int -> StorageClassAnalysis -> ShowS
$cshowsPrec :: Int -> StorageClassAnalysis -> ShowS
Prelude.Show, (forall x. StorageClassAnalysis -> Rep StorageClassAnalysis x)
-> (forall x. Rep StorageClassAnalysis x -> StorageClassAnalysis)
-> Generic StorageClassAnalysis
forall x. Rep StorageClassAnalysis x -> StorageClassAnalysis
forall x. StorageClassAnalysis -> Rep StorageClassAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StorageClassAnalysis x -> StorageClassAnalysis
$cfrom :: forall x. StorageClassAnalysis -> Rep StorageClassAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'StorageClassAnalysis' 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:
--
-- 'dataExport', 'storageClassAnalysis_dataExport' - Specifies how data related to the storage class analysis for an Amazon
-- S3 bucket should be exported.
newStorageClassAnalysis ::
  StorageClassAnalysis
newStorageClassAnalysis :: StorageClassAnalysis
newStorageClassAnalysis =
  StorageClassAnalysis' :: Maybe StorageClassAnalysisDataExport -> StorageClassAnalysis
StorageClassAnalysis' {$sel:dataExport:StorageClassAnalysis' :: Maybe StorageClassAnalysisDataExport
dataExport = Maybe StorageClassAnalysisDataExport
forall a. Maybe a
Prelude.Nothing}

-- | Specifies how data related to the storage class analysis for an Amazon
-- S3 bucket should be exported.
storageClassAnalysis_dataExport :: Lens.Lens' StorageClassAnalysis (Prelude.Maybe StorageClassAnalysisDataExport)
storageClassAnalysis_dataExport :: (Maybe StorageClassAnalysisDataExport
 -> f (Maybe StorageClassAnalysisDataExport))
-> StorageClassAnalysis -> f StorageClassAnalysis
storageClassAnalysis_dataExport = (StorageClassAnalysis -> Maybe StorageClassAnalysisDataExport)
-> (StorageClassAnalysis
    -> Maybe StorageClassAnalysisDataExport -> StorageClassAnalysis)
-> Lens
     StorageClassAnalysis
     StorageClassAnalysis
     (Maybe StorageClassAnalysisDataExport)
     (Maybe StorageClassAnalysisDataExport)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageClassAnalysis' {Maybe StorageClassAnalysisDataExport
dataExport :: Maybe StorageClassAnalysisDataExport
$sel:dataExport:StorageClassAnalysis' :: StorageClassAnalysis -> Maybe StorageClassAnalysisDataExport
dataExport} -> Maybe StorageClassAnalysisDataExport
dataExport) (\s :: StorageClassAnalysis
s@StorageClassAnalysis' {} Maybe StorageClassAnalysisDataExport
a -> StorageClassAnalysis
s {$sel:dataExport:StorageClassAnalysis' :: Maybe StorageClassAnalysisDataExport
dataExport = Maybe StorageClassAnalysisDataExport
a} :: StorageClassAnalysis)

instance Core.FromXML StorageClassAnalysis where
  parseXML :: [Node] -> Either String StorageClassAnalysis
parseXML [Node]
x =
    Maybe StorageClassAnalysisDataExport -> StorageClassAnalysis
StorageClassAnalysis'
      (Maybe StorageClassAnalysisDataExport -> StorageClassAnalysis)
-> Either String (Maybe StorageClassAnalysisDataExport)
-> Either String StorageClassAnalysis
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node]
-> Text -> Either String (Maybe StorageClassAnalysisDataExport)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DataExport")

instance Prelude.Hashable StorageClassAnalysis

instance Prelude.NFData StorageClassAnalysis

instance Core.ToXML StorageClassAnalysis where
  toXML :: StorageClassAnalysis -> XML
toXML StorageClassAnalysis' {Maybe StorageClassAnalysisDataExport
dataExport :: Maybe StorageClassAnalysisDataExport
$sel:dataExport:StorageClassAnalysis' :: StorageClassAnalysis -> Maybe StorageClassAnalysisDataExport
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"DataExport" Name -> Maybe StorageClassAnalysisDataExport -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe StorageClassAnalysisDataExport
dataExport]