{-# 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.LicenseConfigurationUsage
-- 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.LicenseConfigurationUsage where

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

-- | Details about the usage of a resource associated with a license
-- configuration.
--
-- /See:/ 'newLicenseConfigurationUsage' smart constructor.
data LicenseConfigurationUsage = LicenseConfigurationUsage'
  { -- | Type of resource.
    LicenseConfigurationUsage -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
    -- | Status of the resource.
    LicenseConfigurationUsage -> Maybe Text
resourceStatus :: Prelude.Maybe Prelude.Text,
    -- | Time when the license configuration was initially associated with the
    -- resource.
    LicenseConfigurationUsage -> Maybe POSIX
associationTime :: Prelude.Maybe Core.POSIX,
    -- | Amazon Resource Name (ARN) of the resource.
    LicenseConfigurationUsage -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | Number of licenses consumed by the resource.
    LicenseConfigurationUsage -> Maybe Integer
consumedLicenses :: Prelude.Maybe Prelude.Integer,
    -- | ID of the account that owns the resource.
    LicenseConfigurationUsage -> Maybe Text
resourceOwnerId :: Prelude.Maybe Prelude.Text
  }
  deriving (LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool
(LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool)
-> (LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool)
-> Eq LicenseConfigurationUsage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool
$c/= :: LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool
== :: LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool
$c== :: LicenseConfigurationUsage -> LicenseConfigurationUsage -> Bool
Prelude.Eq, ReadPrec [LicenseConfigurationUsage]
ReadPrec LicenseConfigurationUsage
Int -> ReadS LicenseConfigurationUsage
ReadS [LicenseConfigurationUsage]
(Int -> ReadS LicenseConfigurationUsage)
-> ReadS [LicenseConfigurationUsage]
-> ReadPrec LicenseConfigurationUsage
-> ReadPrec [LicenseConfigurationUsage]
-> Read LicenseConfigurationUsage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LicenseConfigurationUsage]
$creadListPrec :: ReadPrec [LicenseConfigurationUsage]
readPrec :: ReadPrec LicenseConfigurationUsage
$creadPrec :: ReadPrec LicenseConfigurationUsage
readList :: ReadS [LicenseConfigurationUsage]
$creadList :: ReadS [LicenseConfigurationUsage]
readsPrec :: Int -> ReadS LicenseConfigurationUsage
$creadsPrec :: Int -> ReadS LicenseConfigurationUsage
Prelude.Read, Int -> LicenseConfigurationUsage -> ShowS
[LicenseConfigurationUsage] -> ShowS
LicenseConfigurationUsage -> String
(Int -> LicenseConfigurationUsage -> ShowS)
-> (LicenseConfigurationUsage -> String)
-> ([LicenseConfigurationUsage] -> ShowS)
-> Show LicenseConfigurationUsage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LicenseConfigurationUsage] -> ShowS
$cshowList :: [LicenseConfigurationUsage] -> ShowS
show :: LicenseConfigurationUsage -> String
$cshow :: LicenseConfigurationUsage -> String
showsPrec :: Int -> LicenseConfigurationUsage -> ShowS
$cshowsPrec :: Int -> LicenseConfigurationUsage -> ShowS
Prelude.Show, (forall x.
 LicenseConfigurationUsage -> Rep LicenseConfigurationUsage x)
-> (forall x.
    Rep LicenseConfigurationUsage x -> LicenseConfigurationUsage)
-> Generic LicenseConfigurationUsage
forall x.
Rep LicenseConfigurationUsage x -> LicenseConfigurationUsage
forall x.
LicenseConfigurationUsage -> Rep LicenseConfigurationUsage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LicenseConfigurationUsage x -> LicenseConfigurationUsage
$cfrom :: forall x.
LicenseConfigurationUsage -> Rep LicenseConfigurationUsage x
Prelude.Generic)

-- |
-- Create a value of 'LicenseConfigurationUsage' 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:
--
-- 'resourceType', 'licenseConfigurationUsage_resourceType' - Type of resource.
--
-- 'resourceStatus', 'licenseConfigurationUsage_resourceStatus' - Status of the resource.
--
-- 'associationTime', 'licenseConfigurationUsage_associationTime' - Time when the license configuration was initially associated with the
-- resource.
--
-- 'resourceArn', 'licenseConfigurationUsage_resourceArn' - Amazon Resource Name (ARN) of the resource.
--
-- 'consumedLicenses', 'licenseConfigurationUsage_consumedLicenses' - Number of licenses consumed by the resource.
--
-- 'resourceOwnerId', 'licenseConfigurationUsage_resourceOwnerId' - ID of the account that owns the resource.
newLicenseConfigurationUsage ::
  LicenseConfigurationUsage
newLicenseConfigurationUsage :: LicenseConfigurationUsage
newLicenseConfigurationUsage =
  LicenseConfigurationUsage' :: Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> LicenseConfigurationUsage
LicenseConfigurationUsage'
    { $sel:resourceType:LicenseConfigurationUsage' :: Maybe ResourceType
resourceType =
        Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceStatus:LicenseConfigurationUsage' :: Maybe Text
resourceStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:associationTime:LicenseConfigurationUsage' :: Maybe POSIX
associationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:LicenseConfigurationUsage' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:consumedLicenses:LicenseConfigurationUsage' :: Maybe Integer
consumedLicenses = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwnerId:LicenseConfigurationUsage' :: Maybe Text
resourceOwnerId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Status of the resource.
licenseConfigurationUsage_resourceStatus :: Lens.Lens' LicenseConfigurationUsage (Prelude.Maybe Prelude.Text)
licenseConfigurationUsage_resourceStatus :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationUsage -> f LicenseConfigurationUsage
licenseConfigurationUsage_resourceStatus = (LicenseConfigurationUsage -> Maybe Text)
-> (LicenseConfigurationUsage
    -> Maybe Text -> LicenseConfigurationUsage)
-> Lens
     LicenseConfigurationUsage
     LicenseConfigurationUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationUsage' {Maybe Text
resourceStatus :: Maybe Text
$sel:resourceStatus:LicenseConfigurationUsage' :: LicenseConfigurationUsage -> Maybe Text
resourceStatus} -> Maybe Text
resourceStatus) (\s :: LicenseConfigurationUsage
s@LicenseConfigurationUsage' {} Maybe Text
a -> LicenseConfigurationUsage
s {$sel:resourceStatus:LicenseConfigurationUsage' :: Maybe Text
resourceStatus = Maybe Text
a} :: LicenseConfigurationUsage)

-- | Time when the license configuration was initially associated with the
-- resource.
licenseConfigurationUsage_associationTime :: Lens.Lens' LicenseConfigurationUsage (Prelude.Maybe Prelude.UTCTime)
licenseConfigurationUsage_associationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> LicenseConfigurationUsage -> f LicenseConfigurationUsage
licenseConfigurationUsage_associationTime = (LicenseConfigurationUsage -> Maybe POSIX)
-> (LicenseConfigurationUsage
    -> Maybe POSIX -> LicenseConfigurationUsage)
-> Lens
     LicenseConfigurationUsage
     LicenseConfigurationUsage
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationUsage' {Maybe POSIX
associationTime :: Maybe POSIX
$sel:associationTime:LicenseConfigurationUsage' :: LicenseConfigurationUsage -> Maybe POSIX
associationTime} -> Maybe POSIX
associationTime) (\s :: LicenseConfigurationUsage
s@LicenseConfigurationUsage' {} Maybe POSIX
a -> LicenseConfigurationUsage
s {$sel:associationTime:LicenseConfigurationUsage' :: Maybe POSIX
associationTime = Maybe POSIX
a} :: LicenseConfigurationUsage) ((Maybe POSIX -> f (Maybe POSIX))
 -> LicenseConfigurationUsage -> f LicenseConfigurationUsage)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> LicenseConfigurationUsage
-> f LicenseConfigurationUsage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Amazon Resource Name (ARN) of the resource.
licenseConfigurationUsage_resourceArn :: Lens.Lens' LicenseConfigurationUsage (Prelude.Maybe Prelude.Text)
licenseConfigurationUsage_resourceArn :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationUsage -> f LicenseConfigurationUsage
licenseConfigurationUsage_resourceArn = (LicenseConfigurationUsage -> Maybe Text)
-> (LicenseConfigurationUsage
    -> Maybe Text -> LicenseConfigurationUsage)
-> Lens
     LicenseConfigurationUsage
     LicenseConfigurationUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationUsage' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:LicenseConfigurationUsage' :: LicenseConfigurationUsage -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: LicenseConfigurationUsage
s@LicenseConfigurationUsage' {} Maybe Text
a -> LicenseConfigurationUsage
s {$sel:resourceArn:LicenseConfigurationUsage' :: Maybe Text
resourceArn = Maybe Text
a} :: LicenseConfigurationUsage)

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

-- | ID of the account that owns the resource.
licenseConfigurationUsage_resourceOwnerId :: Lens.Lens' LicenseConfigurationUsage (Prelude.Maybe Prelude.Text)
licenseConfigurationUsage_resourceOwnerId :: (Maybe Text -> f (Maybe Text))
-> LicenseConfigurationUsage -> f LicenseConfigurationUsage
licenseConfigurationUsage_resourceOwnerId = (LicenseConfigurationUsage -> Maybe Text)
-> (LicenseConfigurationUsage
    -> Maybe Text -> LicenseConfigurationUsage)
-> Lens
     LicenseConfigurationUsage
     LicenseConfigurationUsage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseConfigurationUsage' {Maybe Text
resourceOwnerId :: Maybe Text
$sel:resourceOwnerId:LicenseConfigurationUsage' :: LicenseConfigurationUsage -> Maybe Text
resourceOwnerId} -> Maybe Text
resourceOwnerId) (\s :: LicenseConfigurationUsage
s@LicenseConfigurationUsage' {} Maybe Text
a -> LicenseConfigurationUsage
s {$sel:resourceOwnerId:LicenseConfigurationUsage' :: Maybe Text
resourceOwnerId = Maybe Text
a} :: LicenseConfigurationUsage)

instance Core.FromJSON LicenseConfigurationUsage where
  parseJSON :: Value -> Parser LicenseConfigurationUsage
parseJSON =
    String
-> (Object -> Parser LicenseConfigurationUsage)
-> Value
-> Parser LicenseConfigurationUsage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LicenseConfigurationUsage"
      ( \Object
x ->
          Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> LicenseConfigurationUsage
LicenseConfigurationUsage'
            (Maybe ResourceType
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> LicenseConfigurationUsage)
-> Parser (Maybe ResourceType)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> LicenseConfigurationUsage)
forall (f :: * -> *) a b. Functor 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")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> LicenseConfigurationUsage)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Integer
      -> Maybe Text
      -> LicenseConfigurationUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceStatus")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Integer
   -> Maybe Text
   -> LicenseConfigurationUsage)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Integer -> Maybe Text -> LicenseConfigurationUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AssociationTime")
            Parser
  (Maybe Text
   -> Maybe Integer -> Maybe Text -> LicenseConfigurationUsage)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer -> Maybe Text -> LicenseConfigurationUsage)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceArn")
            Parser (Maybe Integer -> Maybe Text -> LicenseConfigurationUsage)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> LicenseConfigurationUsage)
forall (f :: * -> *) a b. Applicative f => 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
"ConsumedLicenses")
            Parser (Maybe Text -> LicenseConfigurationUsage)
-> Parser (Maybe Text) -> Parser LicenseConfigurationUsage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ResourceOwnerId")
      )

instance Prelude.Hashable LicenseConfigurationUsage

instance Prelude.NFData LicenseConfigurationUsage