{-# 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.MQ.Types.ConfigurationId where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data ConfigurationId = ConfigurationId'
{
ConfigurationId -> Maybe Int
revision :: Prelude.Maybe Prelude.Int,
ConfigurationId -> Text
id :: Prelude.Text
}
deriving (ConfigurationId -> ConfigurationId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationId -> ConfigurationId -> Bool
$c/= :: ConfigurationId -> ConfigurationId -> Bool
== :: ConfigurationId -> ConfigurationId -> Bool
$c== :: ConfigurationId -> ConfigurationId -> Bool
Prelude.Eq, ReadPrec [ConfigurationId]
ReadPrec ConfigurationId
Int -> ReadS ConfigurationId
ReadS [ConfigurationId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigurationId]
$creadListPrec :: ReadPrec [ConfigurationId]
readPrec :: ReadPrec ConfigurationId
$creadPrec :: ReadPrec ConfigurationId
readList :: ReadS [ConfigurationId]
$creadList :: ReadS [ConfigurationId]
readsPrec :: Int -> ReadS ConfigurationId
$creadsPrec :: Int -> ReadS ConfigurationId
Prelude.Read, Int -> ConfigurationId -> ShowS
[ConfigurationId] -> ShowS
ConfigurationId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationId] -> ShowS
$cshowList :: [ConfigurationId] -> ShowS
show :: ConfigurationId -> String
$cshow :: ConfigurationId -> String
showsPrec :: Int -> ConfigurationId -> ShowS
$cshowsPrec :: Int -> ConfigurationId -> ShowS
Prelude.Show, forall x. Rep ConfigurationId x -> ConfigurationId
forall x. ConfigurationId -> Rep ConfigurationId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigurationId x -> ConfigurationId
$cfrom :: forall x. ConfigurationId -> Rep ConfigurationId x
Prelude.Generic)
newConfigurationId ::
Prelude.Text ->
ConfigurationId
newConfigurationId :: Text -> ConfigurationId
newConfigurationId Text
pId_ =
ConfigurationId'
{ $sel:revision:ConfigurationId' :: Maybe Int
revision = forall a. Maybe a
Prelude.Nothing,
$sel:id:ConfigurationId' :: Text
id = Text
pId_
}
configurationId_revision :: Lens.Lens' ConfigurationId (Prelude.Maybe Prelude.Int)
configurationId_revision :: Lens' ConfigurationId (Maybe Int)
configurationId_revision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationId' {Maybe Int
revision :: Maybe Int
$sel:revision:ConfigurationId' :: ConfigurationId -> Maybe Int
revision} -> Maybe Int
revision) (\s :: ConfigurationId
s@ConfigurationId' {} Maybe Int
a -> ConfigurationId
s {$sel:revision:ConfigurationId' :: Maybe Int
revision = Maybe Int
a} :: ConfigurationId)
configurationId_id :: Lens.Lens' ConfigurationId Prelude.Text
configurationId_id :: Lens' ConfigurationId Text
configurationId_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigurationId' {Text
id :: Text
$sel:id:ConfigurationId' :: ConfigurationId -> Text
id} -> Text
id) (\s :: ConfigurationId
s@ConfigurationId' {} Text
a -> ConfigurationId
s {$sel:id:ConfigurationId' :: Text
id = Text
a} :: ConfigurationId)
instance Data.FromJSON ConfigurationId where
parseJSON :: Value -> Parser ConfigurationId
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ConfigurationId"
( \Object
x ->
Maybe Int -> Text -> ConfigurationId
ConfigurationId'
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
"revision")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
)
instance Prelude.Hashable ConfigurationId where
hashWithSalt :: Int -> ConfigurationId -> Int
hashWithSalt Int
_salt ConfigurationId' {Maybe Int
Text
id :: Text
revision :: Maybe Int
$sel:id:ConfigurationId' :: ConfigurationId -> Text
$sel:revision:ConfigurationId' :: ConfigurationId -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
revision
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData ConfigurationId where
rnf :: ConfigurationId -> ()
rnf ConfigurationId' {Maybe Int
Text
id :: Text
revision :: Maybe Int
$sel:id:ConfigurationId' :: ConfigurationId -> Text
$sel:revision:ConfigurationId' :: ConfigurationId -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
revision seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToJSON ConfigurationId where
toJSON :: ConfigurationId -> Value
toJSON ConfigurationId' {Maybe Int
Text
id :: Text
revision :: Maybe Int
$sel:id:ConfigurationId' :: ConfigurationId -> Text
$sel:revision:ConfigurationId' :: ConfigurationId -> Maybe Int
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"revision" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
revision,
forall a. a -> Maybe a
Prelude.Just (Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)