{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudDirectory.Types.TypedLinkFacetAttributeUpdate
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudDirectory.Types.TypedLinkFacetAttributeUpdate where

import Amazonka.CloudDirectory.Types.TypedLinkAttributeDefinition
import Amazonka.CloudDirectory.Types.UpdateActionType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A typed link facet attribute update.
--
-- /See:/ 'newTypedLinkFacetAttributeUpdate' smart constructor.
data TypedLinkFacetAttributeUpdate = TypedLinkFacetAttributeUpdate'
  { -- | The attribute to update.
    TypedLinkFacetAttributeUpdate -> TypedLinkAttributeDefinition
attribute :: TypedLinkAttributeDefinition,
    -- | The action to perform when updating the attribute.
    TypedLinkFacetAttributeUpdate -> UpdateActionType
action :: UpdateActionType
  }
  deriving (TypedLinkFacetAttributeUpdate
-> TypedLinkFacetAttributeUpdate -> Bool
(TypedLinkFacetAttributeUpdate
 -> TypedLinkFacetAttributeUpdate -> Bool)
-> (TypedLinkFacetAttributeUpdate
    -> TypedLinkFacetAttributeUpdate -> Bool)
-> Eq TypedLinkFacetAttributeUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypedLinkFacetAttributeUpdate
-> TypedLinkFacetAttributeUpdate -> Bool
$c/= :: TypedLinkFacetAttributeUpdate
-> TypedLinkFacetAttributeUpdate -> Bool
== :: TypedLinkFacetAttributeUpdate
-> TypedLinkFacetAttributeUpdate -> Bool
$c== :: TypedLinkFacetAttributeUpdate
-> TypedLinkFacetAttributeUpdate -> Bool
Prelude.Eq, ReadPrec [TypedLinkFacetAttributeUpdate]
ReadPrec TypedLinkFacetAttributeUpdate
Int -> ReadS TypedLinkFacetAttributeUpdate
ReadS [TypedLinkFacetAttributeUpdate]
(Int -> ReadS TypedLinkFacetAttributeUpdate)
-> ReadS [TypedLinkFacetAttributeUpdate]
-> ReadPrec TypedLinkFacetAttributeUpdate
-> ReadPrec [TypedLinkFacetAttributeUpdate]
-> Read TypedLinkFacetAttributeUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TypedLinkFacetAttributeUpdate]
$creadListPrec :: ReadPrec [TypedLinkFacetAttributeUpdate]
readPrec :: ReadPrec TypedLinkFacetAttributeUpdate
$creadPrec :: ReadPrec TypedLinkFacetAttributeUpdate
readList :: ReadS [TypedLinkFacetAttributeUpdate]
$creadList :: ReadS [TypedLinkFacetAttributeUpdate]
readsPrec :: Int -> ReadS TypedLinkFacetAttributeUpdate
$creadsPrec :: Int -> ReadS TypedLinkFacetAttributeUpdate
Prelude.Read, Int -> TypedLinkFacetAttributeUpdate -> ShowS
[TypedLinkFacetAttributeUpdate] -> ShowS
TypedLinkFacetAttributeUpdate -> String
(Int -> TypedLinkFacetAttributeUpdate -> ShowS)
-> (TypedLinkFacetAttributeUpdate -> String)
-> ([TypedLinkFacetAttributeUpdate] -> ShowS)
-> Show TypedLinkFacetAttributeUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypedLinkFacetAttributeUpdate] -> ShowS
$cshowList :: [TypedLinkFacetAttributeUpdate] -> ShowS
show :: TypedLinkFacetAttributeUpdate -> String
$cshow :: TypedLinkFacetAttributeUpdate -> String
showsPrec :: Int -> TypedLinkFacetAttributeUpdate -> ShowS
$cshowsPrec :: Int -> TypedLinkFacetAttributeUpdate -> ShowS
Prelude.Show, (forall x.
 TypedLinkFacetAttributeUpdate
 -> Rep TypedLinkFacetAttributeUpdate x)
-> (forall x.
    Rep TypedLinkFacetAttributeUpdate x
    -> TypedLinkFacetAttributeUpdate)
-> Generic TypedLinkFacetAttributeUpdate
forall x.
Rep TypedLinkFacetAttributeUpdate x
-> TypedLinkFacetAttributeUpdate
forall x.
TypedLinkFacetAttributeUpdate
-> Rep TypedLinkFacetAttributeUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TypedLinkFacetAttributeUpdate x
-> TypedLinkFacetAttributeUpdate
$cfrom :: forall x.
TypedLinkFacetAttributeUpdate
-> Rep TypedLinkFacetAttributeUpdate x
Prelude.Generic)

-- |
-- Create a value of 'TypedLinkFacetAttributeUpdate' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'attribute', 'typedLinkFacetAttributeUpdate_attribute' - The attribute to update.
--
-- 'action', 'typedLinkFacetAttributeUpdate_action' - The action to perform when updating the attribute.
newTypedLinkFacetAttributeUpdate ::
  -- | 'attribute'
  TypedLinkAttributeDefinition ->
  -- | 'action'
  UpdateActionType ->
  TypedLinkFacetAttributeUpdate
newTypedLinkFacetAttributeUpdate :: TypedLinkAttributeDefinition
-> UpdateActionType -> TypedLinkFacetAttributeUpdate
newTypedLinkFacetAttributeUpdate TypedLinkAttributeDefinition
pAttribute_ UpdateActionType
pAction_ =
  TypedLinkFacetAttributeUpdate' :: TypedLinkAttributeDefinition
-> UpdateActionType -> TypedLinkFacetAttributeUpdate
TypedLinkFacetAttributeUpdate'
    { $sel:attribute:TypedLinkFacetAttributeUpdate' :: TypedLinkAttributeDefinition
attribute =
        TypedLinkAttributeDefinition
pAttribute_,
      $sel:action:TypedLinkFacetAttributeUpdate' :: UpdateActionType
action = UpdateActionType
pAction_
    }

-- | The attribute to update.
typedLinkFacetAttributeUpdate_attribute :: Lens.Lens' TypedLinkFacetAttributeUpdate TypedLinkAttributeDefinition
typedLinkFacetAttributeUpdate_attribute :: (TypedLinkAttributeDefinition -> f TypedLinkAttributeDefinition)
-> TypedLinkFacetAttributeUpdate -> f TypedLinkFacetAttributeUpdate
typedLinkFacetAttributeUpdate_attribute = (TypedLinkFacetAttributeUpdate -> TypedLinkAttributeDefinition)
-> (TypedLinkFacetAttributeUpdate
    -> TypedLinkAttributeDefinition -> TypedLinkFacetAttributeUpdate)
-> Lens
     TypedLinkFacetAttributeUpdate
     TypedLinkFacetAttributeUpdate
     TypedLinkAttributeDefinition
     TypedLinkAttributeDefinition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkFacetAttributeUpdate' {TypedLinkAttributeDefinition
attribute :: TypedLinkAttributeDefinition
$sel:attribute:TypedLinkFacetAttributeUpdate' :: TypedLinkFacetAttributeUpdate -> TypedLinkAttributeDefinition
attribute} -> TypedLinkAttributeDefinition
attribute) (\s :: TypedLinkFacetAttributeUpdate
s@TypedLinkFacetAttributeUpdate' {} TypedLinkAttributeDefinition
a -> TypedLinkFacetAttributeUpdate
s {$sel:attribute:TypedLinkFacetAttributeUpdate' :: TypedLinkAttributeDefinition
attribute = TypedLinkAttributeDefinition
a} :: TypedLinkFacetAttributeUpdate)

-- | The action to perform when updating the attribute.
typedLinkFacetAttributeUpdate_action :: Lens.Lens' TypedLinkFacetAttributeUpdate UpdateActionType
typedLinkFacetAttributeUpdate_action :: (UpdateActionType -> f UpdateActionType)
-> TypedLinkFacetAttributeUpdate -> f TypedLinkFacetAttributeUpdate
typedLinkFacetAttributeUpdate_action = (TypedLinkFacetAttributeUpdate -> UpdateActionType)
-> (TypedLinkFacetAttributeUpdate
    -> UpdateActionType -> TypedLinkFacetAttributeUpdate)
-> Lens
     TypedLinkFacetAttributeUpdate
     TypedLinkFacetAttributeUpdate
     UpdateActionType
     UpdateActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TypedLinkFacetAttributeUpdate' {UpdateActionType
action :: UpdateActionType
$sel:action:TypedLinkFacetAttributeUpdate' :: TypedLinkFacetAttributeUpdate -> UpdateActionType
action} -> UpdateActionType
action) (\s :: TypedLinkFacetAttributeUpdate
s@TypedLinkFacetAttributeUpdate' {} UpdateActionType
a -> TypedLinkFacetAttributeUpdate
s {$sel:action:TypedLinkFacetAttributeUpdate' :: UpdateActionType
action = UpdateActionType
a} :: TypedLinkFacetAttributeUpdate)

instance
  Prelude.Hashable
    TypedLinkFacetAttributeUpdate

instance Prelude.NFData TypedLinkFacetAttributeUpdate

instance Core.ToJSON TypedLinkFacetAttributeUpdate where
  toJSON :: TypedLinkFacetAttributeUpdate -> Value
toJSON TypedLinkFacetAttributeUpdate' {TypedLinkAttributeDefinition
UpdateActionType
action :: UpdateActionType
attribute :: TypedLinkAttributeDefinition
$sel:action:TypedLinkFacetAttributeUpdate' :: TypedLinkFacetAttributeUpdate -> UpdateActionType
$sel:attribute:TypedLinkFacetAttributeUpdate' :: TypedLinkFacetAttributeUpdate -> TypedLinkAttributeDefinition
..} =
    [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
"Attribute" Text -> TypedLinkAttributeDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TypedLinkAttributeDefinition
attribute),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Action" Text -> UpdateActionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= UpdateActionType
action)
          ]
      )