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