{-# 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.Pricing.Types.PricingService where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PricingService = PricingService'
{
PricingService -> Maybe [Text]
attributeNames :: Prelude.Maybe [Prelude.Text],
PricingService -> Maybe Text
serviceCode :: Prelude.Maybe Prelude.Text
}
deriving (PricingService -> PricingService -> Bool
(PricingService -> PricingService -> Bool)
-> (PricingService -> PricingService -> Bool) -> Eq PricingService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PricingService -> PricingService -> Bool
$c/= :: PricingService -> PricingService -> Bool
== :: PricingService -> PricingService -> Bool
$c== :: PricingService -> PricingService -> Bool
Prelude.Eq, ReadPrec [PricingService]
ReadPrec PricingService
Int -> ReadS PricingService
ReadS [PricingService]
(Int -> ReadS PricingService)
-> ReadS [PricingService]
-> ReadPrec PricingService
-> ReadPrec [PricingService]
-> Read PricingService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PricingService]
$creadListPrec :: ReadPrec [PricingService]
readPrec :: ReadPrec PricingService
$creadPrec :: ReadPrec PricingService
readList :: ReadS [PricingService]
$creadList :: ReadS [PricingService]
readsPrec :: Int -> ReadS PricingService
$creadsPrec :: Int -> ReadS PricingService
Prelude.Read, Int -> PricingService -> ShowS
[PricingService] -> ShowS
PricingService -> String
(Int -> PricingService -> ShowS)
-> (PricingService -> String)
-> ([PricingService] -> ShowS)
-> Show PricingService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PricingService] -> ShowS
$cshowList :: [PricingService] -> ShowS
show :: PricingService -> String
$cshow :: PricingService -> String
showsPrec :: Int -> PricingService -> ShowS
$cshowsPrec :: Int -> PricingService -> ShowS
Prelude.Show, (forall x. PricingService -> Rep PricingService x)
-> (forall x. Rep PricingService x -> PricingService)
-> Generic PricingService
forall x. Rep PricingService x -> PricingService
forall x. PricingService -> Rep PricingService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PricingService x -> PricingService
$cfrom :: forall x. PricingService -> Rep PricingService x
Prelude.Generic)
newPricingService ::
PricingService
newPricingService :: PricingService
newPricingService =
PricingService' :: Maybe [Text] -> Maybe Text -> PricingService
PricingService'
{ $sel:attributeNames:PricingService' :: Maybe [Text]
attributeNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:serviceCode:PricingService' :: Maybe Text
serviceCode = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
pricingService_attributeNames :: Lens.Lens' PricingService (Prelude.Maybe [Prelude.Text])
pricingService_attributeNames :: (Maybe [Text] -> f (Maybe [Text]))
-> PricingService -> f PricingService
pricingService_attributeNames = (PricingService -> Maybe [Text])
-> (PricingService -> Maybe [Text] -> PricingService)
-> Lens PricingService PricingService (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingService' {Maybe [Text]
attributeNames :: Maybe [Text]
$sel:attributeNames:PricingService' :: PricingService -> Maybe [Text]
attributeNames} -> Maybe [Text]
attributeNames) (\s :: PricingService
s@PricingService' {} Maybe [Text]
a -> PricingService
s {$sel:attributeNames:PricingService' :: Maybe [Text]
attributeNames = Maybe [Text]
a} :: PricingService) ((Maybe [Text] -> f (Maybe [Text]))
-> PricingService -> f PricingService)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PricingService
-> f PricingService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
pricingService_serviceCode :: Lens.Lens' PricingService (Prelude.Maybe Prelude.Text)
pricingService_serviceCode :: (Maybe Text -> f (Maybe Text))
-> PricingService -> f PricingService
pricingService_serviceCode = (PricingService -> Maybe Text)
-> (PricingService -> Maybe Text -> PricingService)
-> Lens PricingService PricingService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PricingService' {Maybe Text
serviceCode :: Maybe Text
$sel:serviceCode:PricingService' :: PricingService -> Maybe Text
serviceCode} -> Maybe Text
serviceCode) (\s :: PricingService
s@PricingService' {} Maybe Text
a -> PricingService
s {$sel:serviceCode:PricingService' :: Maybe Text
serviceCode = Maybe Text
a} :: PricingService)
instance Core.FromJSON PricingService where
parseJSON :: Value -> Parser PricingService
parseJSON =
String
-> (Object -> Parser PricingService)
-> Value
-> Parser PricingService
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PricingService"
( \Object
x ->
Maybe [Text] -> Maybe Text -> PricingService
PricingService'
(Maybe [Text] -> Maybe Text -> PricingService)
-> Parser (Maybe [Text]) -> Parser (Maybe Text -> PricingService)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttributeNames" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> PricingService)
-> Parser (Maybe Text) -> Parser PricingService
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
"ServiceCode")
)
instance Prelude.Hashable PricingService
instance Prelude.NFData PricingService