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