{-# 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 #-}
module Amazonka.MarketplaceEntitlement.Types.Entitlement where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MarketplaceEntitlement.Types.EntitlementValue
import qualified Amazonka.Prelude as Prelude
data Entitlement = Entitlement'
{
Entitlement -> Maybe Text
dimension :: Prelude.Maybe Prelude.Text,
Entitlement -> Maybe EntitlementValue
value :: Prelude.Maybe EntitlementValue,
Entitlement -> Maybe POSIX
expirationDate :: Prelude.Maybe Core.POSIX,
Entitlement -> Maybe Text
customerIdentifier :: Prelude.Maybe Prelude.Text,
Entitlement -> Maybe Text
productCode :: Prelude.Maybe Prelude.Text
}
deriving (Entitlement -> Entitlement -> Bool
(Entitlement -> Entitlement -> Bool)
-> (Entitlement -> Entitlement -> Bool) -> Eq Entitlement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Entitlement -> Entitlement -> Bool
$c/= :: Entitlement -> Entitlement -> Bool
== :: Entitlement -> Entitlement -> Bool
$c== :: Entitlement -> Entitlement -> Bool
Prelude.Eq, ReadPrec [Entitlement]
ReadPrec Entitlement
Int -> ReadS Entitlement
ReadS [Entitlement]
(Int -> ReadS Entitlement)
-> ReadS [Entitlement]
-> ReadPrec Entitlement
-> ReadPrec [Entitlement]
-> Read Entitlement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Entitlement]
$creadListPrec :: ReadPrec [Entitlement]
readPrec :: ReadPrec Entitlement
$creadPrec :: ReadPrec Entitlement
readList :: ReadS [Entitlement]
$creadList :: ReadS [Entitlement]
readsPrec :: Int -> ReadS Entitlement
$creadsPrec :: Int -> ReadS Entitlement
Prelude.Read, Int -> Entitlement -> ShowS
[Entitlement] -> ShowS
Entitlement -> String
(Int -> Entitlement -> ShowS)
-> (Entitlement -> String)
-> ([Entitlement] -> ShowS)
-> Show Entitlement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Entitlement] -> ShowS
$cshowList :: [Entitlement] -> ShowS
show :: Entitlement -> String
$cshow :: Entitlement -> String
showsPrec :: Int -> Entitlement -> ShowS
$cshowsPrec :: Int -> Entitlement -> ShowS
Prelude.Show, (forall x. Entitlement -> Rep Entitlement x)
-> (forall x. Rep Entitlement x -> Entitlement)
-> Generic Entitlement
forall x. Rep Entitlement x -> Entitlement
forall x. Entitlement -> Rep Entitlement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Entitlement x -> Entitlement
$cfrom :: forall x. Entitlement -> Rep Entitlement x
Prelude.Generic)
newEntitlement ::
Entitlement
newEntitlement :: Entitlement
newEntitlement =
Entitlement' :: Maybe Text
-> Maybe EntitlementValue
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Entitlement
Entitlement'
{ $sel:dimension:Entitlement' :: Maybe Text
dimension = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:value:Entitlement' :: Maybe EntitlementValue
value = Maybe EntitlementValue
forall a. Maybe a
Prelude.Nothing,
$sel:expirationDate:Entitlement' :: Maybe POSIX
expirationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:customerIdentifier:Entitlement' :: Maybe Text
customerIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:productCode:Entitlement' :: Maybe Text
productCode = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
entitlement_dimension :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_dimension :: (Maybe Text -> f (Maybe Text)) -> Entitlement -> f Entitlement
entitlement_dimension = (Entitlement -> Maybe Text)
-> (Entitlement -> Maybe Text -> Entitlement)
-> Lens Entitlement Entitlement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Text
dimension :: Maybe Text
$sel:dimension:Entitlement' :: Entitlement -> Maybe Text
dimension} -> Maybe Text
dimension) (\s :: Entitlement
s@Entitlement' {} Maybe Text
a -> Entitlement
s {$sel:dimension:Entitlement' :: Maybe Text
dimension = Maybe Text
a} :: Entitlement)
entitlement_value :: Lens.Lens' Entitlement (Prelude.Maybe EntitlementValue)
entitlement_value :: (Maybe EntitlementValue -> f (Maybe EntitlementValue))
-> Entitlement -> f Entitlement
entitlement_value = (Entitlement -> Maybe EntitlementValue)
-> (Entitlement -> Maybe EntitlementValue -> Entitlement)
-> Lens
Entitlement
Entitlement
(Maybe EntitlementValue)
(Maybe EntitlementValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe EntitlementValue
value :: Maybe EntitlementValue
$sel:value:Entitlement' :: Entitlement -> Maybe EntitlementValue
value} -> Maybe EntitlementValue
value) (\s :: Entitlement
s@Entitlement' {} Maybe EntitlementValue
a -> Entitlement
s {$sel:value:Entitlement' :: Maybe EntitlementValue
value = Maybe EntitlementValue
a} :: Entitlement)
entitlement_expirationDate :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.UTCTime)
entitlement_expirationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> Entitlement -> f Entitlement
entitlement_expirationDate = (Entitlement -> Maybe POSIX)
-> (Entitlement -> Maybe POSIX -> Entitlement)
-> Lens Entitlement Entitlement (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe POSIX
expirationDate :: Maybe POSIX
$sel:expirationDate:Entitlement' :: Entitlement -> Maybe POSIX
expirationDate} -> Maybe POSIX
expirationDate) (\s :: Entitlement
s@Entitlement' {} Maybe POSIX
a -> Entitlement
s {$sel:expirationDate:Entitlement' :: Maybe POSIX
expirationDate = Maybe POSIX
a} :: Entitlement) ((Maybe POSIX -> f (Maybe POSIX)) -> Entitlement -> f Entitlement)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Entitlement
-> f Entitlement
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
entitlement_customerIdentifier :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_customerIdentifier :: (Maybe Text -> f (Maybe Text)) -> Entitlement -> f Entitlement
entitlement_customerIdentifier = (Entitlement -> Maybe Text)
-> (Entitlement -> Maybe Text -> Entitlement)
-> Lens Entitlement Entitlement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Text
customerIdentifier :: Maybe Text
$sel:customerIdentifier:Entitlement' :: Entitlement -> Maybe Text
customerIdentifier} -> Maybe Text
customerIdentifier) (\s :: Entitlement
s@Entitlement' {} Maybe Text
a -> Entitlement
s {$sel:customerIdentifier:Entitlement' :: Maybe Text
customerIdentifier = Maybe Text
a} :: Entitlement)
entitlement_productCode :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_productCode :: (Maybe Text -> f (Maybe Text)) -> Entitlement -> f Entitlement
entitlement_productCode = (Entitlement -> Maybe Text)
-> (Entitlement -> Maybe Text -> Entitlement)
-> Lens Entitlement Entitlement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Entitlement' {Maybe Text
productCode :: Maybe Text
$sel:productCode:Entitlement' :: Entitlement -> Maybe Text
productCode} -> Maybe Text
productCode) (\s :: Entitlement
s@Entitlement' {} Maybe Text
a -> Entitlement
s {$sel:productCode:Entitlement' :: Maybe Text
productCode = Maybe Text
a} :: Entitlement)
instance Core.FromJSON Entitlement where
parseJSON :: Value -> Parser Entitlement
parseJSON =
String
-> (Object -> Parser Entitlement) -> Value -> Parser Entitlement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Entitlement"
( \Object
x ->
Maybe Text
-> Maybe EntitlementValue
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Entitlement
Entitlement'
(Maybe Text
-> Maybe EntitlementValue
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Entitlement)
-> Parser (Maybe Text)
-> Parser
(Maybe EntitlementValue
-> Maybe POSIX -> Maybe Text -> Maybe Text -> Entitlement)
forall (f :: * -> *) a b. Functor 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
"Dimension")
Parser
(Maybe EntitlementValue
-> Maybe POSIX -> Maybe Text -> Maybe Text -> Entitlement)
-> Parser (Maybe EntitlementValue)
-> Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Entitlement)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntitlementValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> Entitlement)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Entitlement)
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
"ExpirationDate")
Parser (Maybe Text -> Maybe Text -> Entitlement)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Entitlement)
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
"CustomerIdentifier")
Parser (Maybe Text -> Entitlement)
-> Parser (Maybe Text) -> Parser Entitlement
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
"ProductCode")
)
instance Prelude.Hashable Entitlement
instance Prelude.NFData Entitlement