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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types.ConfigurationSyncState
import Amazonka.NetworkFirewall.Types.FirewallStatusValue
import Amazonka.NetworkFirewall.Types.SyncState
import qualified Amazonka.Prelude as Prelude

-- | Detailed information about the current status of a Firewall. You can
-- retrieve this for a firewall by calling DescribeFirewall and providing
-- the firewall name and ARN.
--
-- /See:/ 'newFirewallStatus' smart constructor.
data FirewallStatus = FirewallStatus'
  { -- | The subnets that you\'ve configured for use by the Network Firewall
    -- firewall. This contains one array element per Availability Zone where
    -- you\'ve configured a subnet. These objects provide details of the
    -- information that is summarized in the @ConfigurationSyncStateSummary@
    -- and @Status@, broken down by zone and configuration object.
    FirewallStatus -> Maybe (HashMap Text SyncState)
syncStates :: Prelude.Maybe (Prelude.HashMap Prelude.Text SyncState),
    -- | The readiness of the configured firewall to handle network traffic
    -- across all of the Availability Zones where you\'ve configured it. This
    -- setting is @READY@ only when the @ConfigurationSyncStateSummary@ value
    -- is @IN_SYNC@ and the @Attachment@ @Status@ values for all of the
    -- configured subnets are @READY@.
    FirewallStatus -> FirewallStatusValue
status :: FirewallStatusValue,
    -- | The configuration sync state for the firewall. This summarizes the sync
    -- states reported in the @Config@ settings for all of the Availability
    -- Zones where you have configured the firewall.
    --
    -- When you create a firewall or update its configuration, for example by
    -- adding a rule group to its firewall policy, Network Firewall distributes
    -- the configuration changes to all zones where the firewall is in use.
    -- This summary indicates whether the configuration changes have been
    -- applied everywhere.
    --
    -- This status must be @IN_SYNC@ for the firewall to be ready for use, but
    -- it doesn\'t indicate that the firewall is ready. The @Status@ setting
    -- indicates firewall readiness.
    FirewallStatus -> ConfigurationSyncState
configurationSyncStateSummary :: ConfigurationSyncState
  }
  deriving (FirewallStatus -> FirewallStatus -> Bool
(FirewallStatus -> FirewallStatus -> Bool)
-> (FirewallStatus -> FirewallStatus -> Bool) -> Eq FirewallStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirewallStatus -> FirewallStatus -> Bool
$c/= :: FirewallStatus -> FirewallStatus -> Bool
== :: FirewallStatus -> FirewallStatus -> Bool
$c== :: FirewallStatus -> FirewallStatus -> Bool
Prelude.Eq, ReadPrec [FirewallStatus]
ReadPrec FirewallStatus
Int -> ReadS FirewallStatus
ReadS [FirewallStatus]
(Int -> ReadS FirewallStatus)
-> ReadS [FirewallStatus]
-> ReadPrec FirewallStatus
-> ReadPrec [FirewallStatus]
-> Read FirewallStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirewallStatus]
$creadListPrec :: ReadPrec [FirewallStatus]
readPrec :: ReadPrec FirewallStatus
$creadPrec :: ReadPrec FirewallStatus
readList :: ReadS [FirewallStatus]
$creadList :: ReadS [FirewallStatus]
readsPrec :: Int -> ReadS FirewallStatus
$creadsPrec :: Int -> ReadS FirewallStatus
Prelude.Read, Int -> FirewallStatus -> ShowS
[FirewallStatus] -> ShowS
FirewallStatus -> String
(Int -> FirewallStatus -> ShowS)
-> (FirewallStatus -> String)
-> ([FirewallStatus] -> ShowS)
-> Show FirewallStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirewallStatus] -> ShowS
$cshowList :: [FirewallStatus] -> ShowS
show :: FirewallStatus -> String
$cshow :: FirewallStatus -> String
showsPrec :: Int -> FirewallStatus -> ShowS
$cshowsPrec :: Int -> FirewallStatus -> ShowS
Prelude.Show, (forall x. FirewallStatus -> Rep FirewallStatus x)
-> (forall x. Rep FirewallStatus x -> FirewallStatus)
-> Generic FirewallStatus
forall x. Rep FirewallStatus x -> FirewallStatus
forall x. FirewallStatus -> Rep FirewallStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirewallStatus x -> FirewallStatus
$cfrom :: forall x. FirewallStatus -> Rep FirewallStatus x
Prelude.Generic)

-- |
-- Create a value of 'FirewallStatus' 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:
--
-- 'syncStates', 'firewallStatus_syncStates' - The subnets that you\'ve configured for use by the Network Firewall
-- firewall. This contains one array element per Availability Zone where
-- you\'ve configured a subnet. These objects provide details of the
-- information that is summarized in the @ConfigurationSyncStateSummary@
-- and @Status@, broken down by zone and configuration object.
--
-- 'status', 'firewallStatus_status' - The readiness of the configured firewall to handle network traffic
-- across all of the Availability Zones where you\'ve configured it. This
-- setting is @READY@ only when the @ConfigurationSyncStateSummary@ value
-- is @IN_SYNC@ and the @Attachment@ @Status@ values for all of the
-- configured subnets are @READY@.
--
-- 'configurationSyncStateSummary', 'firewallStatus_configurationSyncStateSummary' - The configuration sync state for the firewall. This summarizes the sync
-- states reported in the @Config@ settings for all of the Availability
-- Zones where you have configured the firewall.
--
-- When you create a firewall or update its configuration, for example by
-- adding a rule group to its firewall policy, Network Firewall distributes
-- the configuration changes to all zones where the firewall is in use.
-- This summary indicates whether the configuration changes have been
-- applied everywhere.
--
-- This status must be @IN_SYNC@ for the firewall to be ready for use, but
-- it doesn\'t indicate that the firewall is ready. The @Status@ setting
-- indicates firewall readiness.
newFirewallStatus ::
  -- | 'status'
  FirewallStatusValue ->
  -- | 'configurationSyncStateSummary'
  ConfigurationSyncState ->
  FirewallStatus
newFirewallStatus :: FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus
newFirewallStatus
  FirewallStatusValue
pStatus_
  ConfigurationSyncState
pConfigurationSyncStateSummary_ =
    FirewallStatus' :: Maybe (HashMap Text SyncState)
-> FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus
FirewallStatus'
      { $sel:syncStates:FirewallStatus' :: Maybe (HashMap Text SyncState)
syncStates = Maybe (HashMap Text SyncState)
forall a. Maybe a
Prelude.Nothing,
        $sel:status:FirewallStatus' :: FirewallStatusValue
status = FirewallStatusValue
pStatus_,
        $sel:configurationSyncStateSummary:FirewallStatus' :: ConfigurationSyncState
configurationSyncStateSummary =
          ConfigurationSyncState
pConfigurationSyncStateSummary_
      }

-- | The subnets that you\'ve configured for use by the Network Firewall
-- firewall. This contains one array element per Availability Zone where
-- you\'ve configured a subnet. These objects provide details of the
-- information that is summarized in the @ConfigurationSyncStateSummary@
-- and @Status@, broken down by zone and configuration object.
firewallStatus_syncStates :: Lens.Lens' FirewallStatus (Prelude.Maybe (Prelude.HashMap Prelude.Text SyncState))
firewallStatus_syncStates :: (Maybe (HashMap Text SyncState)
 -> f (Maybe (HashMap Text SyncState)))
-> FirewallStatus -> f FirewallStatus
firewallStatus_syncStates = (FirewallStatus -> Maybe (HashMap Text SyncState))
-> (FirewallStatus
    -> Maybe (HashMap Text SyncState) -> FirewallStatus)
-> Lens
     FirewallStatus
     FirewallStatus
     (Maybe (HashMap Text SyncState))
     (Maybe (HashMap Text SyncState))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallStatus' {Maybe (HashMap Text SyncState)
syncStates :: Maybe (HashMap Text SyncState)
$sel:syncStates:FirewallStatus' :: FirewallStatus -> Maybe (HashMap Text SyncState)
syncStates} -> Maybe (HashMap Text SyncState)
syncStates) (\s :: FirewallStatus
s@FirewallStatus' {} Maybe (HashMap Text SyncState)
a -> FirewallStatus
s {$sel:syncStates:FirewallStatus' :: Maybe (HashMap Text SyncState)
syncStates = Maybe (HashMap Text SyncState)
a} :: FirewallStatus) ((Maybe (HashMap Text SyncState)
  -> f (Maybe (HashMap Text SyncState)))
 -> FirewallStatus -> f FirewallStatus)
-> ((Maybe (HashMap Text SyncState)
     -> f (Maybe (HashMap Text SyncState)))
    -> Maybe (HashMap Text SyncState)
    -> f (Maybe (HashMap Text SyncState)))
-> (Maybe (HashMap Text SyncState)
    -> f (Maybe (HashMap Text SyncState)))
-> FirewallStatus
-> f FirewallStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text SyncState)
  (HashMap Text SyncState)
  (HashMap Text SyncState)
  (HashMap Text SyncState)
-> Iso
     (Maybe (HashMap Text SyncState))
     (Maybe (HashMap Text SyncState))
     (Maybe (HashMap Text SyncState))
     (Maybe (HashMap Text SyncState))
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
  (HashMap Text SyncState)
  (HashMap Text SyncState)
  (HashMap Text SyncState)
  (HashMap Text SyncState)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The readiness of the configured firewall to handle network traffic
-- across all of the Availability Zones where you\'ve configured it. This
-- setting is @READY@ only when the @ConfigurationSyncStateSummary@ value
-- is @IN_SYNC@ and the @Attachment@ @Status@ values for all of the
-- configured subnets are @READY@.
firewallStatus_status :: Lens.Lens' FirewallStatus FirewallStatusValue
firewallStatus_status :: (FirewallStatusValue -> f FirewallStatusValue)
-> FirewallStatus -> f FirewallStatus
firewallStatus_status = (FirewallStatus -> FirewallStatusValue)
-> (FirewallStatus -> FirewallStatusValue -> FirewallStatus)
-> Lens
     FirewallStatus
     FirewallStatus
     FirewallStatusValue
     FirewallStatusValue
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallStatus' {FirewallStatusValue
status :: FirewallStatusValue
$sel:status:FirewallStatus' :: FirewallStatus -> FirewallStatusValue
status} -> FirewallStatusValue
status) (\s :: FirewallStatus
s@FirewallStatus' {} FirewallStatusValue
a -> FirewallStatus
s {$sel:status:FirewallStatus' :: FirewallStatusValue
status = FirewallStatusValue
a} :: FirewallStatus)

-- | The configuration sync state for the firewall. This summarizes the sync
-- states reported in the @Config@ settings for all of the Availability
-- Zones where you have configured the firewall.
--
-- When you create a firewall or update its configuration, for example by
-- adding a rule group to its firewall policy, Network Firewall distributes
-- the configuration changes to all zones where the firewall is in use.
-- This summary indicates whether the configuration changes have been
-- applied everywhere.
--
-- This status must be @IN_SYNC@ for the firewall to be ready for use, but
-- it doesn\'t indicate that the firewall is ready. The @Status@ setting
-- indicates firewall readiness.
firewallStatus_configurationSyncStateSummary :: Lens.Lens' FirewallStatus ConfigurationSyncState
firewallStatus_configurationSyncStateSummary :: (ConfigurationSyncState -> f ConfigurationSyncState)
-> FirewallStatus -> f FirewallStatus
firewallStatus_configurationSyncStateSummary = (FirewallStatus -> ConfigurationSyncState)
-> (FirewallStatus -> ConfigurationSyncState -> FirewallStatus)
-> Lens
     FirewallStatus
     FirewallStatus
     ConfigurationSyncState
     ConfigurationSyncState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirewallStatus' {ConfigurationSyncState
configurationSyncStateSummary :: ConfigurationSyncState
$sel:configurationSyncStateSummary:FirewallStatus' :: FirewallStatus -> ConfigurationSyncState
configurationSyncStateSummary} -> ConfigurationSyncState
configurationSyncStateSummary) (\s :: FirewallStatus
s@FirewallStatus' {} ConfigurationSyncState
a -> FirewallStatus
s {$sel:configurationSyncStateSummary:FirewallStatus' :: ConfigurationSyncState
configurationSyncStateSummary = ConfigurationSyncState
a} :: FirewallStatus)

instance Core.FromJSON FirewallStatus where
  parseJSON :: Value -> Parser FirewallStatus
parseJSON =
    String
-> (Object -> Parser FirewallStatus)
-> Value
-> Parser FirewallStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FirewallStatus"
      ( \Object
x ->
          Maybe (HashMap Text SyncState)
-> FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus
FirewallStatus'
            (Maybe (HashMap Text SyncState)
 -> FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus)
-> Parser (Maybe (HashMap Text SyncState))
-> Parser
     (FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text SyncState)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SyncStates" Parser (Maybe (Maybe (HashMap Text SyncState)))
-> Maybe (HashMap Text SyncState)
-> Parser (Maybe (HashMap Text SyncState))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text SyncState)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (FirewallStatusValue -> ConfigurationSyncState -> FirewallStatus)
-> Parser FirewallStatusValue
-> Parser (ConfigurationSyncState -> FirewallStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FirewallStatusValue
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
            Parser (ConfigurationSyncState -> FirewallStatus)
-> Parser ConfigurationSyncState -> Parser FirewallStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ConfigurationSyncState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ConfigurationSyncStateSummary")
      )

instance Prelude.Hashable FirewallStatus

instance Prelude.NFData FirewallStatus