{-# 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.Inspector2.Types.EcrRescanDurationState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Inspector2.Types.EcrRescanDurationState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.EcrRescanDuration
import Amazonka.Inspector2.Types.EcrRescanDurationStatus
import qualified Amazonka.Prelude as Prelude

-- | Details about the state of any changes to the ECR automated re-scan
-- duration setting.
--
-- /See:/ 'newEcrRescanDurationState' smart constructor.
data EcrRescanDurationState = EcrRescanDurationState'
  { -- | The ECR automated re-scan duration defines how long an ECR image will be
    -- actively scanned by Amazon Inspector. When the number of days since an
    -- image was last pushed exceeds the automated re-scan duration the
    -- monitoring state of that image becomes @inactive@ and all associated
    -- findings are scheduled for closure.
    EcrRescanDurationState -> Maybe EcrRescanDuration
rescanDuration :: Prelude.Maybe EcrRescanDuration,
    -- | The status of changes to the ECR automated re-scan duration.
    EcrRescanDurationState -> Maybe EcrRescanDurationStatus
status :: Prelude.Maybe EcrRescanDurationStatus,
    -- | A timestamp representing when the last time the ECR scan duration
    -- setting was changed.
    EcrRescanDurationState -> Maybe POSIX
updatedAt :: Prelude.Maybe Data.POSIX
  }
  deriving (EcrRescanDurationState -> EcrRescanDurationState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EcrRescanDurationState -> EcrRescanDurationState -> Bool
$c/= :: EcrRescanDurationState -> EcrRescanDurationState -> Bool
== :: EcrRescanDurationState -> EcrRescanDurationState -> Bool
$c== :: EcrRescanDurationState -> EcrRescanDurationState -> Bool
Prelude.Eq, ReadPrec [EcrRescanDurationState]
ReadPrec EcrRescanDurationState
Int -> ReadS EcrRescanDurationState
ReadS [EcrRescanDurationState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EcrRescanDurationState]
$creadListPrec :: ReadPrec [EcrRescanDurationState]
readPrec :: ReadPrec EcrRescanDurationState
$creadPrec :: ReadPrec EcrRescanDurationState
readList :: ReadS [EcrRescanDurationState]
$creadList :: ReadS [EcrRescanDurationState]
readsPrec :: Int -> ReadS EcrRescanDurationState
$creadsPrec :: Int -> ReadS EcrRescanDurationState
Prelude.Read, Int -> EcrRescanDurationState -> ShowS
[EcrRescanDurationState] -> ShowS
EcrRescanDurationState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EcrRescanDurationState] -> ShowS
$cshowList :: [EcrRescanDurationState] -> ShowS
show :: EcrRescanDurationState -> String
$cshow :: EcrRescanDurationState -> String
showsPrec :: Int -> EcrRescanDurationState -> ShowS
$cshowsPrec :: Int -> EcrRescanDurationState -> ShowS
Prelude.Show, forall x. Rep EcrRescanDurationState x -> EcrRescanDurationState
forall x. EcrRescanDurationState -> Rep EcrRescanDurationState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EcrRescanDurationState x -> EcrRescanDurationState
$cfrom :: forall x. EcrRescanDurationState -> Rep EcrRescanDurationState x
Prelude.Generic)

-- |
-- Create a value of 'EcrRescanDurationState' 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:
--
-- 'rescanDuration', 'ecrRescanDurationState_rescanDuration' - The ECR automated re-scan duration defines how long an ECR image will be
-- actively scanned by Amazon Inspector. When the number of days since an
-- image was last pushed exceeds the automated re-scan duration the
-- monitoring state of that image becomes @inactive@ and all associated
-- findings are scheduled for closure.
--
-- 'status', 'ecrRescanDurationState_status' - The status of changes to the ECR automated re-scan duration.
--
-- 'updatedAt', 'ecrRescanDurationState_updatedAt' - A timestamp representing when the last time the ECR scan duration
-- setting was changed.
newEcrRescanDurationState ::
  EcrRescanDurationState
newEcrRescanDurationState :: EcrRescanDurationState
newEcrRescanDurationState =
  EcrRescanDurationState'
    { $sel:rescanDuration:EcrRescanDurationState' :: Maybe EcrRescanDuration
rescanDuration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:status:EcrRescanDurationState' :: Maybe EcrRescanDurationStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:EcrRescanDurationState' :: Maybe POSIX
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The ECR automated re-scan duration defines how long an ECR image will be
-- actively scanned by Amazon Inspector. When the number of days since an
-- image was last pushed exceeds the automated re-scan duration the
-- monitoring state of that image becomes @inactive@ and all associated
-- findings are scheduled for closure.
ecrRescanDurationState_rescanDuration :: Lens.Lens' EcrRescanDurationState (Prelude.Maybe EcrRescanDuration)
ecrRescanDurationState_rescanDuration :: Lens' EcrRescanDurationState (Maybe EcrRescanDuration)
ecrRescanDurationState_rescanDuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcrRescanDurationState' {Maybe EcrRescanDuration
rescanDuration :: Maybe EcrRescanDuration
$sel:rescanDuration:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDuration
rescanDuration} -> Maybe EcrRescanDuration
rescanDuration) (\s :: EcrRescanDurationState
s@EcrRescanDurationState' {} Maybe EcrRescanDuration
a -> EcrRescanDurationState
s {$sel:rescanDuration:EcrRescanDurationState' :: Maybe EcrRescanDuration
rescanDuration = Maybe EcrRescanDuration
a} :: EcrRescanDurationState)

-- | The status of changes to the ECR automated re-scan duration.
ecrRescanDurationState_status :: Lens.Lens' EcrRescanDurationState (Prelude.Maybe EcrRescanDurationStatus)
ecrRescanDurationState_status :: Lens' EcrRescanDurationState (Maybe EcrRescanDurationStatus)
ecrRescanDurationState_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcrRescanDurationState' {Maybe EcrRescanDurationStatus
status :: Maybe EcrRescanDurationStatus
$sel:status:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDurationStatus
status} -> Maybe EcrRescanDurationStatus
status) (\s :: EcrRescanDurationState
s@EcrRescanDurationState' {} Maybe EcrRescanDurationStatus
a -> EcrRescanDurationState
s {$sel:status:EcrRescanDurationState' :: Maybe EcrRescanDurationStatus
status = Maybe EcrRescanDurationStatus
a} :: EcrRescanDurationState)

-- | A timestamp representing when the last time the ECR scan duration
-- setting was changed.
ecrRescanDurationState_updatedAt :: Lens.Lens' EcrRescanDurationState (Prelude.Maybe Prelude.UTCTime)
ecrRescanDurationState_updatedAt :: Lens' EcrRescanDurationState (Maybe UTCTime)
ecrRescanDurationState_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EcrRescanDurationState' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: EcrRescanDurationState
s@EcrRescanDurationState' {} Maybe POSIX
a -> EcrRescanDurationState
s {$sel:updatedAt:EcrRescanDurationState' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: EcrRescanDurationState) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON EcrRescanDurationState where
  parseJSON :: Value -> Parser EcrRescanDurationState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EcrRescanDurationState"
      ( \Object
x ->
          Maybe EcrRescanDuration
-> Maybe EcrRescanDurationStatus
-> Maybe POSIX
-> EcrRescanDurationState
EcrRescanDurationState'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"rescanDuration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"updatedAt")
      )

instance Prelude.Hashable EcrRescanDurationState where
  hashWithSalt :: Int -> EcrRescanDurationState -> Int
hashWithSalt Int
_salt EcrRescanDurationState' {Maybe POSIX
Maybe EcrRescanDuration
Maybe EcrRescanDurationStatus
updatedAt :: Maybe POSIX
status :: Maybe EcrRescanDurationStatus
rescanDuration :: Maybe EcrRescanDuration
$sel:updatedAt:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe POSIX
$sel:status:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDurationStatus
$sel:rescanDuration:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDuration
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EcrRescanDuration
rescanDuration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EcrRescanDurationStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
updatedAt

instance Prelude.NFData EcrRescanDurationState where
  rnf :: EcrRescanDurationState -> ()
rnf EcrRescanDurationState' {Maybe POSIX
Maybe EcrRescanDuration
Maybe EcrRescanDurationStatus
updatedAt :: Maybe POSIX
status :: Maybe EcrRescanDurationStatus
rescanDuration :: Maybe EcrRescanDuration
$sel:updatedAt:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe POSIX
$sel:status:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDurationStatus
$sel:rescanDuration:EcrRescanDurationState' :: EcrRescanDurationState -> Maybe EcrRescanDuration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EcrRescanDuration
rescanDuration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EcrRescanDurationStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
updatedAt