{-# 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.SecurityHub.Types.AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-- 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.SecurityHub.Types.AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A transition rule that describes when noncurrent objects transition to a
-- specified storage class.
--
-- /See:/ 'newAwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' smart constructor.
data AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails = AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails'
  { -- | The number of days that an object is noncurrent before Amazon S3 can
    -- perform the associated action.
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Int
days :: Prelude.Maybe Prelude.Int,
    -- | The class of storage to change the object to after the object is
    -- noncurrent for the specified number of days.
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Text
storageClass :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Bool
(AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> Bool)
-> (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
    -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
    -> Bool)
-> Eq
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Bool
$c/= :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Bool
== :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Bool
$c== :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
(Int
 -> ReadS
      AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)
-> ReadS
     [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
-> ReadPrec
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> ReadPrec
     [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
-> Read
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
$creadListPrec :: ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
readPrec :: ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
$creadPrec :: ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
readList :: ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
$creadList :: ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
readsPrec :: Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
$creadsPrec :: Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
Prelude.Read, Int
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> ShowS
[AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
-> ShowS
AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> String
(Int
 -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> ShowS)
-> (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
    -> String)
-> ([AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
    -> ShowS)
-> Show
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
-> ShowS
$cshowList :: [AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails]
-> ShowS
show :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> String
$cshow :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> String
showsPrec :: Int
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> ShowS
$cshowsPrec :: Int
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> ShowS
Prelude.Show, (forall x.
 AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> Rep
      AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
      x)
-> (forall x.
    Rep
      AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
      x
    -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)
-> Generic
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
forall x.
Rep
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
  x
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
forall x.
AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Rep
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
  x
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
$cfrom :: forall x.
AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Rep
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     x
Prelude.Generic)

-- |
-- Create a value of 'AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' 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:
--
-- 'days', 'awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_days' - The number of days that an object is noncurrent before Amazon S3 can
-- perform the associated action.
--
-- 'storageClass', 'awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_storageClass' - The class of storage to change the object to after the object is
-- noncurrent for the specified number of days.
newAwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails ::
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
newAwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
newAwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails =
  AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: Maybe Int
-> Maybe Text
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails'
    { $sel:days:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: Maybe Int
days =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: Maybe Text
storageClass =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of days that an object is noncurrent before Amazon S3 can
-- perform the associated action.
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_days :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails (Prelude.Maybe Prelude.Int)
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_days :: (Maybe Int -> f (Maybe Int))
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> f AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_days = (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> Maybe Int)
-> (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
    -> Maybe Int
    -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' {Maybe Int
days :: Maybe Int
$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Int
days} -> Maybe Int
days) (\s :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
s@AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' {} Maybe Int
a -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
s {$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: Maybe Int
days = Maybe Int
a} :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)

-- | The class of storage to change the object to after the object is
-- noncurrent for the specified number of days.
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_storageClass :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails (Prelude.Maybe Prelude.Text)
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_storageClass :: (Maybe Text -> f (Maybe Text))
-> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> f AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
awsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails_storageClass = (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
 -> Maybe Text)
-> (AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
    -> Maybe Text
    -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' {Maybe Text
storageClass :: Maybe Text
$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Text
storageClass} -> Maybe Text
storageClass) (\s :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
s@AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' {} Maybe Text
a -> AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
s {$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: Maybe Text
storageClass = Maybe Text
a} :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails)

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

instance
  Prelude.Hashable
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails

instance
  Prelude.NFData
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails

instance
  Core.ToJSON
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
  where
  toJSON :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Value
toJSON
    AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' {Maybe Int
Maybe Text
storageClass :: Maybe Text
days :: Maybe Int
$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Text
$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesNoncurrentVersionTransitionsDetails
-> Maybe Int
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Days" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
days,
              (Text
"StorageClass" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
storageClass
            ]
        )