{-# 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.ECR.Types.LifecyclePolicyRuleAction
-- 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.ECR.Types.LifecyclePolicyRuleAction where

import qualified Amazonka.Core as Core
import Amazonka.ECR.Types.ImageActionType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The type of action to be taken.
--
-- /See:/ 'newLifecyclePolicyRuleAction' smart constructor.
data LifecyclePolicyRuleAction = LifecyclePolicyRuleAction'
  { -- | The type of action to be taken.
    LifecyclePolicyRuleAction -> Maybe ImageActionType
type' :: Prelude.Maybe ImageActionType
  }
  deriving (LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool
(LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool)
-> (LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool)
-> Eq LifecyclePolicyRuleAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool
$c/= :: LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool
== :: LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool
$c== :: LifecyclePolicyRuleAction -> LifecyclePolicyRuleAction -> Bool
Prelude.Eq, ReadPrec [LifecyclePolicyRuleAction]
ReadPrec LifecyclePolicyRuleAction
Int -> ReadS LifecyclePolicyRuleAction
ReadS [LifecyclePolicyRuleAction]
(Int -> ReadS LifecyclePolicyRuleAction)
-> ReadS [LifecyclePolicyRuleAction]
-> ReadPrec LifecyclePolicyRuleAction
-> ReadPrec [LifecyclePolicyRuleAction]
-> Read LifecyclePolicyRuleAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LifecyclePolicyRuleAction]
$creadListPrec :: ReadPrec [LifecyclePolicyRuleAction]
readPrec :: ReadPrec LifecyclePolicyRuleAction
$creadPrec :: ReadPrec LifecyclePolicyRuleAction
readList :: ReadS [LifecyclePolicyRuleAction]
$creadList :: ReadS [LifecyclePolicyRuleAction]
readsPrec :: Int -> ReadS LifecyclePolicyRuleAction
$creadsPrec :: Int -> ReadS LifecyclePolicyRuleAction
Prelude.Read, Int -> LifecyclePolicyRuleAction -> ShowS
[LifecyclePolicyRuleAction] -> ShowS
LifecyclePolicyRuleAction -> String
(Int -> LifecyclePolicyRuleAction -> ShowS)
-> (LifecyclePolicyRuleAction -> String)
-> ([LifecyclePolicyRuleAction] -> ShowS)
-> Show LifecyclePolicyRuleAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LifecyclePolicyRuleAction] -> ShowS
$cshowList :: [LifecyclePolicyRuleAction] -> ShowS
show :: LifecyclePolicyRuleAction -> String
$cshow :: LifecyclePolicyRuleAction -> String
showsPrec :: Int -> LifecyclePolicyRuleAction -> ShowS
$cshowsPrec :: Int -> LifecyclePolicyRuleAction -> ShowS
Prelude.Show, (forall x.
 LifecyclePolicyRuleAction -> Rep LifecyclePolicyRuleAction x)
-> (forall x.
    Rep LifecyclePolicyRuleAction x -> LifecyclePolicyRuleAction)
-> Generic LifecyclePolicyRuleAction
forall x.
Rep LifecyclePolicyRuleAction x -> LifecyclePolicyRuleAction
forall x.
LifecyclePolicyRuleAction -> Rep LifecyclePolicyRuleAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LifecyclePolicyRuleAction x -> LifecyclePolicyRuleAction
$cfrom :: forall x.
LifecyclePolicyRuleAction -> Rep LifecyclePolicyRuleAction x
Prelude.Generic)

-- |
-- Create a value of 'LifecyclePolicyRuleAction' 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:
--
-- 'type'', 'lifecyclePolicyRuleAction_type' - The type of action to be taken.
newLifecyclePolicyRuleAction ::
  LifecyclePolicyRuleAction
newLifecyclePolicyRuleAction :: LifecyclePolicyRuleAction
newLifecyclePolicyRuleAction =
  LifecyclePolicyRuleAction' :: Maybe ImageActionType -> LifecyclePolicyRuleAction
LifecyclePolicyRuleAction' {$sel:type':LifecyclePolicyRuleAction' :: Maybe ImageActionType
type' = Maybe ImageActionType
forall a. Maybe a
Prelude.Nothing}

-- | The type of action to be taken.
lifecyclePolicyRuleAction_type :: Lens.Lens' LifecyclePolicyRuleAction (Prelude.Maybe ImageActionType)
lifecyclePolicyRuleAction_type :: (Maybe ImageActionType -> f (Maybe ImageActionType))
-> LifecyclePolicyRuleAction -> f LifecyclePolicyRuleAction
lifecyclePolicyRuleAction_type = (LifecyclePolicyRuleAction -> Maybe ImageActionType)
-> (LifecyclePolicyRuleAction
    -> Maybe ImageActionType -> LifecyclePolicyRuleAction)
-> Lens
     LifecyclePolicyRuleAction
     LifecyclePolicyRuleAction
     (Maybe ImageActionType)
     (Maybe ImageActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicyRuleAction' {Maybe ImageActionType
type' :: Maybe ImageActionType
$sel:type':LifecyclePolicyRuleAction' :: LifecyclePolicyRuleAction -> Maybe ImageActionType
type'} -> Maybe ImageActionType
type') (\s :: LifecyclePolicyRuleAction
s@LifecyclePolicyRuleAction' {} Maybe ImageActionType
a -> LifecyclePolicyRuleAction
s {$sel:type':LifecyclePolicyRuleAction' :: Maybe ImageActionType
type' = Maybe ImageActionType
a} :: LifecyclePolicyRuleAction)

instance Core.FromJSON LifecyclePolicyRuleAction where
  parseJSON :: Value -> Parser LifecyclePolicyRuleAction
parseJSON =
    String
-> (Object -> Parser LifecyclePolicyRuleAction)
-> Value
-> Parser LifecyclePolicyRuleAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LifecyclePolicyRuleAction"
      ( \Object
x ->
          Maybe ImageActionType -> LifecyclePolicyRuleAction
LifecyclePolicyRuleAction'
            (Maybe ImageActionType -> LifecyclePolicyRuleAction)
-> Parser (Maybe ImageActionType)
-> Parser LifecyclePolicyRuleAction
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ImageActionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable LifecyclePolicyRuleAction

instance Prelude.NFData LifecyclePolicyRuleAction