{-# 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.DynamoDB.Types.TimeToLiveDescription
-- 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.DynamoDB.Types.TimeToLiveDescription where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.TimeToLiveStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The description of the Time to Live (TTL) status on the specified table.
--
-- /See:/ 'newTimeToLiveDescription' smart constructor.
data TimeToLiveDescription = TimeToLiveDescription'
  { -- | The TTL status for the table.
    TimeToLiveDescription -> Maybe TimeToLiveStatus
timeToLiveStatus :: Prelude.Maybe TimeToLiveStatus,
    -- | The name of the TTL attribute for items in the table.
    TimeToLiveDescription -> Maybe Text
attributeName :: Prelude.Maybe Prelude.Text
  }
  deriving (TimeToLiveDescription -> TimeToLiveDescription -> Bool
(TimeToLiveDescription -> TimeToLiveDescription -> Bool)
-> (TimeToLiveDescription -> TimeToLiveDescription -> Bool)
-> Eq TimeToLiveDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimeToLiveDescription -> TimeToLiveDescription -> Bool
$c/= :: TimeToLiveDescription -> TimeToLiveDescription -> Bool
== :: TimeToLiveDescription -> TimeToLiveDescription -> Bool
$c== :: TimeToLiveDescription -> TimeToLiveDescription -> Bool
Prelude.Eq, ReadPrec [TimeToLiveDescription]
ReadPrec TimeToLiveDescription
Int -> ReadS TimeToLiveDescription
ReadS [TimeToLiveDescription]
(Int -> ReadS TimeToLiveDescription)
-> ReadS [TimeToLiveDescription]
-> ReadPrec TimeToLiveDescription
-> ReadPrec [TimeToLiveDescription]
-> Read TimeToLiveDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimeToLiveDescription]
$creadListPrec :: ReadPrec [TimeToLiveDescription]
readPrec :: ReadPrec TimeToLiveDescription
$creadPrec :: ReadPrec TimeToLiveDescription
readList :: ReadS [TimeToLiveDescription]
$creadList :: ReadS [TimeToLiveDescription]
readsPrec :: Int -> ReadS TimeToLiveDescription
$creadsPrec :: Int -> ReadS TimeToLiveDescription
Prelude.Read, Int -> TimeToLiveDescription -> ShowS
[TimeToLiveDescription] -> ShowS
TimeToLiveDescription -> String
(Int -> TimeToLiveDescription -> ShowS)
-> (TimeToLiveDescription -> String)
-> ([TimeToLiveDescription] -> ShowS)
-> Show TimeToLiveDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimeToLiveDescription] -> ShowS
$cshowList :: [TimeToLiveDescription] -> ShowS
show :: TimeToLiveDescription -> String
$cshow :: TimeToLiveDescription -> String
showsPrec :: Int -> TimeToLiveDescription -> ShowS
$cshowsPrec :: Int -> TimeToLiveDescription -> ShowS
Prelude.Show, (forall x. TimeToLiveDescription -> Rep TimeToLiveDescription x)
-> (forall x. Rep TimeToLiveDescription x -> TimeToLiveDescription)
-> Generic TimeToLiveDescription
forall x. Rep TimeToLiveDescription x -> TimeToLiveDescription
forall x. TimeToLiveDescription -> Rep TimeToLiveDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimeToLiveDescription x -> TimeToLiveDescription
$cfrom :: forall x. TimeToLiveDescription -> Rep TimeToLiveDescription x
Prelude.Generic)

-- |
-- Create a value of 'TimeToLiveDescription' 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:
--
-- 'timeToLiveStatus', 'timeToLiveDescription_timeToLiveStatus' - The TTL status for the table.
--
-- 'attributeName', 'timeToLiveDescription_attributeName' - The name of the TTL attribute for items in the table.
newTimeToLiveDescription ::
  TimeToLiveDescription
newTimeToLiveDescription :: TimeToLiveDescription
newTimeToLiveDescription =
  TimeToLiveDescription' :: Maybe TimeToLiveStatus -> Maybe Text -> TimeToLiveDescription
TimeToLiveDescription'
    { $sel:timeToLiveStatus:TimeToLiveDescription' :: Maybe TimeToLiveStatus
timeToLiveStatus =
        Maybe TimeToLiveStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:attributeName:TimeToLiveDescription' :: Maybe Text
attributeName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The TTL status for the table.
timeToLiveDescription_timeToLiveStatus :: Lens.Lens' TimeToLiveDescription (Prelude.Maybe TimeToLiveStatus)
timeToLiveDescription_timeToLiveStatus :: (Maybe TimeToLiveStatus -> f (Maybe TimeToLiveStatus))
-> TimeToLiveDescription -> f TimeToLiveDescription
timeToLiveDescription_timeToLiveStatus = (TimeToLiveDescription -> Maybe TimeToLiveStatus)
-> (TimeToLiveDescription
    -> Maybe TimeToLiveStatus -> TimeToLiveDescription)
-> Lens
     TimeToLiveDescription
     TimeToLiveDescription
     (Maybe TimeToLiveStatus)
     (Maybe TimeToLiveStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeToLiveDescription' {Maybe TimeToLiveStatus
timeToLiveStatus :: Maybe TimeToLiveStatus
$sel:timeToLiveStatus:TimeToLiveDescription' :: TimeToLiveDescription -> Maybe TimeToLiveStatus
timeToLiveStatus} -> Maybe TimeToLiveStatus
timeToLiveStatus) (\s :: TimeToLiveDescription
s@TimeToLiveDescription' {} Maybe TimeToLiveStatus
a -> TimeToLiveDescription
s {$sel:timeToLiveStatus:TimeToLiveDescription' :: Maybe TimeToLiveStatus
timeToLiveStatus = Maybe TimeToLiveStatus
a} :: TimeToLiveDescription)

-- | The name of the TTL attribute for items in the table.
timeToLiveDescription_attributeName :: Lens.Lens' TimeToLiveDescription (Prelude.Maybe Prelude.Text)
timeToLiveDescription_attributeName :: (Maybe Text -> f (Maybe Text))
-> TimeToLiveDescription -> f TimeToLiveDescription
timeToLiveDescription_attributeName = (TimeToLiveDescription -> Maybe Text)
-> (TimeToLiveDescription -> Maybe Text -> TimeToLiveDescription)
-> Lens
     TimeToLiveDescription
     TimeToLiveDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimeToLiveDescription' {Maybe Text
attributeName :: Maybe Text
$sel:attributeName:TimeToLiveDescription' :: TimeToLiveDescription -> Maybe Text
attributeName} -> Maybe Text
attributeName) (\s :: TimeToLiveDescription
s@TimeToLiveDescription' {} Maybe Text
a -> TimeToLiveDescription
s {$sel:attributeName:TimeToLiveDescription' :: Maybe Text
attributeName = Maybe Text
a} :: TimeToLiveDescription)

instance Core.FromJSON TimeToLiveDescription where
  parseJSON :: Value -> Parser TimeToLiveDescription
parseJSON =
    String
-> (Object -> Parser TimeToLiveDescription)
-> Value
-> Parser TimeToLiveDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimeToLiveDescription"
      ( \Object
x ->
          Maybe TimeToLiveStatus -> Maybe Text -> TimeToLiveDescription
TimeToLiveDescription'
            (Maybe TimeToLiveStatus -> Maybe Text -> TimeToLiveDescription)
-> Parser (Maybe TimeToLiveStatus)
-> Parser (Maybe Text -> TimeToLiveDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TimeToLiveStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimeToLiveStatus")
            Parser (Maybe Text -> TimeToLiveDescription)
-> Parser (Maybe Text) -> Parser TimeToLiveDescription
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
"AttributeName")
      )

instance Prelude.Hashable TimeToLiveDescription

instance Prelude.NFData TimeToLiveDescription