{-# 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.Lens as Lens
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
(ResourceAttribute -> ResourceAttribute -> Bool)
-> (ResourceAttribute -> ResourceAttribute -> Bool)
-> Eq ResourceAttribute
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]
(Int -> ReadS ResourceAttribute)
-> ReadS [ResourceAttribute]
-> ReadPrec ResourceAttribute
-> ReadPrec [ResourceAttribute]
-> Read 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
(Int -> ResourceAttribute -> ShowS)
-> (ResourceAttribute -> String)
-> ([ResourceAttribute] -> ShowS)
-> Show ResourceAttribute
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. ResourceAttribute -> Rep ResourceAttribute x)
-> (forall x. Rep ResourceAttribute x -> ResourceAttribute)
-> Generic ResourceAttribute
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' :: ResourceAttributeType -> Text -> ResourceAttribute
ResourceAttribute' {$sel:type':ResourceAttribute' :: ResourceAttributeType
type' = ResourceAttributeType
pType_, $sel:value:ResourceAttribute' :: Text
value = Text
pValue_}
resourceAttribute_type :: Lens.Lens' ResourceAttribute ResourceAttributeType
resourceAttribute_type :: (ResourceAttributeType -> f ResourceAttributeType)
-> ResourceAttribute -> f ResourceAttribute
resourceAttribute_type = (ResourceAttribute -> ResourceAttributeType)
-> (ResourceAttribute
-> ResourceAttributeType -> ResourceAttribute)
-> Lens
ResourceAttribute
ResourceAttribute
ResourceAttributeType
ResourceAttributeType
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 :: (Text -> f Text) -> ResourceAttribute -> f ResourceAttribute
resourceAttribute_value = (ResourceAttribute -> Text)
-> (ResourceAttribute -> Text -> ResourceAttribute)
-> Lens ResourceAttribute ResourceAttribute Text Text
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 Core.FromJSON ResourceAttribute where
parseJSON :: Value -> Parser ResourceAttribute
parseJSON =
String
-> (Object -> Parser ResourceAttribute)
-> Value
-> Parser ResourceAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResourceAttribute"
( \Object
x ->
ResourceAttributeType -> Text -> ResourceAttribute
ResourceAttribute'
(ResourceAttributeType -> Text -> ResourceAttribute)
-> Parser ResourceAttributeType
-> Parser (Text -> ResourceAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser ResourceAttributeType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type") Parser (Text -> ResourceAttribute)
-> Parser Text -> Parser ResourceAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
)
instance Prelude.Hashable ResourceAttribute
instance Prelude.NFData ResourceAttribute
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> ResourceAttributeType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ResourceAttributeType
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)