{-# 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.LicenseManager.Types.ManagedResourceSummary
-- 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.LicenseManager.Types.ManagedResourceSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types.ResourceType
import qualified Amazonka.Prelude as Prelude

-- | Summary information about a managed resource.
--
-- /See:/ 'newManagedResourceSummary' smart constructor.
data ManagedResourceSummary = ManagedResourceSummary'
  { -- | Number of resources associated with licenses.
    ManagedResourceSummary -> Maybe Integer
associationCount :: Prelude.Maybe Prelude.Integer,
    -- | Type of resource associated with a license.
    ManagedResourceSummary -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType
  }
  deriving (ManagedResourceSummary -> ManagedResourceSummary -> Bool
(ManagedResourceSummary -> ManagedResourceSummary -> Bool)
-> (ManagedResourceSummary -> ManagedResourceSummary -> Bool)
-> Eq ManagedResourceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
$c/= :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
== :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
$c== :: ManagedResourceSummary -> ManagedResourceSummary -> Bool
Prelude.Eq, ReadPrec [ManagedResourceSummary]
ReadPrec ManagedResourceSummary
Int -> ReadS ManagedResourceSummary
ReadS [ManagedResourceSummary]
(Int -> ReadS ManagedResourceSummary)
-> ReadS [ManagedResourceSummary]
-> ReadPrec ManagedResourceSummary
-> ReadPrec [ManagedResourceSummary]
-> Read ManagedResourceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ManagedResourceSummary]
$creadListPrec :: ReadPrec [ManagedResourceSummary]
readPrec :: ReadPrec ManagedResourceSummary
$creadPrec :: ReadPrec ManagedResourceSummary
readList :: ReadS [ManagedResourceSummary]
$creadList :: ReadS [ManagedResourceSummary]
readsPrec :: Int -> ReadS ManagedResourceSummary
$creadsPrec :: Int -> ReadS ManagedResourceSummary
Prelude.Read, Int -> ManagedResourceSummary -> ShowS
[ManagedResourceSummary] -> ShowS
ManagedResourceSummary -> String
(Int -> ManagedResourceSummary -> ShowS)
-> (ManagedResourceSummary -> String)
-> ([ManagedResourceSummary] -> ShowS)
-> Show ManagedResourceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ManagedResourceSummary] -> ShowS
$cshowList :: [ManagedResourceSummary] -> ShowS
show :: ManagedResourceSummary -> String
$cshow :: ManagedResourceSummary -> String
showsPrec :: Int -> ManagedResourceSummary -> ShowS
$cshowsPrec :: Int -> ManagedResourceSummary -> ShowS
Prelude.Show, (forall x. ManagedResourceSummary -> Rep ManagedResourceSummary x)
-> (forall x.
    Rep ManagedResourceSummary x -> ManagedResourceSummary)
-> Generic ManagedResourceSummary
forall x. Rep ManagedResourceSummary x -> ManagedResourceSummary
forall x. ManagedResourceSummary -> Rep ManagedResourceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ManagedResourceSummary x -> ManagedResourceSummary
$cfrom :: forall x. ManagedResourceSummary -> Rep ManagedResourceSummary x
Prelude.Generic)

-- |
-- Create a value of 'ManagedResourceSummary' 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:
--
-- 'associationCount', 'managedResourceSummary_associationCount' - Number of resources associated with licenses.
--
-- 'resourceType', 'managedResourceSummary_resourceType' - Type of resource associated with a license.
newManagedResourceSummary ::
  ManagedResourceSummary
newManagedResourceSummary :: ManagedResourceSummary
newManagedResourceSummary =
  ManagedResourceSummary' :: Maybe Integer -> Maybe ResourceType -> ManagedResourceSummary
ManagedResourceSummary'
    { $sel:associationCount:ManagedResourceSummary' :: Maybe Integer
associationCount =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ManagedResourceSummary' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing
    }

-- | Number of resources associated with licenses.
managedResourceSummary_associationCount :: Lens.Lens' ManagedResourceSummary (Prelude.Maybe Prelude.Integer)
managedResourceSummary_associationCount :: (Maybe Integer -> f (Maybe Integer))
-> ManagedResourceSummary -> f ManagedResourceSummary
managedResourceSummary_associationCount = (ManagedResourceSummary -> Maybe Integer)
-> (ManagedResourceSummary
    -> Maybe Integer -> ManagedResourceSummary)
-> Lens
     ManagedResourceSummary
     ManagedResourceSummary
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedResourceSummary' {Maybe Integer
associationCount :: Maybe Integer
$sel:associationCount:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe Integer
associationCount} -> Maybe Integer
associationCount) (\s :: ManagedResourceSummary
s@ManagedResourceSummary' {} Maybe Integer
a -> ManagedResourceSummary
s {$sel:associationCount:ManagedResourceSummary' :: Maybe Integer
associationCount = Maybe Integer
a} :: ManagedResourceSummary)

-- | Type of resource associated with a license.
managedResourceSummary_resourceType :: Lens.Lens' ManagedResourceSummary (Prelude.Maybe ResourceType)
managedResourceSummary_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> ManagedResourceSummary -> f ManagedResourceSummary
managedResourceSummary_resourceType = (ManagedResourceSummary -> Maybe ResourceType)
-> (ManagedResourceSummary
    -> Maybe ResourceType -> ManagedResourceSummary)
-> Lens
     ManagedResourceSummary
     ManagedResourceSummary
     (Maybe ResourceType)
     (Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ManagedResourceSummary' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ManagedResourceSummary' :: ManagedResourceSummary -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ManagedResourceSummary
s@ManagedResourceSummary' {} Maybe ResourceType
a -> ManagedResourceSummary
s {$sel:resourceType:ManagedResourceSummary' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ManagedResourceSummary)

instance Core.FromJSON ManagedResourceSummary where
  parseJSON :: Value -> Parser ManagedResourceSummary
parseJSON =
    String
-> (Object -> Parser ManagedResourceSummary)
-> Value
-> Parser ManagedResourceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ManagedResourceSummary"
      ( \Object
x ->
          Maybe Integer -> Maybe ResourceType -> ManagedResourceSummary
ManagedResourceSummary'
            (Maybe Integer -> Maybe ResourceType -> ManagedResourceSummary)
-> Parser (Maybe Integer)
-> Parser (Maybe ResourceType -> ManagedResourceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssociationCount")
            Parser (Maybe ResourceType -> ManagedResourceSummary)
-> Parser (Maybe ResourceType) -> Parser ManagedResourceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceType")
      )

instance Prelude.Hashable ManagedResourceSummary

instance Prelude.NFData ManagedResourceSummary