{-# 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.AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-- 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.AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails where

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

-- | A rule for when objects transition to specific storage classes.
--
-- /See:/ 'newAwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' smart constructor.
data AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails = AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails'
  { -- | The number of days after which to transition the object to the specified
    -- storage class. If you provide @Days@, you cannot provide @Date@.
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Int
days :: Prelude.Maybe Prelude.Int,
    -- | A date on which to transition objects to the specified storage class. If
    -- you provide @Date@, you cannot provide @Days@.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
date :: Prelude.Maybe Prelude.Text,
    -- | The storage class to transition the object to.
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
storageClass :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Bool
(AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> Bool)
-> (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> Bool)
-> Eq
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Bool
$c/= :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Bool
== :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Bool
$c== :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
(Int
 -> ReadS
      AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> ReadS
     [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
-> ReadPrec
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> ReadPrec
     [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
-> Read
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
$creadListPrec :: ReadPrec
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
readPrec :: ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
$creadPrec :: ReadPrec
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
readList :: ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
$creadList :: ReadS
  [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
readsPrec :: Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
$creadsPrec :: Int
-> ReadS
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
Prelude.Read, Int
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> ShowS
[AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
-> ShowS
AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> String
(Int
 -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> ShowS)
-> (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> String)
-> ([AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
    -> ShowS)
-> Show
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
-> ShowS
$cshowList :: [AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails]
-> ShowS
show :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> String
$cshow :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> String
showsPrec :: Int
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> ShowS
$cshowsPrec :: Int
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> ShowS
Prelude.Show, (forall x.
 AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> Rep
      AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x)
-> (forall x.
    Rep
      AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x
    -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Generic
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall x.
Rep
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall x.
AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Rep
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
$cfrom :: forall x.
AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Rep
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' 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', 'awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_days' - The number of days after which to transition the object to the specified
-- storage class. If you provide @Days@, you cannot provide @Date@.
--
-- 'date', 'awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_date' - A date on which to transition objects to the specified storage class. If
-- you provide @Date@, you cannot provide @Days@.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'storageClass', 'awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_storageClass' - The storage class to transition the object to.
newAwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails ::
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
newAwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
newAwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails =
  AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Int
-> Maybe Text
-> Maybe Text
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails'
    { $sel:days:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Int
days =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:date:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Text
date =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Text
storageClass =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of days after which to transition the object to the specified
-- storage class. If you provide @Days@, you cannot provide @Date@.
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_days :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails (Prelude.Maybe Prelude.Int)
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_days :: (Maybe Int -> f (Maybe Int))
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> f AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_days = (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> Maybe Int)
-> (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> Maybe Int
    -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {Maybe Int
days :: Maybe Int
$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Int
days} -> Maybe Int
days) (\s :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s@AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {} Maybe Int
a -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s {$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Int
days = Maybe Int
a} :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)

-- | A date on which to transition objects to the specified storage class. If
-- you provide @Date@, you cannot provide @Days@.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_date :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails (Prelude.Maybe Prelude.Text)
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_date :: (Maybe Text -> f (Maybe Text))
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> f AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_date = (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> Maybe Text)
-> (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> Maybe Text
    -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {Maybe Text
date :: Maybe Text
$sel:date:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
date} -> Maybe Text
date) (\s :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s@AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {} Maybe Text
a -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s {$sel:date:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Text
date = Maybe Text
a} :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)

-- | The storage class to transition the object to.
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_storageClass :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails (Prelude.Maybe Prelude.Text)
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_storageClass :: (Maybe Text -> f (Maybe Text))
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> f AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
awsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails_storageClass = (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
 -> Maybe Text)
-> (AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
    -> Maybe Text
    -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {Maybe Text
storageClass :: Maybe Text
$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
storageClass} -> Maybe Text
storageClass) (\s :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s@AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {} Maybe Text
a -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
s {$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: Maybe Text
storageClass = Maybe Text
a} :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)

instance
  Core.FromJSON
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
  where
  parseJSON :: Value
-> Parser
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
parseJSON =
    String
-> (Object
    -> Parser
         AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Value
-> Parser
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails"
      ( \Object
x ->
          Maybe Int
-> Maybe Text
-> Maybe Text
-> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails'
            (Maybe Int
 -> Maybe Text
 -> Maybe Text
 -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
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
   -> Maybe Text
   -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
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
"Date")
              Parser
  (Maybe Text
   -> AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails)
-> Parser (Maybe Text)
-> Parser
     AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
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
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails

instance
  Prelude.NFData
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails

instance
  Core.ToJSON
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
  where
  toJSON :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Value
toJSON
    AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' {Maybe Int
Maybe Text
storageClass :: Maybe Text
date :: Maybe Text
days :: Maybe Int
$sel:storageClass:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
$sel:date:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> Maybe Text
$sel:days:AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails' :: AwsS3BucketBucketLifecycleConfigurationRulesTransitionsDetails
-> 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
"Date" 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
date,
              (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
            ]
        )