{-# 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.EFS.Types.LifecycleConfigurationDescription
-- 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.EFS.Types.LifecycleConfigurationDescription where

import qualified Amazonka.Core as Core
import Amazonka.EFS.Types.LifecyclePolicy
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newLifecycleConfigurationDescription' smart constructor.
data LifecycleConfigurationDescription = LifecycleConfigurationDescription'
  { -- | An array of lifecycle management policies. EFS supports a maximum of one
    -- policy per file system.
    LifecycleConfigurationDescription -> Maybe [LifecyclePolicy]
lifecyclePolicies :: Prelude.Maybe [LifecyclePolicy]
  }
  deriving (LifecycleConfigurationDescription
-> LifecycleConfigurationDescription -> Bool
(LifecycleConfigurationDescription
 -> LifecycleConfigurationDescription -> Bool)
-> (LifecycleConfigurationDescription
    -> LifecycleConfigurationDescription -> Bool)
-> Eq LifecycleConfigurationDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LifecycleConfigurationDescription
-> LifecycleConfigurationDescription -> Bool
$c/= :: LifecycleConfigurationDescription
-> LifecycleConfigurationDescription -> Bool
== :: LifecycleConfigurationDescription
-> LifecycleConfigurationDescription -> Bool
$c== :: LifecycleConfigurationDescription
-> LifecycleConfigurationDescription -> Bool
Prelude.Eq, ReadPrec [LifecycleConfigurationDescription]
ReadPrec LifecycleConfigurationDescription
Int -> ReadS LifecycleConfigurationDescription
ReadS [LifecycleConfigurationDescription]
(Int -> ReadS LifecycleConfigurationDescription)
-> ReadS [LifecycleConfigurationDescription]
-> ReadPrec LifecycleConfigurationDescription
-> ReadPrec [LifecycleConfigurationDescription]
-> Read LifecycleConfigurationDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LifecycleConfigurationDescription]
$creadListPrec :: ReadPrec [LifecycleConfigurationDescription]
readPrec :: ReadPrec LifecycleConfigurationDescription
$creadPrec :: ReadPrec LifecycleConfigurationDescription
readList :: ReadS [LifecycleConfigurationDescription]
$creadList :: ReadS [LifecycleConfigurationDescription]
readsPrec :: Int -> ReadS LifecycleConfigurationDescription
$creadsPrec :: Int -> ReadS LifecycleConfigurationDescription
Prelude.Read, Int -> LifecycleConfigurationDescription -> ShowS
[LifecycleConfigurationDescription] -> ShowS
LifecycleConfigurationDescription -> String
(Int -> LifecycleConfigurationDescription -> ShowS)
-> (LifecycleConfigurationDescription -> String)
-> ([LifecycleConfigurationDescription] -> ShowS)
-> Show LifecycleConfigurationDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LifecycleConfigurationDescription] -> ShowS
$cshowList :: [LifecycleConfigurationDescription] -> ShowS
show :: LifecycleConfigurationDescription -> String
$cshow :: LifecycleConfigurationDescription -> String
showsPrec :: Int -> LifecycleConfigurationDescription -> ShowS
$cshowsPrec :: Int -> LifecycleConfigurationDescription -> ShowS
Prelude.Show, (forall x.
 LifecycleConfigurationDescription
 -> Rep LifecycleConfigurationDescription x)
-> (forall x.
    Rep LifecycleConfigurationDescription x
    -> LifecycleConfigurationDescription)
-> Generic LifecycleConfigurationDescription
forall x.
Rep LifecycleConfigurationDescription x
-> LifecycleConfigurationDescription
forall x.
LifecycleConfigurationDescription
-> Rep LifecycleConfigurationDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LifecycleConfigurationDescription x
-> LifecycleConfigurationDescription
$cfrom :: forall x.
LifecycleConfigurationDescription
-> Rep LifecycleConfigurationDescription x
Prelude.Generic)

-- |
-- Create a value of 'LifecycleConfigurationDescription' 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:
--
-- 'lifecyclePolicies', 'lifecycleConfigurationDescription_lifecyclePolicies' - An array of lifecycle management policies. EFS supports a maximum of one
-- policy per file system.
newLifecycleConfigurationDescription ::
  LifecycleConfigurationDescription
newLifecycleConfigurationDescription :: LifecycleConfigurationDescription
newLifecycleConfigurationDescription =
  LifecycleConfigurationDescription' :: Maybe [LifecyclePolicy] -> LifecycleConfigurationDescription
LifecycleConfigurationDescription'
    { $sel:lifecyclePolicies:LifecycleConfigurationDescription' :: Maybe [LifecyclePolicy]
lifecyclePolicies =
        Maybe [LifecyclePolicy]
forall a. Maybe a
Prelude.Nothing
    }

-- | An array of lifecycle management policies. EFS supports a maximum of one
-- policy per file system.
lifecycleConfigurationDescription_lifecyclePolicies :: Lens.Lens' LifecycleConfigurationDescription (Prelude.Maybe [LifecyclePolicy])
lifecycleConfigurationDescription_lifecyclePolicies :: (Maybe [LifecyclePolicy] -> f (Maybe [LifecyclePolicy]))
-> LifecycleConfigurationDescription
-> f LifecycleConfigurationDescription
lifecycleConfigurationDescription_lifecyclePolicies = (LifecycleConfigurationDescription -> Maybe [LifecyclePolicy])
-> (LifecycleConfigurationDescription
    -> Maybe [LifecyclePolicy] -> LifecycleConfigurationDescription)
-> Lens
     LifecycleConfigurationDescription
     LifecycleConfigurationDescription
     (Maybe [LifecyclePolicy])
     (Maybe [LifecyclePolicy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecycleConfigurationDescription' {Maybe [LifecyclePolicy]
lifecyclePolicies :: Maybe [LifecyclePolicy]
$sel:lifecyclePolicies:LifecycleConfigurationDescription' :: LifecycleConfigurationDescription -> Maybe [LifecyclePolicy]
lifecyclePolicies} -> Maybe [LifecyclePolicy]
lifecyclePolicies) (\s :: LifecycleConfigurationDescription
s@LifecycleConfigurationDescription' {} Maybe [LifecyclePolicy]
a -> LifecycleConfigurationDescription
s {$sel:lifecyclePolicies:LifecycleConfigurationDescription' :: Maybe [LifecyclePolicy]
lifecyclePolicies = Maybe [LifecyclePolicy]
a} :: LifecycleConfigurationDescription) ((Maybe [LifecyclePolicy] -> f (Maybe [LifecyclePolicy]))
 -> LifecycleConfigurationDescription
 -> f LifecycleConfigurationDescription)
-> ((Maybe [LifecyclePolicy] -> f (Maybe [LifecyclePolicy]))
    -> Maybe [LifecyclePolicy] -> f (Maybe [LifecyclePolicy]))
-> (Maybe [LifecyclePolicy] -> f (Maybe [LifecyclePolicy]))
-> LifecycleConfigurationDescription
-> f LifecycleConfigurationDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LifecyclePolicy]
  [LifecyclePolicy]
  [LifecyclePolicy]
  [LifecyclePolicy]
-> Iso
     (Maybe [LifecyclePolicy])
     (Maybe [LifecyclePolicy])
     (Maybe [LifecyclePolicy])
     (Maybe [LifecyclePolicy])
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
  [LifecyclePolicy]
  [LifecyclePolicy]
  [LifecyclePolicy]
  [LifecyclePolicy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.Hashable
    LifecycleConfigurationDescription

instance
  Prelude.NFData
    LifecycleConfigurationDescription