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