{-# 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.DLM.Types.LifecyclePolicySummary
-- 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.DLM.Types.LifecyclePolicySummary where

import qualified Amazonka.Core as Core
import Amazonka.DLM.Types.GettablePolicyStateValues
import Amazonka.DLM.Types.PolicyTypeValues
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Summary information about a lifecycle policy.
--
-- /See:/ 'newLifecyclePolicySummary' smart constructor.
data LifecyclePolicySummary = LifecyclePolicySummary'
  { -- | The activation state of the lifecycle policy.
    LifecyclePolicySummary -> Maybe GettablePolicyStateValues
state :: Prelude.Maybe GettablePolicyStateValues,
    -- | The identifier of the lifecycle policy.
    LifecyclePolicySummary -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | The type of policy. @EBS_SNAPSHOT_MANAGEMENT@ indicates that the policy
    -- manages the lifecycle of Amazon EBS snapshots. @IMAGE_MANAGEMENT@
    -- indicates that the policy manages the lifecycle of EBS-backed AMIs.
    LifecyclePolicySummary -> Maybe PolicyTypeValues
policyType :: Prelude.Maybe PolicyTypeValues,
    -- | The description of the lifecycle policy.
    LifecyclePolicySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags.
    LifecyclePolicySummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (LifecyclePolicySummary -> LifecyclePolicySummary -> Bool
(LifecyclePolicySummary -> LifecyclePolicySummary -> Bool)
-> (LifecyclePolicySummary -> LifecyclePolicySummary -> Bool)
-> Eq LifecyclePolicySummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LifecyclePolicySummary -> LifecyclePolicySummary -> Bool
$c/= :: LifecyclePolicySummary -> LifecyclePolicySummary -> Bool
== :: LifecyclePolicySummary -> LifecyclePolicySummary -> Bool
$c== :: LifecyclePolicySummary -> LifecyclePolicySummary -> Bool
Prelude.Eq, ReadPrec [LifecyclePolicySummary]
ReadPrec LifecyclePolicySummary
Int -> ReadS LifecyclePolicySummary
ReadS [LifecyclePolicySummary]
(Int -> ReadS LifecyclePolicySummary)
-> ReadS [LifecyclePolicySummary]
-> ReadPrec LifecyclePolicySummary
-> ReadPrec [LifecyclePolicySummary]
-> Read LifecyclePolicySummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LifecyclePolicySummary]
$creadListPrec :: ReadPrec [LifecyclePolicySummary]
readPrec :: ReadPrec LifecyclePolicySummary
$creadPrec :: ReadPrec LifecyclePolicySummary
readList :: ReadS [LifecyclePolicySummary]
$creadList :: ReadS [LifecyclePolicySummary]
readsPrec :: Int -> ReadS LifecyclePolicySummary
$creadsPrec :: Int -> ReadS LifecyclePolicySummary
Prelude.Read, Int -> LifecyclePolicySummary -> ShowS
[LifecyclePolicySummary] -> ShowS
LifecyclePolicySummary -> String
(Int -> LifecyclePolicySummary -> ShowS)
-> (LifecyclePolicySummary -> String)
-> ([LifecyclePolicySummary] -> ShowS)
-> Show LifecyclePolicySummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LifecyclePolicySummary] -> ShowS
$cshowList :: [LifecyclePolicySummary] -> ShowS
show :: LifecyclePolicySummary -> String
$cshow :: LifecyclePolicySummary -> String
showsPrec :: Int -> LifecyclePolicySummary -> ShowS
$cshowsPrec :: Int -> LifecyclePolicySummary -> ShowS
Prelude.Show, (forall x. LifecyclePolicySummary -> Rep LifecyclePolicySummary x)
-> (forall x.
    Rep LifecyclePolicySummary x -> LifecyclePolicySummary)
-> Generic LifecyclePolicySummary
forall x. Rep LifecyclePolicySummary x -> LifecyclePolicySummary
forall x. LifecyclePolicySummary -> Rep LifecyclePolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LifecyclePolicySummary x -> LifecyclePolicySummary
$cfrom :: forall x. LifecyclePolicySummary -> Rep LifecyclePolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'LifecyclePolicySummary' 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:
--
-- 'state', 'lifecyclePolicySummary_state' - The activation state of the lifecycle policy.
--
-- 'policyId', 'lifecyclePolicySummary_policyId' - The identifier of the lifecycle policy.
--
-- 'policyType', 'lifecyclePolicySummary_policyType' - The type of policy. @EBS_SNAPSHOT_MANAGEMENT@ indicates that the policy
-- manages the lifecycle of Amazon EBS snapshots. @IMAGE_MANAGEMENT@
-- indicates that the policy manages the lifecycle of EBS-backed AMIs.
--
-- 'description', 'lifecyclePolicySummary_description' - The description of the lifecycle policy.
--
-- 'tags', 'lifecyclePolicySummary_tags' - The tags.
newLifecyclePolicySummary ::
  LifecyclePolicySummary
newLifecyclePolicySummary :: LifecyclePolicySummary
newLifecyclePolicySummary =
  LifecyclePolicySummary' :: Maybe GettablePolicyStateValues
-> Maybe Text
-> Maybe PolicyTypeValues
-> Maybe Text
-> Maybe (HashMap Text Text)
-> LifecyclePolicySummary
LifecyclePolicySummary'
    { $sel:state:LifecyclePolicySummary' :: Maybe GettablePolicyStateValues
state = Maybe GettablePolicyStateValues
forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:LifecyclePolicySummary' :: Maybe Text
policyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyType:LifecyclePolicySummary' :: Maybe PolicyTypeValues
policyType = Maybe PolicyTypeValues
forall a. Maybe a
Prelude.Nothing,
      $sel:description:LifecyclePolicySummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:LifecyclePolicySummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The activation state of the lifecycle policy.
lifecyclePolicySummary_state :: Lens.Lens' LifecyclePolicySummary (Prelude.Maybe GettablePolicyStateValues)
lifecyclePolicySummary_state :: (Maybe GettablePolicyStateValues
 -> f (Maybe GettablePolicyStateValues))
-> LifecyclePolicySummary -> f LifecyclePolicySummary
lifecyclePolicySummary_state = (LifecyclePolicySummary -> Maybe GettablePolicyStateValues)
-> (LifecyclePolicySummary
    -> Maybe GettablePolicyStateValues -> LifecyclePolicySummary)
-> Lens
     LifecyclePolicySummary
     LifecyclePolicySummary
     (Maybe GettablePolicyStateValues)
     (Maybe GettablePolicyStateValues)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicySummary' {Maybe GettablePolicyStateValues
state :: Maybe GettablePolicyStateValues
$sel:state:LifecyclePolicySummary' :: LifecyclePolicySummary -> Maybe GettablePolicyStateValues
state} -> Maybe GettablePolicyStateValues
state) (\s :: LifecyclePolicySummary
s@LifecyclePolicySummary' {} Maybe GettablePolicyStateValues
a -> LifecyclePolicySummary
s {$sel:state:LifecyclePolicySummary' :: Maybe GettablePolicyStateValues
state = Maybe GettablePolicyStateValues
a} :: LifecyclePolicySummary)

-- | The identifier of the lifecycle policy.
lifecyclePolicySummary_policyId :: Lens.Lens' LifecyclePolicySummary (Prelude.Maybe Prelude.Text)
lifecyclePolicySummary_policyId :: (Maybe Text -> f (Maybe Text))
-> LifecyclePolicySummary -> f LifecyclePolicySummary
lifecyclePolicySummary_policyId = (LifecyclePolicySummary -> Maybe Text)
-> (LifecyclePolicySummary -> Maybe Text -> LifecyclePolicySummary)
-> Lens
     LifecyclePolicySummary
     LifecyclePolicySummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicySummary' {Maybe Text
policyId :: Maybe Text
$sel:policyId:LifecyclePolicySummary' :: LifecyclePolicySummary -> Maybe Text
policyId} -> Maybe Text
policyId) (\s :: LifecyclePolicySummary
s@LifecyclePolicySummary' {} Maybe Text
a -> LifecyclePolicySummary
s {$sel:policyId:LifecyclePolicySummary' :: Maybe Text
policyId = Maybe Text
a} :: LifecyclePolicySummary)

-- | The type of policy. @EBS_SNAPSHOT_MANAGEMENT@ indicates that the policy
-- manages the lifecycle of Amazon EBS snapshots. @IMAGE_MANAGEMENT@
-- indicates that the policy manages the lifecycle of EBS-backed AMIs.
lifecyclePolicySummary_policyType :: Lens.Lens' LifecyclePolicySummary (Prelude.Maybe PolicyTypeValues)
lifecyclePolicySummary_policyType :: (Maybe PolicyTypeValues -> f (Maybe PolicyTypeValues))
-> LifecyclePolicySummary -> f LifecyclePolicySummary
lifecyclePolicySummary_policyType = (LifecyclePolicySummary -> Maybe PolicyTypeValues)
-> (LifecyclePolicySummary
    -> Maybe PolicyTypeValues -> LifecyclePolicySummary)
-> Lens
     LifecyclePolicySummary
     LifecyclePolicySummary
     (Maybe PolicyTypeValues)
     (Maybe PolicyTypeValues)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicySummary' {Maybe PolicyTypeValues
policyType :: Maybe PolicyTypeValues
$sel:policyType:LifecyclePolicySummary' :: LifecyclePolicySummary -> Maybe PolicyTypeValues
policyType} -> Maybe PolicyTypeValues
policyType) (\s :: LifecyclePolicySummary
s@LifecyclePolicySummary' {} Maybe PolicyTypeValues
a -> LifecyclePolicySummary
s {$sel:policyType:LifecyclePolicySummary' :: Maybe PolicyTypeValues
policyType = Maybe PolicyTypeValues
a} :: LifecyclePolicySummary)

-- | The description of the lifecycle policy.
lifecyclePolicySummary_description :: Lens.Lens' LifecyclePolicySummary (Prelude.Maybe Prelude.Text)
lifecyclePolicySummary_description :: (Maybe Text -> f (Maybe Text))
-> LifecyclePolicySummary -> f LifecyclePolicySummary
lifecyclePolicySummary_description = (LifecyclePolicySummary -> Maybe Text)
-> (LifecyclePolicySummary -> Maybe Text -> LifecyclePolicySummary)
-> Lens
     LifecyclePolicySummary
     LifecyclePolicySummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicySummary' {Maybe Text
description :: Maybe Text
$sel:description:LifecyclePolicySummary' :: LifecyclePolicySummary -> Maybe Text
description} -> Maybe Text
description) (\s :: LifecyclePolicySummary
s@LifecyclePolicySummary' {} Maybe Text
a -> LifecyclePolicySummary
s {$sel:description:LifecyclePolicySummary' :: Maybe Text
description = Maybe Text
a} :: LifecyclePolicySummary)

-- | The tags.
lifecyclePolicySummary_tags :: Lens.Lens' LifecyclePolicySummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
lifecyclePolicySummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> LifecyclePolicySummary -> f LifecyclePolicySummary
lifecyclePolicySummary_tags = (LifecyclePolicySummary -> Maybe (HashMap Text Text))
-> (LifecyclePolicySummary
    -> Maybe (HashMap Text Text) -> LifecyclePolicySummary)
-> Lens
     LifecyclePolicySummary
     LifecyclePolicySummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicySummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:LifecyclePolicySummary' :: LifecyclePolicySummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: LifecyclePolicySummary
s@LifecyclePolicySummary' {} Maybe (HashMap Text Text)
a -> LifecyclePolicySummary
s {$sel:tags:LifecyclePolicySummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: LifecyclePolicySummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> LifecyclePolicySummary -> f LifecyclePolicySummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> LifecyclePolicySummary
-> f LifecyclePolicySummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON LifecyclePolicySummary where
  parseJSON :: Value -> Parser LifecyclePolicySummary
parseJSON =
    String
-> (Object -> Parser LifecyclePolicySummary)
-> Value
-> Parser LifecyclePolicySummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LifecyclePolicySummary"
      ( \Object
x ->
          Maybe GettablePolicyStateValues
-> Maybe Text
-> Maybe PolicyTypeValues
-> Maybe Text
-> Maybe (HashMap Text Text)
-> LifecyclePolicySummary
LifecyclePolicySummary'
            (Maybe GettablePolicyStateValues
 -> Maybe Text
 -> Maybe PolicyTypeValues
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> LifecyclePolicySummary)
-> Parser (Maybe GettablePolicyStateValues)
-> Parser
     (Maybe Text
      -> Maybe PolicyTypeValues
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> LifecyclePolicySummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GettablePolicyStateValues)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
            Parser
  (Maybe Text
   -> Maybe PolicyTypeValues
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> LifecyclePolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe PolicyTypeValues
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> LifecyclePolicySummary)
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
"PolicyId")
            Parser
  (Maybe PolicyTypeValues
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> LifecyclePolicySummary)
-> Parser (Maybe PolicyTypeValues)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> LifecyclePolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PolicyTypeValues)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicyType")
            Parser
  (Maybe Text -> Maybe (HashMap Text Text) -> LifecyclePolicySummary)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> LifecyclePolicySummary)
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
"Description")
            Parser (Maybe (HashMap Text Text) -> LifecyclePolicySummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser LifecyclePolicySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable LifecyclePolicySummary

instance Prelude.NFData LifecyclePolicySummary