{-# 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.CostExplorer.Types.EC2Specification where
import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.OfferingClass
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EC2Specification = EC2Specification'
{
EC2Specification -> Maybe OfferingClass
offeringClass :: Prelude.Maybe OfferingClass
}
deriving (EC2Specification -> EC2Specification -> Bool
(EC2Specification -> EC2Specification -> Bool)
-> (EC2Specification -> EC2Specification -> Bool)
-> Eq EC2Specification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EC2Specification -> EC2Specification -> Bool
$c/= :: EC2Specification -> EC2Specification -> Bool
== :: EC2Specification -> EC2Specification -> Bool
$c== :: EC2Specification -> EC2Specification -> Bool
Prelude.Eq, ReadPrec [EC2Specification]
ReadPrec EC2Specification
Int -> ReadS EC2Specification
ReadS [EC2Specification]
(Int -> ReadS EC2Specification)
-> ReadS [EC2Specification]
-> ReadPrec EC2Specification
-> ReadPrec [EC2Specification]
-> Read EC2Specification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EC2Specification]
$creadListPrec :: ReadPrec [EC2Specification]
readPrec :: ReadPrec EC2Specification
$creadPrec :: ReadPrec EC2Specification
readList :: ReadS [EC2Specification]
$creadList :: ReadS [EC2Specification]
readsPrec :: Int -> ReadS EC2Specification
$creadsPrec :: Int -> ReadS EC2Specification
Prelude.Read, Int -> EC2Specification -> ShowS
[EC2Specification] -> ShowS
EC2Specification -> String
(Int -> EC2Specification -> ShowS)
-> (EC2Specification -> String)
-> ([EC2Specification] -> ShowS)
-> Show EC2Specification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EC2Specification] -> ShowS
$cshowList :: [EC2Specification] -> ShowS
show :: EC2Specification -> String
$cshow :: EC2Specification -> String
showsPrec :: Int -> EC2Specification -> ShowS
$cshowsPrec :: Int -> EC2Specification -> ShowS
Prelude.Show, (forall x. EC2Specification -> Rep EC2Specification x)
-> (forall x. Rep EC2Specification x -> EC2Specification)
-> Generic EC2Specification
forall x. Rep EC2Specification x -> EC2Specification
forall x. EC2Specification -> Rep EC2Specification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EC2Specification x -> EC2Specification
$cfrom :: forall x. EC2Specification -> Rep EC2Specification x
Prelude.Generic)
newEC2Specification ::
EC2Specification
newEC2Specification :: EC2Specification
newEC2Specification =
EC2Specification' :: Maybe OfferingClass -> EC2Specification
EC2Specification' {$sel:offeringClass:EC2Specification' :: Maybe OfferingClass
offeringClass = Maybe OfferingClass
forall a. Maybe a
Prelude.Nothing}
eC2Specification_offeringClass :: Lens.Lens' EC2Specification (Prelude.Maybe OfferingClass)
eC2Specification_offeringClass :: (Maybe OfferingClass -> f (Maybe OfferingClass))
-> EC2Specification -> f EC2Specification
eC2Specification_offeringClass = (EC2Specification -> Maybe OfferingClass)
-> (EC2Specification -> Maybe OfferingClass -> EC2Specification)
-> Lens
EC2Specification
EC2Specification
(Maybe OfferingClass)
(Maybe OfferingClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EC2Specification' {Maybe OfferingClass
offeringClass :: Maybe OfferingClass
$sel:offeringClass:EC2Specification' :: EC2Specification -> Maybe OfferingClass
offeringClass} -> Maybe OfferingClass
offeringClass) (\s :: EC2Specification
s@EC2Specification' {} Maybe OfferingClass
a -> EC2Specification
s {$sel:offeringClass:EC2Specification' :: Maybe OfferingClass
offeringClass = Maybe OfferingClass
a} :: EC2Specification)
instance Core.FromJSON EC2Specification where
parseJSON :: Value -> Parser EC2Specification
parseJSON =
String
-> (Object -> Parser EC2Specification)
-> Value
-> Parser EC2Specification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"EC2Specification"
( \Object
x ->
Maybe OfferingClass -> EC2Specification
EC2Specification'
(Maybe OfferingClass -> EC2Specification)
-> Parser (Maybe OfferingClass) -> Parser EC2Specification
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OfferingClass)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OfferingClass")
)
instance Prelude.Hashable EC2Specification
instance Prelude.NFData EC2Specification
instance Core.ToJSON EC2Specification where
toJSON :: EC2Specification -> Value
toJSON EC2Specification' {Maybe OfferingClass
offeringClass :: Maybe OfferingClass
$sel:offeringClass:EC2Specification' :: EC2Specification -> Maybe OfferingClass
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"OfferingClass" Text -> OfferingClass -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(OfferingClass -> Pair) -> Maybe OfferingClass -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OfferingClass
offeringClass
]
)