{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MarketplaceEntitlement.Types.EntitlementValue
import qualified Amazonka.Prelude as Prelude
data Entitlement = Entitlement'
{
Entitlement -> Maybe Text
customerIdentifier :: Prelude.Maybe Prelude.Text,
Entitlement -> Maybe Text
dimension :: Prelude.Maybe Prelude.Text,
Entitlement -> Maybe POSIX
expirationDate :: Prelude.Maybe Data.POSIX,
Entitlement -> Maybe Text
productCode :: Prelude.Maybe Prelude.Text,
Entitlement -> Maybe EntitlementValue
value :: Prelude.Maybe EntitlementValue
}
deriving (Entitlement -> Entitlement -> Bool
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]
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
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. 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'
{ $sel:customerIdentifier:Entitlement' :: Maybe Text
customerIdentifier = forall a. Maybe a
Prelude.Nothing,
$sel:dimension:Entitlement' :: Maybe Text
dimension = forall a. Maybe a
Prelude.Nothing,
$sel:expirationDate:Entitlement' :: Maybe POSIX
expirationDate = forall a. Maybe a
Prelude.Nothing,
$sel:productCode:Entitlement' :: Maybe Text
productCode = forall a. Maybe a
Prelude.Nothing,
$sel:value:Entitlement' :: Maybe EntitlementValue
value = forall a. Maybe a
Prelude.Nothing
}
entitlement_customerIdentifier :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_customerIdentifier :: Lens' Entitlement (Maybe Text)
entitlement_customerIdentifier = 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_dimension :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_dimension :: Lens' Entitlement (Maybe Text)
entitlement_dimension = 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_expirationDate :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.UTCTime)
entitlement_expirationDate :: Lens' Entitlement (Maybe UTCTime)
entitlement_expirationDate = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
entitlement_productCode :: Lens.Lens' Entitlement (Prelude.Maybe Prelude.Text)
entitlement_productCode :: Lens' Entitlement (Maybe Text)
entitlement_productCode = 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)
entitlement_value :: Lens.Lens' Entitlement (Prelude.Maybe EntitlementValue)
entitlement_value :: Lens' Entitlement (Maybe EntitlementValue)
entitlement_value = 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)
instance Data.FromJSON Entitlement where
parseJSON :: Value -> Parser Entitlement
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Entitlement"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe EntitlementValue
-> Entitlement
Entitlement'
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
"CustomerIdentifier")
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
"Dimension")
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
"ExpirationDate")
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
"ProductCode")
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
"Value")
)
instance Prelude.Hashable Entitlement where
hashWithSalt :: Int -> Entitlement -> Int
hashWithSalt Int
_salt Entitlement' {Maybe Text
Maybe POSIX
Maybe EntitlementValue
value :: Maybe EntitlementValue
productCode :: Maybe Text
expirationDate :: Maybe POSIX
dimension :: Maybe Text
customerIdentifier :: Maybe Text
$sel:value:Entitlement' :: Entitlement -> Maybe EntitlementValue
$sel:productCode:Entitlement' :: Entitlement -> Maybe Text
$sel:expirationDate:Entitlement' :: Entitlement -> Maybe POSIX
$sel:dimension:Entitlement' :: Entitlement -> Maybe Text
$sel:customerIdentifier:Entitlement' :: Entitlement -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customerIdentifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dimension
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
expirationDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
productCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EntitlementValue
value
instance Prelude.NFData Entitlement where
rnf :: Entitlement -> ()
rnf Entitlement' {Maybe Text
Maybe POSIX
Maybe EntitlementValue
value :: Maybe EntitlementValue
productCode :: Maybe Text
expirationDate :: Maybe POSIX
dimension :: Maybe Text
customerIdentifier :: Maybe Text
$sel:value:Entitlement' :: Entitlement -> Maybe EntitlementValue
$sel:productCode:Entitlement' :: Entitlement -> Maybe Text
$sel:expirationDate:Entitlement' :: Entitlement -> Maybe POSIX
$sel:dimension:Entitlement' :: Entitlement -> Maybe Text
$sel:customerIdentifier:Entitlement' :: Entitlement -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customerIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dimension
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expirationDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
productCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EntitlementValue
value