{-# 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.OpenSearchServerless.Types.SecurityPolicyStats
-- 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.OpenSearchServerless.Types.SecurityPolicyStats where

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

-- | Statistics for an OpenSearch Serverless security policy.
--
-- /See:/ 'newSecurityPolicyStats' smart constructor.
data SecurityPolicyStats = SecurityPolicyStats'
  { -- | The number of encryption policies in the current account.
    SecurityPolicyStats -> Maybe Integer
encryptionPolicyCount :: Prelude.Maybe Prelude.Integer,
    -- | The number of network policies in the current account.
    SecurityPolicyStats -> Maybe Integer
networkPolicyCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (SecurityPolicyStats -> SecurityPolicyStats -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityPolicyStats -> SecurityPolicyStats -> Bool
$c/= :: SecurityPolicyStats -> SecurityPolicyStats -> Bool
== :: SecurityPolicyStats -> SecurityPolicyStats -> Bool
$c== :: SecurityPolicyStats -> SecurityPolicyStats -> Bool
Prelude.Eq, ReadPrec [SecurityPolicyStats]
ReadPrec SecurityPolicyStats
Int -> ReadS SecurityPolicyStats
ReadS [SecurityPolicyStats]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityPolicyStats]
$creadListPrec :: ReadPrec [SecurityPolicyStats]
readPrec :: ReadPrec SecurityPolicyStats
$creadPrec :: ReadPrec SecurityPolicyStats
readList :: ReadS [SecurityPolicyStats]
$creadList :: ReadS [SecurityPolicyStats]
readsPrec :: Int -> ReadS SecurityPolicyStats
$creadsPrec :: Int -> ReadS SecurityPolicyStats
Prelude.Read, Int -> SecurityPolicyStats -> ShowS
[SecurityPolicyStats] -> ShowS
SecurityPolicyStats -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityPolicyStats] -> ShowS
$cshowList :: [SecurityPolicyStats] -> ShowS
show :: SecurityPolicyStats -> String
$cshow :: SecurityPolicyStats -> String
showsPrec :: Int -> SecurityPolicyStats -> ShowS
$cshowsPrec :: Int -> SecurityPolicyStats -> ShowS
Prelude.Show, forall x. Rep SecurityPolicyStats x -> SecurityPolicyStats
forall x. SecurityPolicyStats -> Rep SecurityPolicyStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityPolicyStats x -> SecurityPolicyStats
$cfrom :: forall x. SecurityPolicyStats -> Rep SecurityPolicyStats x
Prelude.Generic)

-- |
-- Create a value of 'SecurityPolicyStats' 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:
--
-- 'encryptionPolicyCount', 'securityPolicyStats_encryptionPolicyCount' - The number of encryption policies in the current account.
--
-- 'networkPolicyCount', 'securityPolicyStats_networkPolicyCount' - The number of network policies in the current account.
newSecurityPolicyStats ::
  SecurityPolicyStats
newSecurityPolicyStats :: SecurityPolicyStats
newSecurityPolicyStats =
  SecurityPolicyStats'
    { $sel:encryptionPolicyCount:SecurityPolicyStats' :: Maybe Integer
encryptionPolicyCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:networkPolicyCount:SecurityPolicyStats' :: Maybe Integer
networkPolicyCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The number of encryption policies in the current account.
securityPolicyStats_encryptionPolicyCount :: Lens.Lens' SecurityPolicyStats (Prelude.Maybe Prelude.Integer)
securityPolicyStats_encryptionPolicyCount :: Lens' SecurityPolicyStats (Maybe Integer)
securityPolicyStats_encryptionPolicyCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityPolicyStats' {Maybe Integer
encryptionPolicyCount :: Maybe Integer
$sel:encryptionPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
encryptionPolicyCount} -> Maybe Integer
encryptionPolicyCount) (\s :: SecurityPolicyStats
s@SecurityPolicyStats' {} Maybe Integer
a -> SecurityPolicyStats
s {$sel:encryptionPolicyCount:SecurityPolicyStats' :: Maybe Integer
encryptionPolicyCount = Maybe Integer
a} :: SecurityPolicyStats)

-- | The number of network policies in the current account.
securityPolicyStats_networkPolicyCount :: Lens.Lens' SecurityPolicyStats (Prelude.Maybe Prelude.Integer)
securityPolicyStats_networkPolicyCount :: Lens' SecurityPolicyStats (Maybe Integer)
securityPolicyStats_networkPolicyCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityPolicyStats' {Maybe Integer
networkPolicyCount :: Maybe Integer
$sel:networkPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
networkPolicyCount} -> Maybe Integer
networkPolicyCount) (\s :: SecurityPolicyStats
s@SecurityPolicyStats' {} Maybe Integer
a -> SecurityPolicyStats
s {$sel:networkPolicyCount:SecurityPolicyStats' :: Maybe Integer
networkPolicyCount = Maybe Integer
a} :: SecurityPolicyStats)

instance Data.FromJSON SecurityPolicyStats where
  parseJSON :: Value -> Parser SecurityPolicyStats
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SecurityPolicyStats"
      ( \Object
x ->
          Maybe Integer -> Maybe Integer -> SecurityPolicyStats
SecurityPolicyStats'
            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
"EncryptionPolicyCount")
            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
"NetworkPolicyCount")
      )

instance Prelude.Hashable SecurityPolicyStats where
  hashWithSalt :: Int -> SecurityPolicyStats -> Int
hashWithSalt Int
_salt SecurityPolicyStats' {Maybe Integer
networkPolicyCount :: Maybe Integer
encryptionPolicyCount :: Maybe Integer
$sel:networkPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
$sel:encryptionPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
encryptionPolicyCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
networkPolicyCount

instance Prelude.NFData SecurityPolicyStats where
  rnf :: SecurityPolicyStats -> ()
rnf SecurityPolicyStats' {Maybe Integer
networkPolicyCount :: Maybe Integer
encryptionPolicyCount :: Maybe Integer
$sel:networkPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
$sel:encryptionPolicyCount:SecurityPolicyStats' :: SecurityPolicyStats -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
encryptionPolicyCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
networkPolicyCount