{-# 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.TypedLinkAttributeDefinition where
import Amazonka.CloudDirectory.Types.FacetAttributeType
import Amazonka.CloudDirectory.Types.RequiredAttributeBehavior
import Amazonka.CloudDirectory.Types.Rule
import Amazonka.CloudDirectory.Types.TypedAttributeValue
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 TypedLinkAttributeDefinition = TypedLinkAttributeDefinition'
{
TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
defaultValue :: Prelude.Maybe TypedAttributeValue,
TypedLinkAttributeDefinition -> Maybe Bool
isImmutable :: Prelude.Maybe Prelude.Bool,
TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
rules :: Prelude.Maybe (Prelude.HashMap Prelude.Text Rule),
TypedLinkAttributeDefinition -> Text
name :: Prelude.Text,
TypedLinkAttributeDefinition -> FacetAttributeType
type' :: FacetAttributeType,
TypedLinkAttributeDefinition -> RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
}
deriving (TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
$c/= :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
== :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
$c== :: TypedLinkAttributeDefinition
-> TypedLinkAttributeDefinition -> Bool
Prelude.Eq, ReadPrec [TypedLinkAttributeDefinition]
ReadPrec TypedLinkAttributeDefinition
Int -> ReadS TypedLinkAttributeDefinition
ReadS [TypedLinkAttributeDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkAttributeDefinition]
$creadListPrec :: ReadPrec [TypedLinkAttributeDefinition]
readPrec :: ReadPrec TypedLinkAttributeDefinition
$creadPrec :: ReadPrec TypedLinkAttributeDefinition
readList :: ReadS [TypedLinkAttributeDefinition]
$creadList :: ReadS [TypedLinkAttributeDefinition]
readsPrec :: Int -> ReadS TypedLinkAttributeDefinition
$creadsPrec :: Int -> ReadS TypedLinkAttributeDefinition
Prelude.Read, Int -> TypedLinkAttributeDefinition -> ShowS
[TypedLinkAttributeDefinition] -> ShowS
TypedLinkAttributeDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkAttributeDefinition] -> ShowS
$cshowList :: [TypedLinkAttributeDefinition] -> ShowS
show :: TypedLinkAttributeDefinition -> String
$cshow :: TypedLinkAttributeDefinition -> String
showsPrec :: Int -> TypedLinkAttributeDefinition -> ShowS
$cshowsPrec :: Int -> TypedLinkAttributeDefinition -> ShowS
Prelude.Show, forall x.
Rep TypedLinkAttributeDefinition x -> TypedLinkAttributeDefinition
forall x.
TypedLinkAttributeDefinition -> Rep TypedLinkAttributeDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TypedLinkAttributeDefinition x -> TypedLinkAttributeDefinition
$cfrom :: forall x.
TypedLinkAttributeDefinition -> Rep TypedLinkAttributeDefinition x
Prelude.Generic)
newTypedLinkAttributeDefinition ::
Prelude.Text ->
FacetAttributeType ->
RequiredAttributeBehavior ->
TypedLinkAttributeDefinition
newTypedLinkAttributeDefinition :: Text
-> FacetAttributeType
-> RequiredAttributeBehavior
-> TypedLinkAttributeDefinition
newTypedLinkAttributeDefinition
Text
pName_
FacetAttributeType
pType_
RequiredAttributeBehavior
pRequiredBehavior_ =
TypedLinkAttributeDefinition'
{ $sel:defaultValue:TypedLinkAttributeDefinition' :: Maybe TypedAttributeValue
defaultValue =
forall a. Maybe a
Prelude.Nothing,
$sel:isImmutable:TypedLinkAttributeDefinition' :: Maybe Bool
isImmutable = forall a. Maybe a
Prelude.Nothing,
$sel:rules:TypedLinkAttributeDefinition' :: Maybe (HashMap Text Rule)
rules = forall a. Maybe a
Prelude.Nothing,
$sel:name:TypedLinkAttributeDefinition' :: Text
name = Text
pName_,
$sel:type':TypedLinkAttributeDefinition' :: FacetAttributeType
type' = FacetAttributeType
pType_,
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: RequiredAttributeBehavior
requiredBehavior = RequiredAttributeBehavior
pRequiredBehavior_
}
typedLinkAttributeDefinition_defaultValue :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe TypedAttributeValue)
typedLinkAttributeDefinition_defaultValue :: Lens' TypedLinkAttributeDefinition (Maybe TypedAttributeValue)
typedLinkAttributeDefinition_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe TypedAttributeValue
defaultValue :: Maybe TypedAttributeValue
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
defaultValue} -> Maybe TypedAttributeValue
defaultValue) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe TypedAttributeValue
a -> TypedLinkAttributeDefinition
s {$sel:defaultValue:TypedLinkAttributeDefinition' :: Maybe TypedAttributeValue
defaultValue = Maybe TypedAttributeValue
a} :: TypedLinkAttributeDefinition)
typedLinkAttributeDefinition_isImmutable :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe Prelude.Bool)
typedLinkAttributeDefinition_isImmutable :: Lens' TypedLinkAttributeDefinition (Maybe Bool)
typedLinkAttributeDefinition_isImmutable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe Bool
isImmutable :: Maybe Bool
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
isImmutable} -> Maybe Bool
isImmutable) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe Bool
a -> TypedLinkAttributeDefinition
s {$sel:isImmutable:TypedLinkAttributeDefinition' :: Maybe Bool
isImmutable = Maybe Bool
a} :: TypedLinkAttributeDefinition)
typedLinkAttributeDefinition_rules :: Lens.Lens' TypedLinkAttributeDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Rule))
typedLinkAttributeDefinition_rules :: Lens' TypedLinkAttributeDefinition (Maybe (HashMap Text Rule))
typedLinkAttributeDefinition_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Maybe (HashMap Text Rule)
rules :: Maybe (HashMap Text Rule)
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
rules} -> Maybe (HashMap Text Rule)
rules) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Maybe (HashMap Text Rule)
a -> TypedLinkAttributeDefinition
s {$sel:rules:TypedLinkAttributeDefinition' :: Maybe (HashMap Text Rule)
rules = Maybe (HashMap Text Rule)
a} :: TypedLinkAttributeDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
typedLinkAttributeDefinition_name :: Lens.Lens' TypedLinkAttributeDefinition Prelude.Text
typedLinkAttributeDefinition_name :: Lens' TypedLinkAttributeDefinition Text
typedLinkAttributeDefinition_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {Text
name :: Text
$sel:name:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Text
name} -> Text
name) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} Text
a -> TypedLinkAttributeDefinition
s {$sel:name:TypedLinkAttributeDefinition' :: Text
name = Text
a} :: TypedLinkAttributeDefinition)
typedLinkAttributeDefinition_type :: Lens.Lens' TypedLinkAttributeDefinition FacetAttributeType
typedLinkAttributeDefinition_type :: Lens' TypedLinkAttributeDefinition FacetAttributeType
typedLinkAttributeDefinition_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {FacetAttributeType
type' :: FacetAttributeType
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
type'} -> FacetAttributeType
type') (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} FacetAttributeType
a -> TypedLinkAttributeDefinition
s {$sel:type':TypedLinkAttributeDefinition' :: FacetAttributeType
type' = FacetAttributeType
a} :: TypedLinkAttributeDefinition)
typedLinkAttributeDefinition_requiredBehavior :: Lens.Lens' TypedLinkAttributeDefinition RequiredAttributeBehavior
typedLinkAttributeDefinition_requiredBehavior :: Lens' TypedLinkAttributeDefinition RequiredAttributeBehavior
typedLinkAttributeDefinition_requiredBehavior = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkAttributeDefinition' {RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
requiredBehavior} -> RequiredAttributeBehavior
requiredBehavior) (\s :: TypedLinkAttributeDefinition
s@TypedLinkAttributeDefinition' {} RequiredAttributeBehavior
a -> TypedLinkAttributeDefinition
s {$sel:requiredBehavior:TypedLinkAttributeDefinition' :: RequiredAttributeBehavior
requiredBehavior = RequiredAttributeBehavior
a} :: TypedLinkAttributeDefinition)
instance Data.FromJSON TypedLinkAttributeDefinition where
parseJSON :: Value -> Parser TypedLinkAttributeDefinition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TypedLinkAttributeDefinition"
( \Object
x ->
Maybe TypedAttributeValue
-> Maybe Bool
-> Maybe (HashMap Text Rule)
-> Text
-> FacetAttributeType
-> RequiredAttributeBehavior
-> TypedLinkAttributeDefinition
TypedLinkAttributeDefinition'
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
"DefaultValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IsImmutable")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Rules" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Name")
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
"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
"RequiredBehavior")
)
instance
Prelude.Hashable
TypedLinkAttributeDefinition
where
hashWithSalt :: Int -> TypedLinkAttributeDefinition -> Int
hashWithSalt Int
_salt TypedLinkAttributeDefinition' {Maybe Bool
Maybe (HashMap Text Rule)
Maybe TypedAttributeValue
Text
FacetAttributeType
RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
type' :: FacetAttributeType
name :: Text
rules :: Maybe (HashMap Text Rule)
isImmutable :: Maybe Bool
defaultValue :: Maybe TypedAttributeValue
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
$sel:name:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Text
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TypedAttributeValue
defaultValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isImmutable
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Rule)
rules
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FacetAttributeType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RequiredAttributeBehavior
requiredBehavior
instance Prelude.NFData TypedLinkAttributeDefinition where
rnf :: TypedLinkAttributeDefinition -> ()
rnf TypedLinkAttributeDefinition' {Maybe Bool
Maybe (HashMap Text Rule)
Maybe TypedAttributeValue
Text
FacetAttributeType
RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
type' :: FacetAttributeType
name :: Text
rules :: Maybe (HashMap Text Rule)
isImmutable :: Maybe Bool
defaultValue :: Maybe TypedAttributeValue
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
$sel:name:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Text
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TypedAttributeValue
defaultValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isImmutable
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Rule)
rules
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FacetAttributeType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RequiredAttributeBehavior
requiredBehavior
instance Data.ToJSON TypedLinkAttributeDefinition where
toJSON :: TypedLinkAttributeDefinition -> Value
toJSON TypedLinkAttributeDefinition' {Maybe Bool
Maybe (HashMap Text Rule)
Maybe TypedAttributeValue
Text
FacetAttributeType
RequiredAttributeBehavior
requiredBehavior :: RequiredAttributeBehavior
type' :: FacetAttributeType
name :: Text
rules :: Maybe (HashMap Text Rule)
isImmutable :: Maybe Bool
defaultValue :: Maybe TypedAttributeValue
$sel:requiredBehavior:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> RequiredAttributeBehavior
$sel:type':TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> FacetAttributeType
$sel:name:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Text
$sel:rules:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe (HashMap Text Rule)
$sel:isImmutable:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe Bool
$sel:defaultValue:TypedLinkAttributeDefinition' :: TypedLinkAttributeDefinition -> Maybe TypedAttributeValue
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DefaultValue" 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 TypedAttributeValue
defaultValue,
(Key
"IsImmutable" 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 Bool
isImmutable,
(Key
"Rules" 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 (HashMap Text Rule)
rules,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FacetAttributeType
type'),
forall a. a -> Maybe a
Prelude.Just
(Key
"RequiredBehavior" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= RequiredAttributeBehavior
requiredBehavior)
]
)