{-# 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.TypedLinkSpecifier where
import Amazonka.CloudDirectory.Types.AttributeNameAndValue
import Amazonka.CloudDirectory.Types.ObjectReference
import Amazonka.CloudDirectory.Types.TypedLinkSchemaAndFacetName
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TypedLinkSpecifier = TypedLinkSpecifier'
{
TypedLinkSpecifier -> TypedLinkSchemaAndFacetName
typedLinkFacet :: TypedLinkSchemaAndFacetName,
TypedLinkSpecifier -> ObjectReference
sourceObjectReference :: ObjectReference,
TypedLinkSpecifier -> ObjectReference
targetObjectReference :: ObjectReference,
TypedLinkSpecifier -> [AttributeNameAndValue]
identityAttributeValues :: [AttributeNameAndValue]
}
deriving (TypedLinkSpecifier -> TypedLinkSpecifier -> Bool
(TypedLinkSpecifier -> TypedLinkSpecifier -> Bool)
-> (TypedLinkSpecifier -> TypedLinkSpecifier -> Bool)
-> Eq TypedLinkSpecifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkSpecifier -> TypedLinkSpecifier -> Bool
$c/= :: TypedLinkSpecifier -> TypedLinkSpecifier -> Bool
== :: TypedLinkSpecifier -> TypedLinkSpecifier -> Bool
$c== :: TypedLinkSpecifier -> TypedLinkSpecifier -> Bool
Prelude.Eq, ReadPrec [TypedLinkSpecifier]
ReadPrec TypedLinkSpecifier
Int -> ReadS TypedLinkSpecifier
ReadS [TypedLinkSpecifier]
(Int -> ReadS TypedLinkSpecifier)
-> ReadS [TypedLinkSpecifier]
-> ReadPrec TypedLinkSpecifier
-> ReadPrec [TypedLinkSpecifier]
-> Read TypedLinkSpecifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkSpecifier]
$creadListPrec :: ReadPrec [TypedLinkSpecifier]
readPrec :: ReadPrec TypedLinkSpecifier
$creadPrec :: ReadPrec TypedLinkSpecifier
readList :: ReadS [TypedLinkSpecifier]
$creadList :: ReadS [TypedLinkSpecifier]
readsPrec :: Int -> ReadS TypedLinkSpecifier
$creadsPrec :: Int -> ReadS TypedLinkSpecifier
Prelude.Read, Int -> TypedLinkSpecifier -> ShowS
[TypedLinkSpecifier] -> ShowS
TypedLinkSpecifier -> String
(Int -> TypedLinkSpecifier -> ShowS)
-> (TypedLinkSpecifier -> String)
-> ([TypedLinkSpecifier] -> ShowS)
-> Show TypedLinkSpecifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkSpecifier] -> ShowS
$cshowList :: [TypedLinkSpecifier] -> ShowS
show :: TypedLinkSpecifier -> String
$cshow :: TypedLinkSpecifier -> String
showsPrec :: Int -> TypedLinkSpecifier -> ShowS
$cshowsPrec :: Int -> TypedLinkSpecifier -> ShowS
Prelude.Show, (forall x. TypedLinkSpecifier -> Rep TypedLinkSpecifier x)
-> (forall x. Rep TypedLinkSpecifier x -> TypedLinkSpecifier)
-> Generic TypedLinkSpecifier
forall x. Rep TypedLinkSpecifier x -> TypedLinkSpecifier
forall x. TypedLinkSpecifier -> Rep TypedLinkSpecifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TypedLinkSpecifier x -> TypedLinkSpecifier
$cfrom :: forall x. TypedLinkSpecifier -> Rep TypedLinkSpecifier x
Prelude.Generic)
newTypedLinkSpecifier ::
TypedLinkSchemaAndFacetName ->
ObjectReference ->
ObjectReference ->
TypedLinkSpecifier
newTypedLinkSpecifier :: TypedLinkSchemaAndFacetName
-> ObjectReference -> ObjectReference -> TypedLinkSpecifier
newTypedLinkSpecifier
TypedLinkSchemaAndFacetName
pTypedLinkFacet_
ObjectReference
pSourceObjectReference_
ObjectReference
pTargetObjectReference_ =
TypedLinkSpecifier' :: TypedLinkSchemaAndFacetName
-> ObjectReference
-> ObjectReference
-> [AttributeNameAndValue]
-> TypedLinkSpecifier
TypedLinkSpecifier'
{ $sel:typedLinkFacet:TypedLinkSpecifier' :: TypedLinkSchemaAndFacetName
typedLinkFacet =
TypedLinkSchemaAndFacetName
pTypedLinkFacet_,
$sel:sourceObjectReference:TypedLinkSpecifier' :: ObjectReference
sourceObjectReference = ObjectReference
pSourceObjectReference_,
$sel:targetObjectReference:TypedLinkSpecifier' :: ObjectReference
targetObjectReference = ObjectReference
pTargetObjectReference_,
$sel:identityAttributeValues:TypedLinkSpecifier' :: [AttributeNameAndValue]
identityAttributeValues = [AttributeNameAndValue]
forall a. Monoid a => a
Prelude.mempty
}
typedLinkSpecifier_typedLinkFacet :: Lens.Lens' TypedLinkSpecifier TypedLinkSchemaAndFacetName
typedLinkSpecifier_typedLinkFacet :: (TypedLinkSchemaAndFacetName -> f TypedLinkSchemaAndFacetName)
-> TypedLinkSpecifier -> f TypedLinkSpecifier
typedLinkSpecifier_typedLinkFacet = (TypedLinkSpecifier -> TypedLinkSchemaAndFacetName)
-> (TypedLinkSpecifier
-> TypedLinkSchemaAndFacetName -> TypedLinkSpecifier)
-> Lens
TypedLinkSpecifier
TypedLinkSpecifier
TypedLinkSchemaAndFacetName
TypedLinkSchemaAndFacetName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSpecifier' {TypedLinkSchemaAndFacetName
typedLinkFacet :: TypedLinkSchemaAndFacetName
$sel:typedLinkFacet:TypedLinkSpecifier' :: TypedLinkSpecifier -> TypedLinkSchemaAndFacetName
typedLinkFacet} -> TypedLinkSchemaAndFacetName
typedLinkFacet) (\s :: TypedLinkSpecifier
s@TypedLinkSpecifier' {} TypedLinkSchemaAndFacetName
a -> TypedLinkSpecifier
s {$sel:typedLinkFacet:TypedLinkSpecifier' :: TypedLinkSchemaAndFacetName
typedLinkFacet = TypedLinkSchemaAndFacetName
a} :: TypedLinkSpecifier)
typedLinkSpecifier_sourceObjectReference :: Lens.Lens' TypedLinkSpecifier ObjectReference
typedLinkSpecifier_sourceObjectReference :: (ObjectReference -> f ObjectReference)
-> TypedLinkSpecifier -> f TypedLinkSpecifier
typedLinkSpecifier_sourceObjectReference = (TypedLinkSpecifier -> ObjectReference)
-> (TypedLinkSpecifier -> ObjectReference -> TypedLinkSpecifier)
-> Lens
TypedLinkSpecifier
TypedLinkSpecifier
ObjectReference
ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSpecifier' {ObjectReference
sourceObjectReference :: ObjectReference
$sel:sourceObjectReference:TypedLinkSpecifier' :: TypedLinkSpecifier -> ObjectReference
sourceObjectReference} -> ObjectReference
sourceObjectReference) (\s :: TypedLinkSpecifier
s@TypedLinkSpecifier' {} ObjectReference
a -> TypedLinkSpecifier
s {$sel:sourceObjectReference:TypedLinkSpecifier' :: ObjectReference
sourceObjectReference = ObjectReference
a} :: TypedLinkSpecifier)
typedLinkSpecifier_targetObjectReference :: Lens.Lens' TypedLinkSpecifier ObjectReference
typedLinkSpecifier_targetObjectReference :: (ObjectReference -> f ObjectReference)
-> TypedLinkSpecifier -> f TypedLinkSpecifier
typedLinkSpecifier_targetObjectReference = (TypedLinkSpecifier -> ObjectReference)
-> (TypedLinkSpecifier -> ObjectReference -> TypedLinkSpecifier)
-> Lens
TypedLinkSpecifier
TypedLinkSpecifier
ObjectReference
ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSpecifier' {ObjectReference
targetObjectReference :: ObjectReference
$sel:targetObjectReference:TypedLinkSpecifier' :: TypedLinkSpecifier -> ObjectReference
targetObjectReference} -> ObjectReference
targetObjectReference) (\s :: TypedLinkSpecifier
s@TypedLinkSpecifier' {} ObjectReference
a -> TypedLinkSpecifier
s {$sel:targetObjectReference:TypedLinkSpecifier' :: ObjectReference
targetObjectReference = ObjectReference
a} :: TypedLinkSpecifier)
typedLinkSpecifier_identityAttributeValues :: Lens.Lens' TypedLinkSpecifier [AttributeNameAndValue]
typedLinkSpecifier_identityAttributeValues :: ([AttributeNameAndValue] -> f [AttributeNameAndValue])
-> TypedLinkSpecifier -> f TypedLinkSpecifier
typedLinkSpecifier_identityAttributeValues = (TypedLinkSpecifier -> [AttributeNameAndValue])
-> (TypedLinkSpecifier
-> [AttributeNameAndValue] -> TypedLinkSpecifier)
-> Lens
TypedLinkSpecifier
TypedLinkSpecifier
[AttributeNameAndValue]
[AttributeNameAndValue]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkSpecifier' {[AttributeNameAndValue]
identityAttributeValues :: [AttributeNameAndValue]
$sel:identityAttributeValues:TypedLinkSpecifier' :: TypedLinkSpecifier -> [AttributeNameAndValue]
identityAttributeValues} -> [AttributeNameAndValue]
identityAttributeValues) (\s :: TypedLinkSpecifier
s@TypedLinkSpecifier' {} [AttributeNameAndValue]
a -> TypedLinkSpecifier
s {$sel:identityAttributeValues:TypedLinkSpecifier' :: [AttributeNameAndValue]
identityAttributeValues = [AttributeNameAndValue]
a} :: TypedLinkSpecifier) (([AttributeNameAndValue] -> f [AttributeNameAndValue])
-> TypedLinkSpecifier -> f TypedLinkSpecifier)
-> (([AttributeNameAndValue] -> f [AttributeNameAndValue])
-> [AttributeNameAndValue] -> f [AttributeNameAndValue])
-> ([AttributeNameAndValue] -> f [AttributeNameAndValue])
-> TypedLinkSpecifier
-> f TypedLinkSpecifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AttributeNameAndValue] -> f [AttributeNameAndValue])
-> [AttributeNameAndValue] -> f [AttributeNameAndValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON TypedLinkSpecifier where
parseJSON :: Value -> Parser TypedLinkSpecifier
parseJSON =
String
-> (Object -> Parser TypedLinkSpecifier)
-> Value
-> Parser TypedLinkSpecifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TypedLinkSpecifier"
( \Object
x ->
TypedLinkSchemaAndFacetName
-> ObjectReference
-> ObjectReference
-> [AttributeNameAndValue]
-> TypedLinkSpecifier
TypedLinkSpecifier'
(TypedLinkSchemaAndFacetName
-> ObjectReference
-> ObjectReference
-> [AttributeNameAndValue]
-> TypedLinkSpecifier)
-> Parser TypedLinkSchemaAndFacetName
-> Parser
(ObjectReference
-> ObjectReference
-> [AttributeNameAndValue]
-> TypedLinkSpecifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser TypedLinkSchemaAndFacetName
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TypedLinkFacet")
Parser
(ObjectReference
-> ObjectReference
-> [AttributeNameAndValue]
-> TypedLinkSpecifier)
-> Parser ObjectReference
-> Parser
(ObjectReference -> [AttributeNameAndValue] -> TypedLinkSpecifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ObjectReference
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SourceObjectReference")
Parser
(ObjectReference -> [AttributeNameAndValue] -> TypedLinkSpecifier)
-> Parser ObjectReference
-> Parser ([AttributeNameAndValue] -> TypedLinkSpecifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ObjectReference
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TargetObjectReference")
Parser ([AttributeNameAndValue] -> TypedLinkSpecifier)
-> Parser [AttributeNameAndValue] -> Parser TypedLinkSpecifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe [AttributeNameAndValue])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IdentityAttributeValues"
Parser (Maybe [AttributeNameAndValue])
-> [AttributeNameAndValue] -> Parser [AttributeNameAndValue]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [AttributeNameAndValue]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable TypedLinkSpecifier
instance Prelude.NFData TypedLinkSpecifier
instance Core.ToJSON TypedLinkSpecifier where
toJSON :: TypedLinkSpecifier -> Value
toJSON TypedLinkSpecifier' {[AttributeNameAndValue]
ObjectReference
TypedLinkSchemaAndFacetName
identityAttributeValues :: [AttributeNameAndValue]
targetObjectReference :: ObjectReference
sourceObjectReference :: ObjectReference
typedLinkFacet :: TypedLinkSchemaAndFacetName
$sel:identityAttributeValues:TypedLinkSpecifier' :: TypedLinkSpecifier -> [AttributeNameAndValue]
$sel:targetObjectReference:TypedLinkSpecifier' :: TypedLinkSpecifier -> ObjectReference
$sel:sourceObjectReference:TypedLinkSpecifier' :: TypedLinkSpecifier -> ObjectReference
$sel:typedLinkFacet:TypedLinkSpecifier' :: TypedLinkSpecifier -> TypedLinkSchemaAndFacetName
..} =
[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
"TypedLinkFacet" Text -> TypedLinkSchemaAndFacetName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TypedLinkSchemaAndFacetName
typedLinkFacet),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"SourceObjectReference"
Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
sourceObjectReference
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TargetObjectReference"
Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
targetObjectReference
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"IdentityAttributeValues"
Text -> [AttributeNameAndValue] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AttributeNameAndValue]
identityAttributeValues
)
]
)