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

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

-- | Details about license consumption.
--
-- /See:/ 'newConsumedLicenseSummary' smart constructor.
data ConsumedLicenseSummary = ConsumedLicenseSummary'
  { -- | Number of licenses consumed by the resource.
    ConsumedLicenseSummary -> Maybe Integer
consumedLicenses :: Prelude.Maybe Prelude.Integer,
    -- | Resource type of the resource consuming a license.
    ConsumedLicenseSummary -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType
  }
  deriving (ConsumedLicenseSummary -> ConsumedLicenseSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConsumedLicenseSummary -> ConsumedLicenseSummary -> Bool
$c/= :: ConsumedLicenseSummary -> ConsumedLicenseSummary -> Bool
== :: ConsumedLicenseSummary -> ConsumedLicenseSummary -> Bool
$c== :: ConsumedLicenseSummary -> ConsumedLicenseSummary -> Bool
Prelude.Eq, ReadPrec [ConsumedLicenseSummary]
ReadPrec ConsumedLicenseSummary
Int -> ReadS ConsumedLicenseSummary
ReadS [ConsumedLicenseSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConsumedLicenseSummary]
$creadListPrec :: ReadPrec [ConsumedLicenseSummary]
readPrec :: ReadPrec ConsumedLicenseSummary
$creadPrec :: ReadPrec ConsumedLicenseSummary
readList :: ReadS [ConsumedLicenseSummary]
$creadList :: ReadS [ConsumedLicenseSummary]
readsPrec :: Int -> ReadS ConsumedLicenseSummary
$creadsPrec :: Int -> ReadS ConsumedLicenseSummary
Prelude.Read, Int -> ConsumedLicenseSummary -> ShowS
[ConsumedLicenseSummary] -> ShowS
ConsumedLicenseSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConsumedLicenseSummary] -> ShowS
$cshowList :: [ConsumedLicenseSummary] -> ShowS
show :: ConsumedLicenseSummary -> String
$cshow :: ConsumedLicenseSummary -> String
showsPrec :: Int -> ConsumedLicenseSummary -> ShowS
$cshowsPrec :: Int -> ConsumedLicenseSummary -> ShowS
Prelude.Show, forall x. Rep ConsumedLicenseSummary x -> ConsumedLicenseSummary
forall x. ConsumedLicenseSummary -> Rep ConsumedLicenseSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConsumedLicenseSummary x -> ConsumedLicenseSummary
$cfrom :: forall x. ConsumedLicenseSummary -> Rep ConsumedLicenseSummary x
Prelude.Generic)

-- |
-- Create a value of 'ConsumedLicenseSummary' 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:
--
-- 'consumedLicenses', 'consumedLicenseSummary_consumedLicenses' - Number of licenses consumed by the resource.
--
-- 'resourceType', 'consumedLicenseSummary_resourceType' - Resource type of the resource consuming a license.
newConsumedLicenseSummary ::
  ConsumedLicenseSummary
newConsumedLicenseSummary :: ConsumedLicenseSummary
newConsumedLicenseSummary =
  ConsumedLicenseSummary'
    { $sel:consumedLicenses:ConsumedLicenseSummary' :: Maybe Integer
consumedLicenses =
        forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ConsumedLicenseSummary' :: Maybe ResourceType
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | Number of licenses consumed by the resource.
consumedLicenseSummary_consumedLicenses :: Lens.Lens' ConsumedLicenseSummary (Prelude.Maybe Prelude.Integer)
consumedLicenseSummary_consumedLicenses :: Lens' ConsumedLicenseSummary (Maybe Integer)
consumedLicenseSummary_consumedLicenses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedLicenseSummary' {Maybe Integer
consumedLicenses :: Maybe Integer
$sel:consumedLicenses:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe Integer
consumedLicenses} -> Maybe Integer
consumedLicenses) (\s :: ConsumedLicenseSummary
s@ConsumedLicenseSummary' {} Maybe Integer
a -> ConsumedLicenseSummary
s {$sel:consumedLicenses:ConsumedLicenseSummary' :: Maybe Integer
consumedLicenses = Maybe Integer
a} :: ConsumedLicenseSummary)

-- | Resource type of the resource consuming a license.
consumedLicenseSummary_resourceType :: Lens.Lens' ConsumedLicenseSummary (Prelude.Maybe ResourceType)
consumedLicenseSummary_resourceType :: Lens' ConsumedLicenseSummary (Maybe ResourceType)
consumedLicenseSummary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConsumedLicenseSummary' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ConsumedLicenseSummary
s@ConsumedLicenseSummary' {} Maybe ResourceType
a -> ConsumedLicenseSummary
s {$sel:resourceType:ConsumedLicenseSummary' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ConsumedLicenseSummary)

instance Data.FromJSON ConsumedLicenseSummary where
  parseJSON :: Value -> Parser ConsumedLicenseSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConsumedLicenseSummary"
      ( \Object
x ->
          Maybe Integer -> Maybe ResourceType -> ConsumedLicenseSummary
ConsumedLicenseSummary'
            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
"ConsumedLicenses")
            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 ConsumedLicenseSummary where
  hashWithSalt :: Int -> ConsumedLicenseSummary -> Int
hashWithSalt Int
_salt ConsumedLicenseSummary' {Maybe Integer
Maybe ResourceType
resourceType :: Maybe ResourceType
consumedLicenses :: Maybe Integer
$sel:resourceType:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe ResourceType
$sel:consumedLicenses:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
consumedLicenses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResourceType
resourceType

instance Prelude.NFData ConsumedLicenseSummary where
  rnf :: ConsumedLicenseSummary -> ()
rnf ConsumedLicenseSummary' {Maybe Integer
Maybe ResourceType
resourceType :: Maybe ResourceType
consumedLicenses :: Maybe Integer
$sel:resourceType:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe ResourceType
$sel:consumedLicenses:ConsumedLicenseSummary' :: ConsumedLicenseSummary -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
consumedLicenses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResourceType
resourceType