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