{-# 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.NetworkFirewall.Types.PerObjectStatus
-- 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.NetworkFirewall.Types.PerObjectStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkFirewall.Types.PerObjectSyncStatus
import qualified Amazonka.Prelude as Prelude

-- | Provides configuration status for a single policy or rule group that is
-- used for a firewall endpoint. Network Firewall provides each endpoint
-- with the rules that are configured in the firewall policy. Each time you
-- add a subnet or modify the associated firewall policy, Network Firewall
-- synchronizes the rules in the endpoint, so it can properly filter
-- network traffic. This is part of a SyncState for a firewall.
--
-- /See:/ 'newPerObjectStatus' smart constructor.
data PerObjectStatus = PerObjectStatus'
  { -- | Indicates whether this object is in sync with the version indicated in
    -- the update token.
    PerObjectStatus -> Maybe PerObjectSyncStatus
syncStatus :: Prelude.Maybe PerObjectSyncStatus,
    -- | The current version of the object that is either in sync or pending
    -- synchronization.
    PerObjectStatus -> Maybe Text
updateToken :: Prelude.Maybe Prelude.Text
  }
  deriving (PerObjectStatus -> PerObjectStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PerObjectStatus -> PerObjectStatus -> Bool
$c/= :: PerObjectStatus -> PerObjectStatus -> Bool
== :: PerObjectStatus -> PerObjectStatus -> Bool
$c== :: PerObjectStatus -> PerObjectStatus -> Bool
Prelude.Eq, ReadPrec [PerObjectStatus]
ReadPrec PerObjectStatus
Int -> ReadS PerObjectStatus
ReadS [PerObjectStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PerObjectStatus]
$creadListPrec :: ReadPrec [PerObjectStatus]
readPrec :: ReadPrec PerObjectStatus
$creadPrec :: ReadPrec PerObjectStatus
readList :: ReadS [PerObjectStatus]
$creadList :: ReadS [PerObjectStatus]
readsPrec :: Int -> ReadS PerObjectStatus
$creadsPrec :: Int -> ReadS PerObjectStatus
Prelude.Read, Int -> PerObjectStatus -> ShowS
[PerObjectStatus] -> ShowS
PerObjectStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PerObjectStatus] -> ShowS
$cshowList :: [PerObjectStatus] -> ShowS
show :: PerObjectStatus -> String
$cshow :: PerObjectStatus -> String
showsPrec :: Int -> PerObjectStatus -> ShowS
$cshowsPrec :: Int -> PerObjectStatus -> ShowS
Prelude.Show, forall x. Rep PerObjectStatus x -> PerObjectStatus
forall x. PerObjectStatus -> Rep PerObjectStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PerObjectStatus x -> PerObjectStatus
$cfrom :: forall x. PerObjectStatus -> Rep PerObjectStatus x
Prelude.Generic)

-- |
-- Create a value of 'PerObjectStatus' 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:
--
-- 'syncStatus', 'perObjectStatus_syncStatus' - Indicates whether this object is in sync with the version indicated in
-- the update token.
--
-- 'updateToken', 'perObjectStatus_updateToken' - The current version of the object that is either in sync or pending
-- synchronization.
newPerObjectStatus ::
  PerObjectStatus
newPerObjectStatus :: PerObjectStatus
newPerObjectStatus =
  PerObjectStatus'
    { $sel:syncStatus:PerObjectStatus' :: Maybe PerObjectSyncStatus
syncStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:updateToken:PerObjectStatus' :: Maybe Text
updateToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether this object is in sync with the version indicated in
-- the update token.
perObjectStatus_syncStatus :: Lens.Lens' PerObjectStatus (Prelude.Maybe PerObjectSyncStatus)
perObjectStatus_syncStatus :: Lens' PerObjectStatus (Maybe PerObjectSyncStatus)
perObjectStatus_syncStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerObjectStatus' {Maybe PerObjectSyncStatus
syncStatus :: Maybe PerObjectSyncStatus
$sel:syncStatus:PerObjectStatus' :: PerObjectStatus -> Maybe PerObjectSyncStatus
syncStatus} -> Maybe PerObjectSyncStatus
syncStatus) (\s :: PerObjectStatus
s@PerObjectStatus' {} Maybe PerObjectSyncStatus
a -> PerObjectStatus
s {$sel:syncStatus:PerObjectStatus' :: Maybe PerObjectSyncStatus
syncStatus = Maybe PerObjectSyncStatus
a} :: PerObjectStatus)

-- | The current version of the object that is either in sync or pending
-- synchronization.
perObjectStatus_updateToken :: Lens.Lens' PerObjectStatus (Prelude.Maybe Prelude.Text)
perObjectStatus_updateToken :: Lens' PerObjectStatus (Maybe Text)
perObjectStatus_updateToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PerObjectStatus' {Maybe Text
updateToken :: Maybe Text
$sel:updateToken:PerObjectStatus' :: PerObjectStatus -> Maybe Text
updateToken} -> Maybe Text
updateToken) (\s :: PerObjectStatus
s@PerObjectStatus' {} Maybe Text
a -> PerObjectStatus
s {$sel:updateToken:PerObjectStatus' :: Maybe Text
updateToken = Maybe Text
a} :: PerObjectStatus)

instance Data.FromJSON PerObjectStatus where
  parseJSON :: Value -> Parser PerObjectStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PerObjectStatus"
      ( \Object
x ->
          Maybe PerObjectSyncStatus -> Maybe Text -> PerObjectStatus
PerObjectStatus'
            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
"SyncStatus")
            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
"UpdateToken")
      )

instance Prelude.Hashable PerObjectStatus where
  hashWithSalt :: Int -> PerObjectStatus -> Int
hashWithSalt Int
_salt PerObjectStatus' {Maybe Text
Maybe PerObjectSyncStatus
updateToken :: Maybe Text
syncStatus :: Maybe PerObjectSyncStatus
$sel:updateToken:PerObjectStatus' :: PerObjectStatus -> Maybe Text
$sel:syncStatus:PerObjectStatus' :: PerObjectStatus -> Maybe PerObjectSyncStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PerObjectSyncStatus
syncStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
updateToken

instance Prelude.NFData PerObjectStatus where
  rnf :: PerObjectStatus -> ()
rnf PerObjectStatus' {Maybe Text
Maybe PerObjectSyncStatus
updateToken :: Maybe Text
syncStatus :: Maybe PerObjectSyncStatus
$sel:updateToken:PerObjectStatus' :: PerObjectStatus -> Maybe Text
$sel:syncStatus:PerObjectStatus' :: PerObjectStatus -> Maybe PerObjectSyncStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PerObjectSyncStatus
syncStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
updateToken