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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types.ConsumptionConfiguration
import Amazonka.LicenseManager.Types.DatetimeRange
import Amazonka.LicenseManager.Types.Entitlement
import Amazonka.LicenseManager.Types.IssuerDetails
import Amazonka.LicenseManager.Types.LicenseStatus
import Amazonka.LicenseManager.Types.Metadata
import Amazonka.LicenseManager.Types.ReceivedMetadata
import qualified Amazonka.Prelude as Prelude

-- | Describes a license that is granted to a grantee.
--
-- /See:/ 'newGrantedLicense' smart constructor.
data GrantedLicense = GrantedLicense'
  { -- | Granted license status.
    GrantedLicense -> Maybe LicenseStatus
status :: Prelude.Maybe LicenseStatus,
    -- | Product name.
    GrantedLicense -> Maybe Text
productName :: Prelude.Maybe Prelude.Text,
    -- | License name.
    GrantedLicense -> Maybe Text
licenseName :: Prelude.Maybe Prelude.Text,
    -- | Product SKU.
    GrantedLicense -> Maybe Text
productSKU :: Prelude.Maybe Prelude.Text,
    -- | Home Region of the granted license.
    GrantedLicense -> Maybe Text
homeRegion :: Prelude.Maybe Prelude.Text,
    -- | Granted license received metadata.
    GrantedLicense -> Maybe ReceivedMetadata
receivedMetadata :: Prelude.Maybe ReceivedMetadata,
    -- | Version of the granted license.
    GrantedLicense -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | License entitlements.
    GrantedLicense -> Maybe [Entitlement]
entitlements :: Prelude.Maybe [Entitlement],
    -- | Date and time range during which the granted license is valid, in
    -- ISO8601-UTC format.
    GrantedLicense -> Maybe DatetimeRange
validity :: Prelude.Maybe DatetimeRange,
    -- | Configuration for consumption of the license.
    GrantedLicense -> Maybe ConsumptionConfiguration
consumptionConfiguration :: Prelude.Maybe ConsumptionConfiguration,
    -- | Granted license beneficiary.
    GrantedLicense -> Maybe Text
beneficiary :: Prelude.Maybe Prelude.Text,
    -- | Granted license issuer.
    GrantedLicense -> Maybe IssuerDetails
issuer :: Prelude.Maybe IssuerDetails,
    -- | Amazon Resource Name (ARN) of the license.
    GrantedLicense -> Maybe Text
licenseArn :: Prelude.Maybe Prelude.Text,
    -- | Granted license metadata.
    GrantedLicense -> Maybe [Metadata]
licenseMetadata :: Prelude.Maybe [Metadata],
    -- | Creation time of the granted license.
    GrantedLicense -> Maybe Text
createTime :: Prelude.Maybe Prelude.Text
  }
  deriving (GrantedLicense -> GrantedLicense -> Bool
(GrantedLicense -> GrantedLicense -> Bool)
-> (GrantedLicense -> GrantedLicense -> Bool) -> Eq GrantedLicense
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GrantedLicense -> GrantedLicense -> Bool
$c/= :: GrantedLicense -> GrantedLicense -> Bool
== :: GrantedLicense -> GrantedLicense -> Bool
$c== :: GrantedLicense -> GrantedLicense -> Bool
Prelude.Eq, ReadPrec [GrantedLicense]
ReadPrec GrantedLicense
Int -> ReadS GrantedLicense
ReadS [GrantedLicense]
(Int -> ReadS GrantedLicense)
-> ReadS [GrantedLicense]
-> ReadPrec GrantedLicense
-> ReadPrec [GrantedLicense]
-> Read GrantedLicense
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GrantedLicense]
$creadListPrec :: ReadPrec [GrantedLicense]
readPrec :: ReadPrec GrantedLicense
$creadPrec :: ReadPrec GrantedLicense
readList :: ReadS [GrantedLicense]
$creadList :: ReadS [GrantedLicense]
readsPrec :: Int -> ReadS GrantedLicense
$creadsPrec :: Int -> ReadS GrantedLicense
Prelude.Read, Int -> GrantedLicense -> ShowS
[GrantedLicense] -> ShowS
GrantedLicense -> String
(Int -> GrantedLicense -> ShowS)
-> (GrantedLicense -> String)
-> ([GrantedLicense] -> ShowS)
-> Show GrantedLicense
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GrantedLicense] -> ShowS
$cshowList :: [GrantedLicense] -> ShowS
show :: GrantedLicense -> String
$cshow :: GrantedLicense -> String
showsPrec :: Int -> GrantedLicense -> ShowS
$cshowsPrec :: Int -> GrantedLicense -> ShowS
Prelude.Show, (forall x. GrantedLicense -> Rep GrantedLicense x)
-> (forall x. Rep GrantedLicense x -> GrantedLicense)
-> Generic GrantedLicense
forall x. Rep GrantedLicense x -> GrantedLicense
forall x. GrantedLicense -> Rep GrantedLicense x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GrantedLicense x -> GrantedLicense
$cfrom :: forall x. GrantedLicense -> Rep GrantedLicense x
Prelude.Generic)

-- |
-- Create a value of 'GrantedLicense' 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:
--
-- 'status', 'grantedLicense_status' - Granted license status.
--
-- 'productName', 'grantedLicense_productName' - Product name.
--
-- 'licenseName', 'grantedLicense_licenseName' - License name.
--
-- 'productSKU', 'grantedLicense_productSKU' - Product SKU.
--
-- 'homeRegion', 'grantedLicense_homeRegion' - Home Region of the granted license.
--
-- 'receivedMetadata', 'grantedLicense_receivedMetadata' - Granted license received metadata.
--
-- 'version', 'grantedLicense_version' - Version of the granted license.
--
-- 'entitlements', 'grantedLicense_entitlements' - License entitlements.
--
-- 'validity', 'grantedLicense_validity' - Date and time range during which the granted license is valid, in
-- ISO8601-UTC format.
--
-- 'consumptionConfiguration', 'grantedLicense_consumptionConfiguration' - Configuration for consumption of the license.
--
-- 'beneficiary', 'grantedLicense_beneficiary' - Granted license beneficiary.
--
-- 'issuer', 'grantedLicense_issuer' - Granted license issuer.
--
-- 'licenseArn', 'grantedLicense_licenseArn' - Amazon Resource Name (ARN) of the license.
--
-- 'licenseMetadata', 'grantedLicense_licenseMetadata' - Granted license metadata.
--
-- 'createTime', 'grantedLicense_createTime' - Creation time of the granted license.
newGrantedLicense ::
  GrantedLicense
newGrantedLicense :: GrantedLicense
newGrantedLicense =
  GrantedLicense' :: Maybe LicenseStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ReceivedMetadata
-> Maybe Text
-> Maybe [Entitlement]
-> Maybe DatetimeRange
-> Maybe ConsumptionConfiguration
-> Maybe Text
-> Maybe IssuerDetails
-> Maybe Text
-> Maybe [Metadata]
-> Maybe Text
-> GrantedLicense
GrantedLicense'
    { $sel:status:GrantedLicense' :: Maybe LicenseStatus
status = Maybe LicenseStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:productName:GrantedLicense' :: Maybe Text
productName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseName:GrantedLicense' :: Maybe Text
licenseName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:productSKU:GrantedLicense' :: Maybe Text
productSKU = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:homeRegion:GrantedLicense' :: Maybe Text
homeRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:receivedMetadata:GrantedLicense' :: Maybe ReceivedMetadata
receivedMetadata = Maybe ReceivedMetadata
forall a. Maybe a
Prelude.Nothing,
      $sel:version:GrantedLicense' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:entitlements:GrantedLicense' :: Maybe [Entitlement]
entitlements = Maybe [Entitlement]
forall a. Maybe a
Prelude.Nothing,
      $sel:validity:GrantedLicense' :: Maybe DatetimeRange
validity = Maybe DatetimeRange
forall a. Maybe a
Prelude.Nothing,
      $sel:consumptionConfiguration:GrantedLicense' :: Maybe ConsumptionConfiguration
consumptionConfiguration = Maybe ConsumptionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:beneficiary:GrantedLicense' :: Maybe Text
beneficiary = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:issuer:GrantedLicense' :: Maybe IssuerDetails
issuer = Maybe IssuerDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseArn:GrantedLicense' :: Maybe Text
licenseArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:licenseMetadata:GrantedLicense' :: Maybe [Metadata]
licenseMetadata = Maybe [Metadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:GrantedLicense' :: Maybe Text
createTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Granted license status.
grantedLicense_status :: Lens.Lens' GrantedLicense (Prelude.Maybe LicenseStatus)
grantedLicense_status :: (Maybe LicenseStatus -> f (Maybe LicenseStatus))
-> GrantedLicense -> f GrantedLicense
grantedLicense_status = (GrantedLicense -> Maybe LicenseStatus)
-> (GrantedLicense -> Maybe LicenseStatus -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe LicenseStatus)
     (Maybe LicenseStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe LicenseStatus
status :: Maybe LicenseStatus
$sel:status:GrantedLicense' :: GrantedLicense -> Maybe LicenseStatus
status} -> Maybe LicenseStatus
status) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe LicenseStatus
a -> GrantedLicense
s {$sel:status:GrantedLicense' :: Maybe LicenseStatus
status = Maybe LicenseStatus
a} :: GrantedLicense)

-- | Product name.
grantedLicense_productName :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_productName :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_productName = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
productName :: Maybe Text
$sel:productName:GrantedLicense' :: GrantedLicense -> Maybe Text
productName} -> Maybe Text
productName) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:productName:GrantedLicense' :: Maybe Text
productName = Maybe Text
a} :: GrantedLicense)

-- | License name.
grantedLicense_licenseName :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_licenseName :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_licenseName = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
licenseName :: Maybe Text
$sel:licenseName:GrantedLicense' :: GrantedLicense -> Maybe Text
licenseName} -> Maybe Text
licenseName) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:licenseName:GrantedLicense' :: Maybe Text
licenseName = Maybe Text
a} :: GrantedLicense)

-- | Product SKU.
grantedLicense_productSKU :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_productSKU :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_productSKU = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
productSKU :: Maybe Text
$sel:productSKU:GrantedLicense' :: GrantedLicense -> Maybe Text
productSKU} -> Maybe Text
productSKU) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:productSKU:GrantedLicense' :: Maybe Text
productSKU = Maybe Text
a} :: GrantedLicense)

-- | Home Region of the granted license.
grantedLicense_homeRegion :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_homeRegion :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_homeRegion = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
homeRegion :: Maybe Text
$sel:homeRegion:GrantedLicense' :: GrantedLicense -> Maybe Text
homeRegion} -> Maybe Text
homeRegion) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:homeRegion:GrantedLicense' :: Maybe Text
homeRegion = Maybe Text
a} :: GrantedLicense)

-- | Granted license received metadata.
grantedLicense_receivedMetadata :: Lens.Lens' GrantedLicense (Prelude.Maybe ReceivedMetadata)
grantedLicense_receivedMetadata :: (Maybe ReceivedMetadata -> f (Maybe ReceivedMetadata))
-> GrantedLicense -> f GrantedLicense
grantedLicense_receivedMetadata = (GrantedLicense -> Maybe ReceivedMetadata)
-> (GrantedLicense -> Maybe ReceivedMetadata -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe ReceivedMetadata)
     (Maybe ReceivedMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe ReceivedMetadata
receivedMetadata :: Maybe ReceivedMetadata
$sel:receivedMetadata:GrantedLicense' :: GrantedLicense -> Maybe ReceivedMetadata
receivedMetadata} -> Maybe ReceivedMetadata
receivedMetadata) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe ReceivedMetadata
a -> GrantedLicense
s {$sel:receivedMetadata:GrantedLicense' :: Maybe ReceivedMetadata
receivedMetadata = Maybe ReceivedMetadata
a} :: GrantedLicense)

-- | Version of the granted license.
grantedLicense_version :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_version :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_version = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
version :: Maybe Text
$sel:version:GrantedLicense' :: GrantedLicense -> Maybe Text
version} -> Maybe Text
version) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:version:GrantedLicense' :: Maybe Text
version = Maybe Text
a} :: GrantedLicense)

-- | License entitlements.
grantedLicense_entitlements :: Lens.Lens' GrantedLicense (Prelude.Maybe [Entitlement])
grantedLicense_entitlements :: (Maybe [Entitlement] -> f (Maybe [Entitlement]))
-> GrantedLicense -> f GrantedLicense
grantedLicense_entitlements = (GrantedLicense -> Maybe [Entitlement])
-> (GrantedLicense -> Maybe [Entitlement] -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe [Entitlement])
     (Maybe [Entitlement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe [Entitlement]
entitlements :: Maybe [Entitlement]
$sel:entitlements:GrantedLicense' :: GrantedLicense -> Maybe [Entitlement]
entitlements} -> Maybe [Entitlement]
entitlements) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe [Entitlement]
a -> GrantedLicense
s {$sel:entitlements:GrantedLicense' :: Maybe [Entitlement]
entitlements = Maybe [Entitlement]
a} :: GrantedLicense) ((Maybe [Entitlement] -> f (Maybe [Entitlement]))
 -> GrantedLicense -> f GrantedLicense)
-> ((Maybe [Entitlement] -> f (Maybe [Entitlement]))
    -> Maybe [Entitlement] -> f (Maybe [Entitlement]))
-> (Maybe [Entitlement] -> f (Maybe [Entitlement]))
-> GrantedLicense
-> f GrantedLicense
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Entitlement] [Entitlement] [Entitlement] [Entitlement]
-> Iso
     (Maybe [Entitlement])
     (Maybe [Entitlement])
     (Maybe [Entitlement])
     (Maybe [Entitlement])
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 [Entitlement] [Entitlement] [Entitlement] [Entitlement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Date and time range during which the granted license is valid, in
-- ISO8601-UTC format.
grantedLicense_validity :: Lens.Lens' GrantedLicense (Prelude.Maybe DatetimeRange)
grantedLicense_validity :: (Maybe DatetimeRange -> f (Maybe DatetimeRange))
-> GrantedLicense -> f GrantedLicense
grantedLicense_validity = (GrantedLicense -> Maybe DatetimeRange)
-> (GrantedLicense -> Maybe DatetimeRange -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe DatetimeRange)
     (Maybe DatetimeRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe DatetimeRange
validity :: Maybe DatetimeRange
$sel:validity:GrantedLicense' :: GrantedLicense -> Maybe DatetimeRange
validity} -> Maybe DatetimeRange
validity) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe DatetimeRange
a -> GrantedLicense
s {$sel:validity:GrantedLicense' :: Maybe DatetimeRange
validity = Maybe DatetimeRange
a} :: GrantedLicense)

-- | Configuration for consumption of the license.
grantedLicense_consumptionConfiguration :: Lens.Lens' GrantedLicense (Prelude.Maybe ConsumptionConfiguration)
grantedLicense_consumptionConfiguration :: (Maybe ConsumptionConfiguration
 -> f (Maybe ConsumptionConfiguration))
-> GrantedLicense -> f GrantedLicense
grantedLicense_consumptionConfiguration = (GrantedLicense -> Maybe ConsumptionConfiguration)
-> (GrantedLicense
    -> Maybe ConsumptionConfiguration -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe ConsumptionConfiguration)
     (Maybe ConsumptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe ConsumptionConfiguration
consumptionConfiguration :: Maybe ConsumptionConfiguration
$sel:consumptionConfiguration:GrantedLicense' :: GrantedLicense -> Maybe ConsumptionConfiguration
consumptionConfiguration} -> Maybe ConsumptionConfiguration
consumptionConfiguration) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe ConsumptionConfiguration
a -> GrantedLicense
s {$sel:consumptionConfiguration:GrantedLicense' :: Maybe ConsumptionConfiguration
consumptionConfiguration = Maybe ConsumptionConfiguration
a} :: GrantedLicense)

-- | Granted license beneficiary.
grantedLicense_beneficiary :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_beneficiary :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_beneficiary = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
beneficiary :: Maybe Text
$sel:beneficiary:GrantedLicense' :: GrantedLicense -> Maybe Text
beneficiary} -> Maybe Text
beneficiary) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:beneficiary:GrantedLicense' :: Maybe Text
beneficiary = Maybe Text
a} :: GrantedLicense)

-- | Granted license issuer.
grantedLicense_issuer :: Lens.Lens' GrantedLicense (Prelude.Maybe IssuerDetails)
grantedLicense_issuer :: (Maybe IssuerDetails -> f (Maybe IssuerDetails))
-> GrantedLicense -> f GrantedLicense
grantedLicense_issuer = (GrantedLicense -> Maybe IssuerDetails)
-> (GrantedLicense -> Maybe IssuerDetails -> GrantedLicense)
-> Lens
     GrantedLicense
     GrantedLicense
     (Maybe IssuerDetails)
     (Maybe IssuerDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe IssuerDetails
issuer :: Maybe IssuerDetails
$sel:issuer:GrantedLicense' :: GrantedLicense -> Maybe IssuerDetails
issuer} -> Maybe IssuerDetails
issuer) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe IssuerDetails
a -> GrantedLicense
s {$sel:issuer:GrantedLicense' :: Maybe IssuerDetails
issuer = Maybe IssuerDetails
a} :: GrantedLicense)

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

-- | Granted license metadata.
grantedLicense_licenseMetadata :: Lens.Lens' GrantedLicense (Prelude.Maybe [Metadata])
grantedLicense_licenseMetadata :: (Maybe [Metadata] -> f (Maybe [Metadata]))
-> GrantedLicense -> f GrantedLicense
grantedLicense_licenseMetadata = (GrantedLicense -> Maybe [Metadata])
-> (GrantedLicense -> Maybe [Metadata] -> GrantedLicense)
-> Lens
     GrantedLicense GrantedLicense (Maybe [Metadata]) (Maybe [Metadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe [Metadata]
licenseMetadata :: Maybe [Metadata]
$sel:licenseMetadata:GrantedLicense' :: GrantedLicense -> Maybe [Metadata]
licenseMetadata} -> Maybe [Metadata]
licenseMetadata) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe [Metadata]
a -> GrantedLicense
s {$sel:licenseMetadata:GrantedLicense' :: Maybe [Metadata]
licenseMetadata = Maybe [Metadata]
a} :: GrantedLicense) ((Maybe [Metadata] -> f (Maybe [Metadata]))
 -> GrantedLicense -> f GrantedLicense)
-> ((Maybe [Metadata] -> f (Maybe [Metadata]))
    -> Maybe [Metadata] -> f (Maybe [Metadata]))
-> (Maybe [Metadata] -> f (Maybe [Metadata]))
-> GrantedLicense
-> f GrantedLicense
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Metadata] [Metadata] [Metadata] [Metadata]
-> Iso
     (Maybe [Metadata])
     (Maybe [Metadata])
     (Maybe [Metadata])
     (Maybe [Metadata])
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 [Metadata] [Metadata] [Metadata] [Metadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Creation time of the granted license.
grantedLicense_createTime :: Lens.Lens' GrantedLicense (Prelude.Maybe Prelude.Text)
grantedLicense_createTime :: (Maybe Text -> f (Maybe Text))
-> GrantedLicense -> f GrantedLicense
grantedLicense_createTime = (GrantedLicense -> Maybe Text)
-> (GrantedLicense -> Maybe Text -> GrantedLicense)
-> Lens GrantedLicense GrantedLicense (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GrantedLicense' {Maybe Text
createTime :: Maybe Text
$sel:createTime:GrantedLicense' :: GrantedLicense -> Maybe Text
createTime} -> Maybe Text
createTime) (\s :: GrantedLicense
s@GrantedLicense' {} Maybe Text
a -> GrantedLicense
s {$sel:createTime:GrantedLicense' :: Maybe Text
createTime = Maybe Text
a} :: GrantedLicense)

instance Core.FromJSON GrantedLicense where
  parseJSON :: Value -> Parser GrantedLicense
parseJSON =
    String
-> (Object -> Parser GrantedLicense)
-> Value
-> Parser GrantedLicense
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GrantedLicense"
      ( \Object
x ->
          Maybe LicenseStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ReceivedMetadata
-> Maybe Text
-> Maybe [Entitlement]
-> Maybe DatetimeRange
-> Maybe ConsumptionConfiguration
-> Maybe Text
-> Maybe IssuerDetails
-> Maybe Text
-> Maybe [Metadata]
-> Maybe Text
-> GrantedLicense
GrantedLicense'
            (Maybe LicenseStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe ReceivedMetadata
 -> Maybe Text
 -> Maybe [Entitlement]
 -> Maybe DatetimeRange
 -> Maybe ConsumptionConfiguration
 -> Maybe Text
 -> Maybe IssuerDetails
 -> Maybe Text
 -> Maybe [Metadata]
 -> Maybe Text
 -> GrantedLicense)
-> Parser (Maybe LicenseStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ReceivedMetadata
      -> Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LicenseStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ReceivedMetadata
   -> Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe ReceivedMetadata
      -> Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
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
"ProductName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe ReceivedMetadata
   -> Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ReceivedMetadata
      -> Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
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
"LicenseName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ReceivedMetadata
   -> Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ReceivedMetadata
      -> Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
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
"ProductSKU")
            Parser
  (Maybe Text
   -> Maybe ReceivedMetadata
   -> Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe ReceivedMetadata
      -> Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
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
"HomeRegion")
            Parser
  (Maybe ReceivedMetadata
   -> Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe ReceivedMetadata)
-> Parser
     (Maybe Text
      -> Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReceivedMetadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ReceivedMetadata")
            Parser
  (Maybe Text
   -> Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Entitlement]
      -> Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
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
"Version")
            Parser
  (Maybe [Entitlement]
   -> Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe [Entitlement])
-> Parser
     (Maybe DatetimeRange
      -> Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Entitlement]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Entitlements" Parser (Maybe (Maybe [Entitlement]))
-> Maybe [Entitlement] -> Parser (Maybe [Entitlement])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Entitlement]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe DatetimeRange
   -> Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe DatetimeRange)
-> Parser
     (Maybe ConsumptionConfiguration
      -> Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatetimeRange)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Validity")
            Parser
  (Maybe ConsumptionConfiguration
   -> Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe ConsumptionConfiguration)
-> Parser
     (Maybe Text
      -> Maybe IssuerDetails
      -> Maybe Text
      -> Maybe [Metadata]
      -> Maybe Text
      -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConsumptionConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConsumptionConfiguration")
            Parser
  (Maybe Text
   -> Maybe IssuerDetails
   -> Maybe Text
   -> Maybe [Metadata]
   -> Maybe Text
   -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser
     (Maybe IssuerDetails
      -> Maybe Text -> Maybe [Metadata] -> Maybe Text -> GrantedLicense)
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
"Beneficiary")
            Parser
  (Maybe IssuerDetails
   -> Maybe Text -> Maybe [Metadata] -> Maybe Text -> GrantedLicense)
-> Parser (Maybe IssuerDetails)
-> Parser
     (Maybe Text -> Maybe [Metadata] -> Maybe Text -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IssuerDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Issuer")
            Parser
  (Maybe Text -> Maybe [Metadata] -> Maybe Text -> GrantedLicense)
-> Parser (Maybe Text)
-> Parser (Maybe [Metadata] -> Maybe Text -> GrantedLicense)
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
"LicenseArn")
            Parser (Maybe [Metadata] -> Maybe Text -> GrantedLicense)
-> Parser (Maybe [Metadata])
-> Parser (Maybe Text -> GrantedLicense)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Metadata]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LicenseMetadata"
                            Parser (Maybe (Maybe [Metadata]))
-> Maybe [Metadata] -> Parser (Maybe [Metadata])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Metadata]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> GrantedLicense)
-> Parser (Maybe Text) -> Parser GrantedLicense
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
"CreateTime")
      )

instance Prelude.Hashable GrantedLicense

instance Prelude.NFData GrantedLicense