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

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

-- | The result of the lifecycle policy preview.
--
-- /See:/ 'newLifecyclePolicyPreviewResult' smart constructor.
data LifecyclePolicyPreviewResult = LifecyclePolicyPreviewResult'
  { -- | The list of tags associated with this image.
    LifecyclePolicyPreviewResult -> Maybe [Text]
imageTags :: Prelude.Maybe [Prelude.Text],
    -- | The type of action to be taken.
    LifecyclePolicyPreviewResult -> Maybe LifecyclePolicyRuleAction
action :: Prelude.Maybe LifecyclePolicyRuleAction,
    -- | The @sha256@ digest of the image manifest.
    LifecyclePolicyPreviewResult -> Maybe Text
imageDigest :: Prelude.Maybe Prelude.Text,
    -- | The date and time, expressed in standard JavaScript date format, at
    -- which the current image was pushed to the repository.
    LifecyclePolicyPreviewResult -> Maybe POSIX
imagePushedAt :: Prelude.Maybe Core.POSIX,
    -- | The priority of the applied rule.
    LifecyclePolicyPreviewResult -> Maybe Natural
appliedRulePriority :: Prelude.Maybe Prelude.Natural
  }
  deriving (LifecyclePolicyPreviewResult
-> LifecyclePolicyPreviewResult -> Bool
(LifecyclePolicyPreviewResult
 -> LifecyclePolicyPreviewResult -> Bool)
-> (LifecyclePolicyPreviewResult
    -> LifecyclePolicyPreviewResult -> Bool)
-> Eq LifecyclePolicyPreviewResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LifecyclePolicyPreviewResult
-> LifecyclePolicyPreviewResult -> Bool
$c/= :: LifecyclePolicyPreviewResult
-> LifecyclePolicyPreviewResult -> Bool
== :: LifecyclePolicyPreviewResult
-> LifecyclePolicyPreviewResult -> Bool
$c== :: LifecyclePolicyPreviewResult
-> LifecyclePolicyPreviewResult -> Bool
Prelude.Eq, ReadPrec [LifecyclePolicyPreviewResult]
ReadPrec LifecyclePolicyPreviewResult
Int -> ReadS LifecyclePolicyPreviewResult
ReadS [LifecyclePolicyPreviewResult]
(Int -> ReadS LifecyclePolicyPreviewResult)
-> ReadS [LifecyclePolicyPreviewResult]
-> ReadPrec LifecyclePolicyPreviewResult
-> ReadPrec [LifecyclePolicyPreviewResult]
-> Read LifecyclePolicyPreviewResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LifecyclePolicyPreviewResult]
$creadListPrec :: ReadPrec [LifecyclePolicyPreviewResult]
readPrec :: ReadPrec LifecyclePolicyPreviewResult
$creadPrec :: ReadPrec LifecyclePolicyPreviewResult
readList :: ReadS [LifecyclePolicyPreviewResult]
$creadList :: ReadS [LifecyclePolicyPreviewResult]
readsPrec :: Int -> ReadS LifecyclePolicyPreviewResult
$creadsPrec :: Int -> ReadS LifecyclePolicyPreviewResult
Prelude.Read, Int -> LifecyclePolicyPreviewResult -> ShowS
[LifecyclePolicyPreviewResult] -> ShowS
LifecyclePolicyPreviewResult -> String
(Int -> LifecyclePolicyPreviewResult -> ShowS)
-> (LifecyclePolicyPreviewResult -> String)
-> ([LifecyclePolicyPreviewResult] -> ShowS)
-> Show LifecyclePolicyPreviewResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LifecyclePolicyPreviewResult] -> ShowS
$cshowList :: [LifecyclePolicyPreviewResult] -> ShowS
show :: LifecyclePolicyPreviewResult -> String
$cshow :: LifecyclePolicyPreviewResult -> String
showsPrec :: Int -> LifecyclePolicyPreviewResult -> ShowS
$cshowsPrec :: Int -> LifecyclePolicyPreviewResult -> ShowS
Prelude.Show, (forall x.
 LifecyclePolicyPreviewResult -> Rep LifecyclePolicyPreviewResult x)
-> (forall x.
    Rep LifecyclePolicyPreviewResult x -> LifecyclePolicyPreviewResult)
-> Generic LifecyclePolicyPreviewResult
forall x.
Rep LifecyclePolicyPreviewResult x -> LifecyclePolicyPreviewResult
forall x.
LifecyclePolicyPreviewResult -> Rep LifecyclePolicyPreviewResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LifecyclePolicyPreviewResult x -> LifecyclePolicyPreviewResult
$cfrom :: forall x.
LifecyclePolicyPreviewResult -> Rep LifecyclePolicyPreviewResult x
Prelude.Generic)

-- |
-- Create a value of 'LifecyclePolicyPreviewResult' 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:
--
-- 'imageTags', 'lifecyclePolicyPreviewResult_imageTags' - The list of tags associated with this image.
--
-- 'action', 'lifecyclePolicyPreviewResult_action' - The type of action to be taken.
--
-- 'imageDigest', 'lifecyclePolicyPreviewResult_imageDigest' - The @sha256@ digest of the image manifest.
--
-- 'imagePushedAt', 'lifecyclePolicyPreviewResult_imagePushedAt' - The date and time, expressed in standard JavaScript date format, at
-- which the current image was pushed to the repository.
--
-- 'appliedRulePriority', 'lifecyclePolicyPreviewResult_appliedRulePriority' - The priority of the applied rule.
newLifecyclePolicyPreviewResult ::
  LifecyclePolicyPreviewResult
newLifecyclePolicyPreviewResult :: LifecyclePolicyPreviewResult
newLifecyclePolicyPreviewResult =
  LifecyclePolicyPreviewResult' :: Maybe [Text]
-> Maybe LifecyclePolicyRuleAction
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> LifecyclePolicyPreviewResult
LifecyclePolicyPreviewResult'
    { $sel:imageTags:LifecyclePolicyPreviewResult' :: Maybe [Text]
imageTags =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:action:LifecyclePolicyPreviewResult' :: Maybe LifecyclePolicyRuleAction
action = Maybe LifecyclePolicyRuleAction
forall a. Maybe a
Prelude.Nothing,
      $sel:imageDigest:LifecyclePolicyPreviewResult' :: Maybe Text
imageDigest = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imagePushedAt:LifecyclePolicyPreviewResult' :: Maybe POSIX
imagePushedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:appliedRulePriority:LifecyclePolicyPreviewResult' :: Maybe Natural
appliedRulePriority = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of tags associated with this image.
lifecyclePolicyPreviewResult_imageTags :: Lens.Lens' LifecyclePolicyPreviewResult (Prelude.Maybe [Prelude.Text])
lifecyclePolicyPreviewResult_imageTags :: (Maybe [Text] -> f (Maybe [Text]))
-> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult
lifecyclePolicyPreviewResult_imageTags = (LifecyclePolicyPreviewResult -> Maybe [Text])
-> (LifecyclePolicyPreviewResult
    -> Maybe [Text] -> LifecyclePolicyPreviewResult)
-> Lens
     LifecyclePolicyPreviewResult
     LifecyclePolicyPreviewResult
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicyPreviewResult' {Maybe [Text]
imageTags :: Maybe [Text]
$sel:imageTags:LifecyclePolicyPreviewResult' :: LifecyclePolicyPreviewResult -> Maybe [Text]
imageTags} -> Maybe [Text]
imageTags) (\s :: LifecyclePolicyPreviewResult
s@LifecyclePolicyPreviewResult' {} Maybe [Text]
a -> LifecyclePolicyPreviewResult
s {$sel:imageTags:LifecyclePolicyPreviewResult' :: Maybe [Text]
imageTags = Maybe [Text]
a} :: LifecyclePolicyPreviewResult) ((Maybe [Text] -> f (Maybe [Text]))
 -> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> LifecyclePolicyPreviewResult
-> f LifecyclePolicyPreviewResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The @sha256@ digest of the image manifest.
lifecyclePolicyPreviewResult_imageDigest :: Lens.Lens' LifecyclePolicyPreviewResult (Prelude.Maybe Prelude.Text)
lifecyclePolicyPreviewResult_imageDigest :: (Maybe Text -> f (Maybe Text))
-> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult
lifecyclePolicyPreviewResult_imageDigest = (LifecyclePolicyPreviewResult -> Maybe Text)
-> (LifecyclePolicyPreviewResult
    -> Maybe Text -> LifecyclePolicyPreviewResult)
-> Lens
     LifecyclePolicyPreviewResult
     LifecyclePolicyPreviewResult
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicyPreviewResult' {Maybe Text
imageDigest :: Maybe Text
$sel:imageDigest:LifecyclePolicyPreviewResult' :: LifecyclePolicyPreviewResult -> Maybe Text
imageDigest} -> Maybe Text
imageDigest) (\s :: LifecyclePolicyPreviewResult
s@LifecyclePolicyPreviewResult' {} Maybe Text
a -> LifecyclePolicyPreviewResult
s {$sel:imageDigest:LifecyclePolicyPreviewResult' :: Maybe Text
imageDigest = Maybe Text
a} :: LifecyclePolicyPreviewResult)

-- | The date and time, expressed in standard JavaScript date format, at
-- which the current image was pushed to the repository.
lifecyclePolicyPreviewResult_imagePushedAt :: Lens.Lens' LifecyclePolicyPreviewResult (Prelude.Maybe Prelude.UTCTime)
lifecyclePolicyPreviewResult_imagePushedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult
lifecyclePolicyPreviewResult_imagePushedAt = (LifecyclePolicyPreviewResult -> Maybe POSIX)
-> (LifecyclePolicyPreviewResult
    -> Maybe POSIX -> LifecyclePolicyPreviewResult)
-> Lens
     LifecyclePolicyPreviewResult
     LifecyclePolicyPreviewResult
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicyPreviewResult' {Maybe POSIX
imagePushedAt :: Maybe POSIX
$sel:imagePushedAt:LifecyclePolicyPreviewResult' :: LifecyclePolicyPreviewResult -> Maybe POSIX
imagePushedAt} -> Maybe POSIX
imagePushedAt) (\s :: LifecyclePolicyPreviewResult
s@LifecyclePolicyPreviewResult' {} Maybe POSIX
a -> LifecyclePolicyPreviewResult
s {$sel:imagePushedAt:LifecyclePolicyPreviewResult' :: Maybe POSIX
imagePushedAt = Maybe POSIX
a} :: LifecyclePolicyPreviewResult) ((Maybe POSIX -> f (Maybe POSIX))
 -> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LifecyclePolicyPreviewResult
-> f LifecyclePolicyPreviewResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The priority of the applied rule.
lifecyclePolicyPreviewResult_appliedRulePriority :: Lens.Lens' LifecyclePolicyPreviewResult (Prelude.Maybe Prelude.Natural)
lifecyclePolicyPreviewResult_appliedRulePriority :: (Maybe Natural -> f (Maybe Natural))
-> LifecyclePolicyPreviewResult -> f LifecyclePolicyPreviewResult
lifecyclePolicyPreviewResult_appliedRulePriority = (LifecyclePolicyPreviewResult -> Maybe Natural)
-> (LifecyclePolicyPreviewResult
    -> Maybe Natural -> LifecyclePolicyPreviewResult)
-> Lens
     LifecyclePolicyPreviewResult
     LifecyclePolicyPreviewResult
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LifecyclePolicyPreviewResult' {Maybe Natural
appliedRulePriority :: Maybe Natural
$sel:appliedRulePriority:LifecyclePolicyPreviewResult' :: LifecyclePolicyPreviewResult -> Maybe Natural
appliedRulePriority} -> Maybe Natural
appliedRulePriority) (\s :: LifecyclePolicyPreviewResult
s@LifecyclePolicyPreviewResult' {} Maybe Natural
a -> LifecyclePolicyPreviewResult
s {$sel:appliedRulePriority:LifecyclePolicyPreviewResult' :: Maybe Natural
appliedRulePriority = Maybe Natural
a} :: LifecyclePolicyPreviewResult)

instance Core.FromJSON LifecyclePolicyPreviewResult where
  parseJSON :: Value -> Parser LifecyclePolicyPreviewResult
parseJSON =
    String
-> (Object -> Parser LifecyclePolicyPreviewResult)
-> Value
-> Parser LifecyclePolicyPreviewResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LifecyclePolicyPreviewResult"
      ( \Object
x ->
          Maybe [Text]
-> Maybe LifecyclePolicyRuleAction
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> LifecyclePolicyPreviewResult
LifecyclePolicyPreviewResult'
            (Maybe [Text]
 -> Maybe LifecyclePolicyRuleAction
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Natural
 -> LifecyclePolicyPreviewResult)
-> Parser (Maybe [Text])
-> Parser
     (Maybe LifecyclePolicyRuleAction
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Natural
      -> LifecyclePolicyPreviewResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageTags" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe LifecyclePolicyRuleAction
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Natural
   -> LifecyclePolicyPreviewResult)
-> Parser (Maybe LifecyclePolicyRuleAction)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Natural -> LifecyclePolicyPreviewResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LifecyclePolicyRuleAction)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"action")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Natural -> LifecyclePolicyPreviewResult)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Natural -> LifecyclePolicyPreviewResult)
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
"imageDigest")
            Parser
  (Maybe POSIX -> Maybe Natural -> LifecyclePolicyPreviewResult)
-> Parser (Maybe POSIX)
-> Parser (Maybe Natural -> LifecyclePolicyPreviewResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imagePushedAt")
            Parser (Maybe Natural -> LifecyclePolicyPreviewResult)
-> Parser (Maybe Natural) -> Parser LifecyclePolicyPreviewResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"appliedRulePriority")
      )

instance
  Prelude.Hashable
    LifecyclePolicyPreviewResult

instance Prelude.NFData LifecyclePolicyPreviewResult