{-# 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.LakeFormation.Types.StorageOptimizer
-- 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.LakeFormation.Types.StorageOptimizer where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types.OptimizerType
import qualified Amazonka.Prelude as Prelude

-- | A structure describing the configuration and details of a storage
-- optimizer.
--
-- /See:/ 'newStorageOptimizer' smart constructor.
data StorageOptimizer = StorageOptimizer'
  { -- | A map of the storage optimizer configuration. Currently contains only
    -- one key-value pair: @is_enabled@ indicates true or false for
    -- acceleration.
    StorageOptimizer -> Maybe (HashMap Text Text)
config :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A message that contains information about any error (if present).
    --
    -- When an acceleration result has an enabled status, the error message is
    -- empty.
    --
    -- When an acceleration result has a disabled status, the message describes
    -- an error or simply indicates \"disabled by the user\".
    StorageOptimizer -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text,
    -- | When an acceleration result has an enabled status, contains the details
    -- of the last job run.
    StorageOptimizer -> Maybe Text
lastRunDetails :: Prelude.Maybe Prelude.Text,
    -- | The specific type of storage optimizer. The supported value is
    -- @compaction@.
    StorageOptimizer -> Maybe OptimizerType
storageOptimizerType :: Prelude.Maybe OptimizerType,
    -- | A message that contains information about any warnings (if present).
    StorageOptimizer -> Maybe Text
warnings :: Prelude.Maybe Prelude.Text
  }
  deriving (StorageOptimizer -> StorageOptimizer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StorageOptimizer -> StorageOptimizer -> Bool
$c/= :: StorageOptimizer -> StorageOptimizer -> Bool
== :: StorageOptimizer -> StorageOptimizer -> Bool
$c== :: StorageOptimizer -> StorageOptimizer -> Bool
Prelude.Eq, ReadPrec [StorageOptimizer]
ReadPrec StorageOptimizer
Int -> ReadS StorageOptimizer
ReadS [StorageOptimizer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StorageOptimizer]
$creadListPrec :: ReadPrec [StorageOptimizer]
readPrec :: ReadPrec StorageOptimizer
$creadPrec :: ReadPrec StorageOptimizer
readList :: ReadS [StorageOptimizer]
$creadList :: ReadS [StorageOptimizer]
readsPrec :: Int -> ReadS StorageOptimizer
$creadsPrec :: Int -> ReadS StorageOptimizer
Prelude.Read, Int -> StorageOptimizer -> ShowS
[StorageOptimizer] -> ShowS
StorageOptimizer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StorageOptimizer] -> ShowS
$cshowList :: [StorageOptimizer] -> ShowS
show :: StorageOptimizer -> String
$cshow :: StorageOptimizer -> String
showsPrec :: Int -> StorageOptimizer -> ShowS
$cshowsPrec :: Int -> StorageOptimizer -> ShowS
Prelude.Show, forall x. Rep StorageOptimizer x -> StorageOptimizer
forall x. StorageOptimizer -> Rep StorageOptimizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StorageOptimizer x -> StorageOptimizer
$cfrom :: forall x. StorageOptimizer -> Rep StorageOptimizer x
Prelude.Generic)

-- |
-- Create a value of 'StorageOptimizer' 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:
--
-- 'config', 'storageOptimizer_config' - A map of the storage optimizer configuration. Currently contains only
-- one key-value pair: @is_enabled@ indicates true or false for
-- acceleration.
--
-- 'errorMessage', 'storageOptimizer_errorMessage' - A message that contains information about any error (if present).
--
-- When an acceleration result has an enabled status, the error message is
-- empty.
--
-- When an acceleration result has a disabled status, the message describes
-- an error or simply indicates \"disabled by the user\".
--
-- 'lastRunDetails', 'storageOptimizer_lastRunDetails' - When an acceleration result has an enabled status, contains the details
-- of the last job run.
--
-- 'storageOptimizerType', 'storageOptimizer_storageOptimizerType' - The specific type of storage optimizer. The supported value is
-- @compaction@.
--
-- 'warnings', 'storageOptimizer_warnings' - A message that contains information about any warnings (if present).
newStorageOptimizer ::
  StorageOptimizer
newStorageOptimizer :: StorageOptimizer
newStorageOptimizer =
  StorageOptimizer'
    { $sel:config:StorageOptimizer' :: Maybe (HashMap Text Text)
config = forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:StorageOptimizer' :: Maybe Text
errorMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:lastRunDetails:StorageOptimizer' :: Maybe Text
lastRunDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:storageOptimizerType:StorageOptimizer' :: Maybe OptimizerType
storageOptimizerType = forall a. Maybe a
Prelude.Nothing,
      $sel:warnings:StorageOptimizer' :: Maybe Text
warnings = forall a. Maybe a
Prelude.Nothing
    }

-- | A map of the storage optimizer configuration. Currently contains only
-- one key-value pair: @is_enabled@ indicates true or false for
-- acceleration.
storageOptimizer_config :: Lens.Lens' StorageOptimizer (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
storageOptimizer_config :: Lens' StorageOptimizer (Maybe (HashMap Text Text))
storageOptimizer_config = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageOptimizer' {Maybe (HashMap Text Text)
config :: Maybe (HashMap Text Text)
$sel:config:StorageOptimizer' :: StorageOptimizer -> Maybe (HashMap Text Text)
config} -> Maybe (HashMap Text Text)
config) (\s :: StorageOptimizer
s@StorageOptimizer' {} Maybe (HashMap Text Text)
a -> StorageOptimizer
s {$sel:config:StorageOptimizer' :: Maybe (HashMap Text Text)
config = Maybe (HashMap Text Text)
a} :: StorageOptimizer) 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

-- | A message that contains information about any error (if present).
--
-- When an acceleration result has an enabled status, the error message is
-- empty.
--
-- When an acceleration result has a disabled status, the message describes
-- an error or simply indicates \"disabled by the user\".
storageOptimizer_errorMessage :: Lens.Lens' StorageOptimizer (Prelude.Maybe Prelude.Text)
storageOptimizer_errorMessage :: Lens' StorageOptimizer (Maybe Text)
storageOptimizer_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageOptimizer' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:StorageOptimizer' :: StorageOptimizer -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: StorageOptimizer
s@StorageOptimizer' {} Maybe Text
a -> StorageOptimizer
s {$sel:errorMessage:StorageOptimizer' :: Maybe Text
errorMessage = Maybe Text
a} :: StorageOptimizer)

-- | When an acceleration result has an enabled status, contains the details
-- of the last job run.
storageOptimizer_lastRunDetails :: Lens.Lens' StorageOptimizer (Prelude.Maybe Prelude.Text)
storageOptimizer_lastRunDetails :: Lens' StorageOptimizer (Maybe Text)
storageOptimizer_lastRunDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageOptimizer' {Maybe Text
lastRunDetails :: Maybe Text
$sel:lastRunDetails:StorageOptimizer' :: StorageOptimizer -> Maybe Text
lastRunDetails} -> Maybe Text
lastRunDetails) (\s :: StorageOptimizer
s@StorageOptimizer' {} Maybe Text
a -> StorageOptimizer
s {$sel:lastRunDetails:StorageOptimizer' :: Maybe Text
lastRunDetails = Maybe Text
a} :: StorageOptimizer)

-- | The specific type of storage optimizer. The supported value is
-- @compaction@.
storageOptimizer_storageOptimizerType :: Lens.Lens' StorageOptimizer (Prelude.Maybe OptimizerType)
storageOptimizer_storageOptimizerType :: Lens' StorageOptimizer (Maybe OptimizerType)
storageOptimizer_storageOptimizerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageOptimizer' {Maybe OptimizerType
storageOptimizerType :: Maybe OptimizerType
$sel:storageOptimizerType:StorageOptimizer' :: StorageOptimizer -> Maybe OptimizerType
storageOptimizerType} -> Maybe OptimizerType
storageOptimizerType) (\s :: StorageOptimizer
s@StorageOptimizer' {} Maybe OptimizerType
a -> StorageOptimizer
s {$sel:storageOptimizerType:StorageOptimizer' :: Maybe OptimizerType
storageOptimizerType = Maybe OptimizerType
a} :: StorageOptimizer)

-- | A message that contains information about any warnings (if present).
storageOptimizer_warnings :: Lens.Lens' StorageOptimizer (Prelude.Maybe Prelude.Text)
storageOptimizer_warnings :: Lens' StorageOptimizer (Maybe Text)
storageOptimizer_warnings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StorageOptimizer' {Maybe Text
warnings :: Maybe Text
$sel:warnings:StorageOptimizer' :: StorageOptimizer -> Maybe Text
warnings} -> Maybe Text
warnings) (\s :: StorageOptimizer
s@StorageOptimizer' {} Maybe Text
a -> StorageOptimizer
s {$sel:warnings:StorageOptimizer' :: Maybe Text
warnings = Maybe Text
a} :: StorageOptimizer)

instance Data.FromJSON StorageOptimizer where
  parseJSON :: Value -> Parser StorageOptimizer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StorageOptimizer"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe OptimizerType
-> Maybe Text
-> StorageOptimizer
StorageOptimizer'
            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
"Config" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ErrorMessage")
            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
"LastRunDetails")
            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
"StorageOptimizerType")
            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
"Warnings")
      )

instance Prelude.Hashable StorageOptimizer where
  hashWithSalt :: Int -> StorageOptimizer -> Int
hashWithSalt Int
_salt StorageOptimizer' {Maybe Text
Maybe (HashMap Text Text)
Maybe OptimizerType
warnings :: Maybe Text
storageOptimizerType :: Maybe OptimizerType
lastRunDetails :: Maybe Text
errorMessage :: Maybe Text
config :: Maybe (HashMap Text Text)
$sel:warnings:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:storageOptimizerType:StorageOptimizer' :: StorageOptimizer -> Maybe OptimizerType
$sel:lastRunDetails:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:errorMessage:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:config:StorageOptimizer' :: StorageOptimizer -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
config
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
errorMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastRunDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OptimizerType
storageOptimizerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
warnings

instance Prelude.NFData StorageOptimizer where
  rnf :: StorageOptimizer -> ()
rnf StorageOptimizer' {Maybe Text
Maybe (HashMap Text Text)
Maybe OptimizerType
warnings :: Maybe Text
storageOptimizerType :: Maybe OptimizerType
lastRunDetails :: Maybe Text
errorMessage :: Maybe Text
config :: Maybe (HashMap Text Text)
$sel:warnings:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:storageOptimizerType:StorageOptimizer' :: StorageOptimizer -> Maybe OptimizerType
$sel:lastRunDetails:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:errorMessage:StorageOptimizer' :: StorageOptimizer -> Maybe Text
$sel:config:StorageOptimizer' :: StorageOptimizer -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
config
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
errorMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastRunDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OptimizerType
storageOptimizerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
warnings