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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsS3BucketBucketLifecycleConfigurationRulesDetails

-- | The lifecycle configuration for the objects in the S3 bucket.
--
-- /See:/ 'newAwsS3BucketBucketLifecycleConfigurationDetails' smart constructor.
data AwsS3BucketBucketLifecycleConfigurationDetails = AwsS3BucketBucketLifecycleConfigurationDetails'
  { -- | The lifecycle rules.
    AwsS3BucketBucketLifecycleConfigurationDetails
-> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules :: Prelude.Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  }
  deriving (AwsS3BucketBucketLifecycleConfigurationDetails
-> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool
(AwsS3BucketBucketLifecycleConfigurationDetails
 -> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool)
-> (AwsS3BucketBucketLifecycleConfigurationDetails
    -> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool)
-> Eq AwsS3BucketBucketLifecycleConfigurationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsS3BucketBucketLifecycleConfigurationDetails
-> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool
$c/= :: AwsS3BucketBucketLifecycleConfigurationDetails
-> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool
== :: AwsS3BucketBucketLifecycleConfigurationDetails
-> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool
$c== :: AwsS3BucketBucketLifecycleConfigurationDetails
-> AwsS3BucketBucketLifecycleConfigurationDetails -> Bool
Prelude.Eq, ReadPrec [AwsS3BucketBucketLifecycleConfigurationDetails]
ReadPrec AwsS3BucketBucketLifecycleConfigurationDetails
Int -> ReadS AwsS3BucketBucketLifecycleConfigurationDetails
ReadS [AwsS3BucketBucketLifecycleConfigurationDetails]
(Int -> ReadS AwsS3BucketBucketLifecycleConfigurationDetails)
-> ReadS [AwsS3BucketBucketLifecycleConfigurationDetails]
-> ReadPrec AwsS3BucketBucketLifecycleConfigurationDetails
-> ReadPrec [AwsS3BucketBucketLifecycleConfigurationDetails]
-> Read AwsS3BucketBucketLifecycleConfigurationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsS3BucketBucketLifecycleConfigurationDetails]
$creadListPrec :: ReadPrec [AwsS3BucketBucketLifecycleConfigurationDetails]
readPrec :: ReadPrec AwsS3BucketBucketLifecycleConfigurationDetails
$creadPrec :: ReadPrec AwsS3BucketBucketLifecycleConfigurationDetails
readList :: ReadS [AwsS3BucketBucketLifecycleConfigurationDetails]
$creadList :: ReadS [AwsS3BucketBucketLifecycleConfigurationDetails]
readsPrec :: Int -> ReadS AwsS3BucketBucketLifecycleConfigurationDetails
$creadsPrec :: Int -> ReadS AwsS3BucketBucketLifecycleConfigurationDetails
Prelude.Read, Int -> AwsS3BucketBucketLifecycleConfigurationDetails -> ShowS
[AwsS3BucketBucketLifecycleConfigurationDetails] -> ShowS
AwsS3BucketBucketLifecycleConfigurationDetails -> String
(Int -> AwsS3BucketBucketLifecycleConfigurationDetails -> ShowS)
-> (AwsS3BucketBucketLifecycleConfigurationDetails -> String)
-> ([AwsS3BucketBucketLifecycleConfigurationDetails] -> ShowS)
-> Show AwsS3BucketBucketLifecycleConfigurationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsS3BucketBucketLifecycleConfigurationDetails] -> ShowS
$cshowList :: [AwsS3BucketBucketLifecycleConfigurationDetails] -> ShowS
show :: AwsS3BucketBucketLifecycleConfigurationDetails -> String
$cshow :: AwsS3BucketBucketLifecycleConfigurationDetails -> String
showsPrec :: Int -> AwsS3BucketBucketLifecycleConfigurationDetails -> ShowS
$cshowsPrec :: Int -> AwsS3BucketBucketLifecycleConfigurationDetails -> ShowS
Prelude.Show, (forall x.
 AwsS3BucketBucketLifecycleConfigurationDetails
 -> Rep AwsS3BucketBucketLifecycleConfigurationDetails x)
-> (forall x.
    Rep AwsS3BucketBucketLifecycleConfigurationDetails x
    -> AwsS3BucketBucketLifecycleConfigurationDetails)
-> Generic AwsS3BucketBucketLifecycleConfigurationDetails
forall x.
Rep AwsS3BucketBucketLifecycleConfigurationDetails x
-> AwsS3BucketBucketLifecycleConfigurationDetails
forall x.
AwsS3BucketBucketLifecycleConfigurationDetails
-> Rep AwsS3BucketBucketLifecycleConfigurationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsS3BucketBucketLifecycleConfigurationDetails x
-> AwsS3BucketBucketLifecycleConfigurationDetails
$cfrom :: forall x.
AwsS3BucketBucketLifecycleConfigurationDetails
-> Rep AwsS3BucketBucketLifecycleConfigurationDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsS3BucketBucketLifecycleConfigurationDetails' 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:
--
-- 'rules', 'awsS3BucketBucketLifecycleConfigurationDetails_rules' - The lifecycle rules.
newAwsS3BucketBucketLifecycleConfigurationDetails ::
  AwsS3BucketBucketLifecycleConfigurationDetails
newAwsS3BucketBucketLifecycleConfigurationDetails :: AwsS3BucketBucketLifecycleConfigurationDetails
newAwsS3BucketBucketLifecycleConfigurationDetails =
  AwsS3BucketBucketLifecycleConfigurationDetails' :: Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
-> AwsS3BucketBucketLifecycleConfigurationDetails
AwsS3BucketBucketLifecycleConfigurationDetails'
    { $sel:rules:AwsS3BucketBucketLifecycleConfigurationDetails' :: Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules =
        Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
forall a. Maybe a
Prelude.Nothing
    }

-- | The lifecycle rules.
awsS3BucketBucketLifecycleConfigurationDetails_rules :: Lens.Lens' AwsS3BucketBucketLifecycleConfigurationDetails (Prelude.Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
awsS3BucketBucketLifecycleConfigurationDetails_rules :: (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
 -> f (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
-> AwsS3BucketBucketLifecycleConfigurationDetails
-> f AwsS3BucketBucketLifecycleConfigurationDetails
awsS3BucketBucketLifecycleConfigurationDetails_rules = (AwsS3BucketBucketLifecycleConfigurationDetails
 -> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
-> (AwsS3BucketBucketLifecycleConfigurationDetails
    -> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
    -> AwsS3BucketBucketLifecycleConfigurationDetails)
-> Lens
     AwsS3BucketBucketLifecycleConfigurationDetails
     AwsS3BucketBucketLifecycleConfigurationDetails
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsS3BucketBucketLifecycleConfigurationDetails' {Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules :: Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
$sel:rules:AwsS3BucketBucketLifecycleConfigurationDetails' :: AwsS3BucketBucketLifecycleConfigurationDetails
-> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules} -> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules) (\s :: AwsS3BucketBucketLifecycleConfigurationDetails
s@AwsS3BucketBucketLifecycleConfigurationDetails' {} Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
a -> AwsS3BucketBucketLifecycleConfigurationDetails
s {$sel:rules:AwsS3BucketBucketLifecycleConfigurationDetails' :: Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules = Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
a} :: AwsS3BucketBucketLifecycleConfigurationDetails) ((Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  -> f (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
 -> AwsS3BucketBucketLifecycleConfigurationDetails
 -> f AwsS3BucketBucketLifecycleConfigurationDetails)
-> ((Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
     -> f (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
    -> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
    -> f (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
-> (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
    -> f (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
-> AwsS3BucketBucketLifecycleConfigurationDetails
-> f AwsS3BucketBucketLifecycleConfigurationDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
-> Iso
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
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 AnIso
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
  [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsS3BucketBucketLifecycleConfigurationDetails
  where
  parseJSON :: Value -> Parser AwsS3BucketBucketLifecycleConfigurationDetails
parseJSON =
    String
-> (Object
    -> Parser AwsS3BucketBucketLifecycleConfigurationDetails)
-> Value
-> Parser AwsS3BucketBucketLifecycleConfigurationDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsS3BucketBucketLifecycleConfigurationDetails"
      ( \Object
x ->
          Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
-> AwsS3BucketBucketLifecycleConfigurationDetails
AwsS3BucketBucketLifecycleConfigurationDetails'
            (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
 -> AwsS3BucketBucketLifecycleConfigurationDetails)
-> Parser
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
-> Parser AwsS3BucketBucketLifecycleConfigurationDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe
        (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Rules" Parser
  (Maybe
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]))
-> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
-> Parser
     (Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsS3BucketBucketLifecycleConfigurationDetails

instance
  Prelude.NFData
    AwsS3BucketBucketLifecycleConfigurationDetails

instance
  Core.ToJSON
    AwsS3BucketBucketLifecycleConfigurationDetails
  where
  toJSON :: AwsS3BucketBucketLifecycleConfigurationDetails -> Value
toJSON
    AwsS3BucketBucketLifecycleConfigurationDetails' {Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules :: Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
$sel:rules:AwsS3BucketBucketLifecycleConfigurationDetails' :: AwsS3BucketBucketLifecycleConfigurationDetails
-> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [(Text
"Rules" Text
-> [AwsS3BucketBucketLifecycleConfigurationRulesDetails] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AwsS3BucketBucketLifecycleConfigurationRulesDetails] -> Pair)
-> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
-> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsS3BucketBucketLifecycleConfigurationRulesDetails]
rules]
        )