{-# 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.NetworkManager.Types.NetworkResourceCount
-- 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.NetworkManager.Types.NetworkResourceCount 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

-- | Describes a resource count.
--
-- /See:/ 'newNetworkResourceCount' smart constructor.
data NetworkResourceCount = NetworkResourceCount'
  { -- | The resource count.
    NetworkResourceCount -> Maybe Int
count :: Prelude.Maybe Prelude.Int,
    -- | The resource type.
    NetworkResourceCount -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkResourceCount -> NetworkResourceCount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkResourceCount -> NetworkResourceCount -> Bool
$c/= :: NetworkResourceCount -> NetworkResourceCount -> Bool
== :: NetworkResourceCount -> NetworkResourceCount -> Bool
$c== :: NetworkResourceCount -> NetworkResourceCount -> Bool
Prelude.Eq, ReadPrec [NetworkResourceCount]
ReadPrec NetworkResourceCount
Int -> ReadS NetworkResourceCount
ReadS [NetworkResourceCount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkResourceCount]
$creadListPrec :: ReadPrec [NetworkResourceCount]
readPrec :: ReadPrec NetworkResourceCount
$creadPrec :: ReadPrec NetworkResourceCount
readList :: ReadS [NetworkResourceCount]
$creadList :: ReadS [NetworkResourceCount]
readsPrec :: Int -> ReadS NetworkResourceCount
$creadsPrec :: Int -> ReadS NetworkResourceCount
Prelude.Read, Int -> NetworkResourceCount -> ShowS
[NetworkResourceCount] -> ShowS
NetworkResourceCount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkResourceCount] -> ShowS
$cshowList :: [NetworkResourceCount] -> ShowS
show :: NetworkResourceCount -> String
$cshow :: NetworkResourceCount -> String
showsPrec :: Int -> NetworkResourceCount -> ShowS
$cshowsPrec :: Int -> NetworkResourceCount -> ShowS
Prelude.Show, forall x. Rep NetworkResourceCount x -> NetworkResourceCount
forall x. NetworkResourceCount -> Rep NetworkResourceCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkResourceCount x -> NetworkResourceCount
$cfrom :: forall x. NetworkResourceCount -> Rep NetworkResourceCount x
Prelude.Generic)

-- |
-- Create a value of 'NetworkResourceCount' 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:
--
-- 'count', 'networkResourceCount_count' - The resource count.
--
-- 'resourceType', 'networkResourceCount_resourceType' - The resource type.
newNetworkResourceCount ::
  NetworkResourceCount
newNetworkResourceCount :: NetworkResourceCount
newNetworkResourceCount =
  NetworkResourceCount'
    { $sel:count:NetworkResourceCount' :: Maybe Int
count = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:NetworkResourceCount' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | The resource count.
networkResourceCount_count :: Lens.Lens' NetworkResourceCount (Prelude.Maybe Prelude.Int)
networkResourceCount_count :: Lens' NetworkResourceCount (Maybe Int)
networkResourceCount_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceCount' {Maybe Int
count :: Maybe Int
$sel:count:NetworkResourceCount' :: NetworkResourceCount -> Maybe Int
count} -> Maybe Int
count) (\s :: NetworkResourceCount
s@NetworkResourceCount' {} Maybe Int
a -> NetworkResourceCount
s {$sel:count:NetworkResourceCount' :: Maybe Int
count = Maybe Int
a} :: NetworkResourceCount)

-- | The resource type.
networkResourceCount_resourceType :: Lens.Lens' NetworkResourceCount (Prelude.Maybe Prelude.Text)
networkResourceCount_resourceType :: Lens' NetworkResourceCount (Maybe Text)
networkResourceCount_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkResourceCount' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:NetworkResourceCount' :: NetworkResourceCount -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: NetworkResourceCount
s@NetworkResourceCount' {} Maybe Text
a -> NetworkResourceCount
s {$sel:resourceType:NetworkResourceCount' :: Maybe Text
resourceType = Maybe Text
a} :: NetworkResourceCount)

instance Data.FromJSON NetworkResourceCount where
  parseJSON :: Value -> Parser NetworkResourceCount
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"NetworkResourceCount"
      ( \Object
x ->
          Maybe Int -> Maybe Text -> NetworkResourceCount
NetworkResourceCount'
            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
"Count")
            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
"ResourceType")
      )

instance Prelude.Hashable NetworkResourceCount where
  hashWithSalt :: Int -> NetworkResourceCount -> Int
hashWithSalt Int
_salt NetworkResourceCount' {Maybe Int
Maybe Text
resourceType :: Maybe Text
count :: Maybe Int
$sel:resourceType:NetworkResourceCount' :: NetworkResourceCount -> Maybe Text
$sel:count:NetworkResourceCount' :: NetworkResourceCount -> Maybe Int
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
count
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType

instance Prelude.NFData NetworkResourceCount where
  rnf :: NetworkResourceCount -> ()
rnf NetworkResourceCount' {Maybe Int
Maybe Text
resourceType :: Maybe Text
count :: Maybe Int
$sel:resourceType:NetworkResourceCount' :: NetworkResourceCount -> Maybe Text
$sel:count:NetworkResourceCount' :: NetworkResourceCount -> Maybe Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
count
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType