{-# 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.SSM.Types.ParameterInlinePolicy
-- 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.SSM.Types.ParameterInlinePolicy where

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

-- | One or more policies assigned to a parameter.
--
-- /See:/ 'newParameterInlinePolicy' smart constructor.
data ParameterInlinePolicy = ParameterInlinePolicy'
  { -- | The type of policy. Parameter Store, a capablility of Amazon Web
    -- Services Systems Manager, supports the following policy types:
    -- Expiration, ExpirationNotification, and NoChangeNotification.
    ParameterInlinePolicy -> Maybe Text
policyType :: Prelude.Maybe Prelude.Text,
    -- | The status of the policy. Policies report the following statuses:
    -- Pending (the policy hasn\'t been enforced or applied yet), Finished (the
    -- policy was applied), Failed (the policy wasn\'t applied), or InProgress
    -- (the policy is being applied now).
    ParameterInlinePolicy -> Maybe Text
policyStatus :: Prelude.Maybe Prelude.Text,
    -- | The JSON text of the policy.
    ParameterInlinePolicy -> Maybe Text
policyText :: Prelude.Maybe Prelude.Text
  }
  deriving (ParameterInlinePolicy -> ParameterInlinePolicy -> Bool
(ParameterInlinePolicy -> ParameterInlinePolicy -> Bool)
-> (ParameterInlinePolicy -> ParameterInlinePolicy -> Bool)
-> Eq ParameterInlinePolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ParameterInlinePolicy -> ParameterInlinePolicy -> Bool
$c/= :: ParameterInlinePolicy -> ParameterInlinePolicy -> Bool
== :: ParameterInlinePolicy -> ParameterInlinePolicy -> Bool
$c== :: ParameterInlinePolicy -> ParameterInlinePolicy -> Bool
Prelude.Eq, ReadPrec [ParameterInlinePolicy]
ReadPrec ParameterInlinePolicy
Int -> ReadS ParameterInlinePolicy
ReadS [ParameterInlinePolicy]
(Int -> ReadS ParameterInlinePolicy)
-> ReadS [ParameterInlinePolicy]
-> ReadPrec ParameterInlinePolicy
-> ReadPrec [ParameterInlinePolicy]
-> Read ParameterInlinePolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ParameterInlinePolicy]
$creadListPrec :: ReadPrec [ParameterInlinePolicy]
readPrec :: ReadPrec ParameterInlinePolicy
$creadPrec :: ReadPrec ParameterInlinePolicy
readList :: ReadS [ParameterInlinePolicy]
$creadList :: ReadS [ParameterInlinePolicy]
readsPrec :: Int -> ReadS ParameterInlinePolicy
$creadsPrec :: Int -> ReadS ParameterInlinePolicy
Prelude.Read, Int -> ParameterInlinePolicy -> ShowS
[ParameterInlinePolicy] -> ShowS
ParameterInlinePolicy -> String
(Int -> ParameterInlinePolicy -> ShowS)
-> (ParameterInlinePolicy -> String)
-> ([ParameterInlinePolicy] -> ShowS)
-> Show ParameterInlinePolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ParameterInlinePolicy] -> ShowS
$cshowList :: [ParameterInlinePolicy] -> ShowS
show :: ParameterInlinePolicy -> String
$cshow :: ParameterInlinePolicy -> String
showsPrec :: Int -> ParameterInlinePolicy -> ShowS
$cshowsPrec :: Int -> ParameterInlinePolicy -> ShowS
Prelude.Show, (forall x. ParameterInlinePolicy -> Rep ParameterInlinePolicy x)
-> (forall x. Rep ParameterInlinePolicy x -> ParameterInlinePolicy)
-> Generic ParameterInlinePolicy
forall x. Rep ParameterInlinePolicy x -> ParameterInlinePolicy
forall x. ParameterInlinePolicy -> Rep ParameterInlinePolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ParameterInlinePolicy x -> ParameterInlinePolicy
$cfrom :: forall x. ParameterInlinePolicy -> Rep ParameterInlinePolicy x
Prelude.Generic)

-- |
-- Create a value of 'ParameterInlinePolicy' 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:
--
-- 'policyType', 'parameterInlinePolicy_policyType' - The type of policy. Parameter Store, a capablility of Amazon Web
-- Services Systems Manager, supports the following policy types:
-- Expiration, ExpirationNotification, and NoChangeNotification.
--
-- 'policyStatus', 'parameterInlinePolicy_policyStatus' - The status of the policy. Policies report the following statuses:
-- Pending (the policy hasn\'t been enforced or applied yet), Finished (the
-- policy was applied), Failed (the policy wasn\'t applied), or InProgress
-- (the policy is being applied now).
--
-- 'policyText', 'parameterInlinePolicy_policyText' - The JSON text of the policy.
newParameterInlinePolicy ::
  ParameterInlinePolicy
newParameterInlinePolicy :: ParameterInlinePolicy
newParameterInlinePolicy =
  ParameterInlinePolicy' :: Maybe Text -> Maybe Text -> Maybe Text -> ParameterInlinePolicy
ParameterInlinePolicy'
    { $sel:policyType:ParameterInlinePolicy' :: Maybe Text
policyType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyStatus:ParameterInlinePolicy' :: Maybe Text
policyStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyText:ParameterInlinePolicy' :: Maybe Text
policyText = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of policy. Parameter Store, a capablility of Amazon Web
-- Services Systems Manager, supports the following policy types:
-- Expiration, ExpirationNotification, and NoChangeNotification.
parameterInlinePolicy_policyType :: Lens.Lens' ParameterInlinePolicy (Prelude.Maybe Prelude.Text)
parameterInlinePolicy_policyType :: (Maybe Text -> f (Maybe Text))
-> ParameterInlinePolicy -> f ParameterInlinePolicy
parameterInlinePolicy_policyType = (ParameterInlinePolicy -> Maybe Text)
-> (ParameterInlinePolicy -> Maybe Text -> ParameterInlinePolicy)
-> Lens
     ParameterInlinePolicy
     ParameterInlinePolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterInlinePolicy' {Maybe Text
policyType :: Maybe Text
$sel:policyType:ParameterInlinePolicy' :: ParameterInlinePolicy -> Maybe Text
policyType} -> Maybe Text
policyType) (\s :: ParameterInlinePolicy
s@ParameterInlinePolicy' {} Maybe Text
a -> ParameterInlinePolicy
s {$sel:policyType:ParameterInlinePolicy' :: Maybe Text
policyType = Maybe Text
a} :: ParameterInlinePolicy)

-- | The status of the policy. Policies report the following statuses:
-- Pending (the policy hasn\'t been enforced or applied yet), Finished (the
-- policy was applied), Failed (the policy wasn\'t applied), or InProgress
-- (the policy is being applied now).
parameterInlinePolicy_policyStatus :: Lens.Lens' ParameterInlinePolicy (Prelude.Maybe Prelude.Text)
parameterInlinePolicy_policyStatus :: (Maybe Text -> f (Maybe Text))
-> ParameterInlinePolicy -> f ParameterInlinePolicy
parameterInlinePolicy_policyStatus = (ParameterInlinePolicy -> Maybe Text)
-> (ParameterInlinePolicy -> Maybe Text -> ParameterInlinePolicy)
-> Lens
     ParameterInlinePolicy
     ParameterInlinePolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterInlinePolicy' {Maybe Text
policyStatus :: Maybe Text
$sel:policyStatus:ParameterInlinePolicy' :: ParameterInlinePolicy -> Maybe Text
policyStatus} -> Maybe Text
policyStatus) (\s :: ParameterInlinePolicy
s@ParameterInlinePolicy' {} Maybe Text
a -> ParameterInlinePolicy
s {$sel:policyStatus:ParameterInlinePolicy' :: Maybe Text
policyStatus = Maybe Text
a} :: ParameterInlinePolicy)

-- | The JSON text of the policy.
parameterInlinePolicy_policyText :: Lens.Lens' ParameterInlinePolicy (Prelude.Maybe Prelude.Text)
parameterInlinePolicy_policyText :: (Maybe Text -> f (Maybe Text))
-> ParameterInlinePolicy -> f ParameterInlinePolicy
parameterInlinePolicy_policyText = (ParameterInlinePolicy -> Maybe Text)
-> (ParameterInlinePolicy -> Maybe Text -> ParameterInlinePolicy)
-> Lens
     ParameterInlinePolicy
     ParameterInlinePolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ParameterInlinePolicy' {Maybe Text
policyText :: Maybe Text
$sel:policyText:ParameterInlinePolicy' :: ParameterInlinePolicy -> Maybe Text
policyText} -> Maybe Text
policyText) (\s :: ParameterInlinePolicy
s@ParameterInlinePolicy' {} Maybe Text
a -> ParameterInlinePolicy
s {$sel:policyText:ParameterInlinePolicy' :: Maybe Text
policyText = Maybe Text
a} :: ParameterInlinePolicy)

instance Core.FromJSON ParameterInlinePolicy where
  parseJSON :: Value -> Parser ParameterInlinePolicy
parseJSON =
    String
-> (Object -> Parser ParameterInlinePolicy)
-> Value
-> Parser ParameterInlinePolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ParameterInlinePolicy"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> ParameterInlinePolicy
ParameterInlinePolicy'
            (Maybe Text -> Maybe Text -> Maybe Text -> ParameterInlinePolicy)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ParameterInlinePolicy)
forall (f :: * -> *) a b. Functor 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
"PolicyType")
            Parser (Maybe Text -> Maybe Text -> ParameterInlinePolicy)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ParameterInlinePolicy)
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
"PolicyStatus")
            Parser (Maybe Text -> ParameterInlinePolicy)
-> Parser (Maybe Text) -> Parser ParameterInlinePolicy
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
"PolicyText")
      )

instance Prelude.Hashable ParameterInlinePolicy

instance Prelude.NFData ParameterInlinePolicy