{-# 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.AccessAnalyzer.Types.ArchiveRuleSummary
-- 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.AccessAnalyzer.Types.ArchiveRuleSummary where

import Amazonka.AccessAnalyzer.Types.Criterion
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an archive rule.
--
-- /See:/ 'newArchiveRuleSummary' smart constructor.
data ArchiveRuleSummary = ArchiveRuleSummary'
  { -- | The name of the archive rule.
    ArchiveRuleSummary -> Text
ruleName :: Prelude.Text,
    -- | A filter used to define the archive rule.
    ArchiveRuleSummary -> HashMap Text Criterion
filter' :: Prelude.HashMap Prelude.Text Criterion,
    -- | The time at which the archive rule was created.
    ArchiveRuleSummary -> ISO8601
createdAt :: Data.ISO8601,
    -- | The time at which the archive rule was last updated.
    ArchiveRuleSummary -> ISO8601
updatedAt :: Data.ISO8601
  }
  deriving (ArchiveRuleSummary -> ArchiveRuleSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveRuleSummary -> ArchiveRuleSummary -> Bool
$c/= :: ArchiveRuleSummary -> ArchiveRuleSummary -> Bool
== :: ArchiveRuleSummary -> ArchiveRuleSummary -> Bool
$c== :: ArchiveRuleSummary -> ArchiveRuleSummary -> Bool
Prelude.Eq, ReadPrec [ArchiveRuleSummary]
ReadPrec ArchiveRuleSummary
Int -> ReadS ArchiveRuleSummary
ReadS [ArchiveRuleSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveRuleSummary]
$creadListPrec :: ReadPrec [ArchiveRuleSummary]
readPrec :: ReadPrec ArchiveRuleSummary
$creadPrec :: ReadPrec ArchiveRuleSummary
readList :: ReadS [ArchiveRuleSummary]
$creadList :: ReadS [ArchiveRuleSummary]
readsPrec :: Int -> ReadS ArchiveRuleSummary
$creadsPrec :: Int -> ReadS ArchiveRuleSummary
Prelude.Read, Int -> ArchiveRuleSummary -> ShowS
[ArchiveRuleSummary] -> ShowS
ArchiveRuleSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveRuleSummary] -> ShowS
$cshowList :: [ArchiveRuleSummary] -> ShowS
show :: ArchiveRuleSummary -> String
$cshow :: ArchiveRuleSummary -> String
showsPrec :: Int -> ArchiveRuleSummary -> ShowS
$cshowsPrec :: Int -> ArchiveRuleSummary -> ShowS
Prelude.Show, forall x. Rep ArchiveRuleSummary x -> ArchiveRuleSummary
forall x. ArchiveRuleSummary -> Rep ArchiveRuleSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchiveRuleSummary x -> ArchiveRuleSummary
$cfrom :: forall x. ArchiveRuleSummary -> Rep ArchiveRuleSummary x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveRuleSummary' 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:
--
-- 'ruleName', 'archiveRuleSummary_ruleName' - The name of the archive rule.
--
-- 'filter'', 'archiveRuleSummary_filter' - A filter used to define the archive rule.
--
-- 'createdAt', 'archiveRuleSummary_createdAt' - The time at which the archive rule was created.
--
-- 'updatedAt', 'archiveRuleSummary_updatedAt' - The time at which the archive rule was last updated.
newArchiveRuleSummary ::
  -- | 'ruleName'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  -- | 'updatedAt'
  Prelude.UTCTime ->
  ArchiveRuleSummary
newArchiveRuleSummary :: Text -> UTCTime -> UTCTime -> ArchiveRuleSummary
newArchiveRuleSummary
  Text
pRuleName_
  UTCTime
pCreatedAt_
  UTCTime
pUpdatedAt_ =
    ArchiveRuleSummary'
      { $sel:ruleName:ArchiveRuleSummary' :: Text
ruleName = Text
pRuleName_,
        $sel:filter':ArchiveRuleSummary' :: HashMap Text Criterion
filter' = forall a. Monoid a => a
Prelude.mempty,
        $sel:createdAt:ArchiveRuleSummary' :: ISO8601
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_,
        $sel:updatedAt:ArchiveRuleSummary' :: ISO8601
updatedAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pUpdatedAt_
      }

-- | The name of the archive rule.
archiveRuleSummary_ruleName :: Lens.Lens' ArchiveRuleSummary Prelude.Text
archiveRuleSummary_ruleName :: Lens' ArchiveRuleSummary Text
archiveRuleSummary_ruleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveRuleSummary' {Text
ruleName :: Text
$sel:ruleName:ArchiveRuleSummary' :: ArchiveRuleSummary -> Text
ruleName} -> Text
ruleName) (\s :: ArchiveRuleSummary
s@ArchiveRuleSummary' {} Text
a -> ArchiveRuleSummary
s {$sel:ruleName:ArchiveRuleSummary' :: Text
ruleName = Text
a} :: ArchiveRuleSummary)

-- | A filter used to define the archive rule.
archiveRuleSummary_filter :: Lens.Lens' ArchiveRuleSummary (Prelude.HashMap Prelude.Text Criterion)
archiveRuleSummary_filter :: Lens' ArchiveRuleSummary (HashMap Text Criterion)
archiveRuleSummary_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveRuleSummary' {HashMap Text Criterion
filter' :: HashMap Text Criterion
$sel:filter':ArchiveRuleSummary' :: ArchiveRuleSummary -> HashMap Text Criterion
filter'} -> HashMap Text Criterion
filter') (\s :: ArchiveRuleSummary
s@ArchiveRuleSummary' {} HashMap Text Criterion
a -> ArchiveRuleSummary
s {$sel:filter':ArchiveRuleSummary' :: HashMap Text Criterion
filter' = HashMap Text Criterion
a} :: ArchiveRuleSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The time at which the archive rule was created.
archiveRuleSummary_createdAt :: Lens.Lens' ArchiveRuleSummary Prelude.UTCTime
archiveRuleSummary_createdAt :: Lens' ArchiveRuleSummary UTCTime
archiveRuleSummary_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveRuleSummary' {ISO8601
createdAt :: ISO8601
$sel:createdAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
createdAt} -> ISO8601
createdAt) (\s :: ArchiveRuleSummary
s@ArchiveRuleSummary' {} ISO8601
a -> ArchiveRuleSummary
s {$sel:createdAt:ArchiveRuleSummary' :: ISO8601
createdAt = ISO8601
a} :: ArchiveRuleSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time at which the archive rule was last updated.
archiveRuleSummary_updatedAt :: Lens.Lens' ArchiveRuleSummary Prelude.UTCTime
archiveRuleSummary_updatedAt :: Lens' ArchiveRuleSummary UTCTime
archiveRuleSummary_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveRuleSummary' {ISO8601
updatedAt :: ISO8601
$sel:updatedAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
updatedAt} -> ISO8601
updatedAt) (\s :: ArchiveRuleSummary
s@ArchiveRuleSummary' {} ISO8601
a -> ArchiveRuleSummary
s {$sel:updatedAt:ArchiveRuleSummary' :: ISO8601
updatedAt = ISO8601
a} :: ArchiveRuleSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON ArchiveRuleSummary where
  parseJSON :: Value -> Parser ArchiveRuleSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ArchiveRuleSummary"
      ( \Object
x ->
          Text
-> HashMap Text Criterion
-> ISO8601
-> ISO8601
-> ArchiveRuleSummary
ArchiveRuleSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ruleName")
            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
"filter" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"updatedAt")
      )

instance Prelude.Hashable ArchiveRuleSummary where
  hashWithSalt :: Int -> ArchiveRuleSummary -> Int
hashWithSalt Int
_salt ArchiveRuleSummary' {Text
HashMap Text Criterion
ISO8601
updatedAt :: ISO8601
createdAt :: ISO8601
filter' :: HashMap Text Criterion
ruleName :: Text
$sel:updatedAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
$sel:createdAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
$sel:filter':ArchiveRuleSummary' :: ArchiveRuleSummary -> HashMap Text Criterion
$sel:ruleName:ArchiveRuleSummary' :: ArchiveRuleSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Text Criterion
filter'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
updatedAt

instance Prelude.NFData ArchiveRuleSummary where
  rnf :: ArchiveRuleSummary -> ()
rnf ArchiveRuleSummary' {Text
HashMap Text Criterion
ISO8601
updatedAt :: ISO8601
createdAt :: ISO8601
filter' :: HashMap Text Criterion
ruleName :: Text
$sel:updatedAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
$sel:createdAt:ArchiveRuleSummary' :: ArchiveRuleSummary -> ISO8601
$sel:filter':ArchiveRuleSummary' :: ArchiveRuleSummary -> HashMap Text Criterion
$sel:ruleName:ArchiveRuleSummary' :: ArchiveRuleSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
ruleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HashMap Text Criterion
filter'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
updatedAt