{-# 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.LicenseManager.Types.ProductInformation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LicenseManager.Types.ProductInformationFilter
import qualified Amazonka.Prelude as Prelude
data ProductInformation = ProductInformation'
{
ProductInformation -> Text
resourceType :: Prelude.Text,
ProductInformation -> [ProductInformationFilter]
productInformationFilterList :: [ProductInformationFilter]
}
deriving (ProductInformation -> ProductInformation -> Bool
(ProductInformation -> ProductInformation -> Bool)
-> (ProductInformation -> ProductInformation -> Bool)
-> Eq ProductInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductInformation -> ProductInformation -> Bool
$c/= :: ProductInformation -> ProductInformation -> Bool
== :: ProductInformation -> ProductInformation -> Bool
$c== :: ProductInformation -> ProductInformation -> Bool
Prelude.Eq, ReadPrec [ProductInformation]
ReadPrec ProductInformation
Int -> ReadS ProductInformation
ReadS [ProductInformation]
(Int -> ReadS ProductInformation)
-> ReadS [ProductInformation]
-> ReadPrec ProductInformation
-> ReadPrec [ProductInformation]
-> Read ProductInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductInformation]
$creadListPrec :: ReadPrec [ProductInformation]
readPrec :: ReadPrec ProductInformation
$creadPrec :: ReadPrec ProductInformation
readList :: ReadS [ProductInformation]
$creadList :: ReadS [ProductInformation]
readsPrec :: Int -> ReadS ProductInformation
$creadsPrec :: Int -> ReadS ProductInformation
Prelude.Read, Int -> ProductInformation -> ShowS
[ProductInformation] -> ShowS
ProductInformation -> String
(Int -> ProductInformation -> ShowS)
-> (ProductInformation -> String)
-> ([ProductInformation] -> ShowS)
-> Show ProductInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductInformation] -> ShowS
$cshowList :: [ProductInformation] -> ShowS
show :: ProductInformation -> String
$cshow :: ProductInformation -> String
showsPrec :: Int -> ProductInformation -> ShowS
$cshowsPrec :: Int -> ProductInformation -> ShowS
Prelude.Show, (forall x. ProductInformation -> Rep ProductInformation x)
-> (forall x. Rep ProductInformation x -> ProductInformation)
-> Generic ProductInformation
forall x. Rep ProductInformation x -> ProductInformation
forall x. ProductInformation -> Rep ProductInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProductInformation x -> ProductInformation
$cfrom :: forall x. ProductInformation -> Rep ProductInformation x
Prelude.Generic)
newProductInformation ::
Prelude.Text ->
ProductInformation
newProductInformation :: Text -> ProductInformation
newProductInformation Text
pResourceType_ =
ProductInformation' :: Text -> [ProductInformationFilter] -> ProductInformation
ProductInformation'
{ $sel:resourceType:ProductInformation' :: Text
resourceType = Text
pResourceType_,
$sel:productInformationFilterList:ProductInformation' :: [ProductInformationFilter]
productInformationFilterList = [ProductInformationFilter]
forall a. Monoid a => a
Prelude.mempty
}
productInformation_resourceType :: Lens.Lens' ProductInformation Prelude.Text
productInformation_resourceType :: (Text -> f Text) -> ProductInformation -> f ProductInformation
productInformation_resourceType = (ProductInformation -> Text)
-> (ProductInformation -> Text -> ProductInformation)
-> Lens ProductInformation ProductInformation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformation' {Text
resourceType :: Text
$sel:resourceType:ProductInformation' :: ProductInformation -> Text
resourceType} -> Text
resourceType) (\s :: ProductInformation
s@ProductInformation' {} Text
a -> ProductInformation
s {$sel:resourceType:ProductInformation' :: Text
resourceType = Text
a} :: ProductInformation)
productInformation_productInformationFilterList :: Lens.Lens' ProductInformation [ProductInformationFilter]
productInformation_productInformationFilterList :: ([ProductInformationFilter] -> f [ProductInformationFilter])
-> ProductInformation -> f ProductInformation
productInformation_productInformationFilterList = (ProductInformation -> [ProductInformationFilter])
-> (ProductInformation
-> [ProductInformationFilter] -> ProductInformation)
-> Lens
ProductInformation
ProductInformation
[ProductInformationFilter]
[ProductInformationFilter]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformation' {[ProductInformationFilter]
productInformationFilterList :: [ProductInformationFilter]
$sel:productInformationFilterList:ProductInformation' :: ProductInformation -> [ProductInformationFilter]
productInformationFilterList} -> [ProductInformationFilter]
productInformationFilterList) (\s :: ProductInformation
s@ProductInformation' {} [ProductInformationFilter]
a -> ProductInformation
s {$sel:productInformationFilterList:ProductInformation' :: [ProductInformationFilter]
productInformationFilterList = [ProductInformationFilter]
a} :: ProductInformation) (([ProductInformationFilter] -> f [ProductInformationFilter])
-> ProductInformation -> f ProductInformation)
-> (([ProductInformationFilter] -> f [ProductInformationFilter])
-> [ProductInformationFilter] -> f [ProductInformationFilter])
-> ([ProductInformationFilter] -> f [ProductInformationFilter])
-> ProductInformation
-> f ProductInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProductInformationFilter] -> f [ProductInformationFilter])
-> [ProductInformationFilter] -> f [ProductInformationFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ProductInformation where
parseJSON :: Value -> Parser ProductInformation
parseJSON =
String
-> (Object -> Parser ProductInformation)
-> Value
-> Parser ProductInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ProductInformation"
( \Object
x ->
Text -> [ProductInformationFilter] -> ProductInformation
ProductInformation'
(Text -> [ProductInformationFilter] -> ProductInformation)
-> Parser Text
-> Parser ([ProductInformationFilter] -> ProductInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ResourceType")
Parser ([ProductInformationFilter] -> ProductInformation)
-> Parser [ProductInformationFilter] -> Parser ProductInformation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [ProductInformationFilter])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProductInformationFilterList"
Parser (Maybe [ProductInformationFilter])
-> [ProductInformationFilter] -> Parser [ProductInformationFilter]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [ProductInformationFilter]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable ProductInformation
instance Prelude.NFData ProductInformation
instance Core.ToJSON ProductInformation where
toJSON :: ProductInformation -> Value
toJSON ProductInformation' {[ProductInformationFilter]
Text
productInformationFilterList :: [ProductInformationFilter]
resourceType :: Text
$sel:productInformationFilterList:ProductInformation' :: ProductInformation -> [ProductInformationFilter]
$sel:resourceType:ProductInformation' :: ProductInformation -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ProductInformationFilterList"
Text -> [ProductInformationFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ProductInformationFilter]
productInformationFilterList
)
]
)