{-# 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.IoTAnalytics.Types.DeviceShadowEnrichActivity
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTAnalytics.Types.DeviceShadowEnrichActivity where

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

-- | An activity that adds information from the IoT Device Shadow service to
-- a message.
--
-- /See:/ 'newDeviceShadowEnrichActivity' smart constructor.
data DeviceShadowEnrichActivity = DeviceShadowEnrichActivity'
  { -- | The next activity in the pipeline.
    DeviceShadowEnrichActivity -> Maybe Text
next :: Prelude.Maybe Prelude.Text,
    -- | The name of the @deviceShadowEnrich@ activity.
    DeviceShadowEnrichActivity -> Text
name :: Prelude.Text,
    -- | The name of the attribute that is added to the message.
    DeviceShadowEnrichActivity -> Text
attribute :: Prelude.Text,
    -- | The name of the IoT device whose shadow information is added to the
    -- message.
    DeviceShadowEnrichActivity -> Text
thingName :: Prelude.Text,
    -- | The ARN of the role that allows access to the device\'s shadow.
    DeviceShadowEnrichActivity -> Text
roleArn :: Prelude.Text
  }
  deriving (DeviceShadowEnrichActivity -> DeviceShadowEnrichActivity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceShadowEnrichActivity -> DeviceShadowEnrichActivity -> Bool
$c/= :: DeviceShadowEnrichActivity -> DeviceShadowEnrichActivity -> Bool
== :: DeviceShadowEnrichActivity -> DeviceShadowEnrichActivity -> Bool
$c== :: DeviceShadowEnrichActivity -> DeviceShadowEnrichActivity -> Bool
Prelude.Eq, ReadPrec [DeviceShadowEnrichActivity]
ReadPrec DeviceShadowEnrichActivity
Int -> ReadS DeviceShadowEnrichActivity
ReadS [DeviceShadowEnrichActivity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeviceShadowEnrichActivity]
$creadListPrec :: ReadPrec [DeviceShadowEnrichActivity]
readPrec :: ReadPrec DeviceShadowEnrichActivity
$creadPrec :: ReadPrec DeviceShadowEnrichActivity
readList :: ReadS [DeviceShadowEnrichActivity]
$creadList :: ReadS [DeviceShadowEnrichActivity]
readsPrec :: Int -> ReadS DeviceShadowEnrichActivity
$creadsPrec :: Int -> ReadS DeviceShadowEnrichActivity
Prelude.Read, Int -> DeviceShadowEnrichActivity -> ShowS
[DeviceShadowEnrichActivity] -> ShowS
DeviceShadowEnrichActivity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceShadowEnrichActivity] -> ShowS
$cshowList :: [DeviceShadowEnrichActivity] -> ShowS
show :: DeviceShadowEnrichActivity -> String
$cshow :: DeviceShadowEnrichActivity -> String
showsPrec :: Int -> DeviceShadowEnrichActivity -> ShowS
$cshowsPrec :: Int -> DeviceShadowEnrichActivity -> ShowS
Prelude.Show, forall x.
Rep DeviceShadowEnrichActivity x -> DeviceShadowEnrichActivity
forall x.
DeviceShadowEnrichActivity -> Rep DeviceShadowEnrichActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeviceShadowEnrichActivity x -> DeviceShadowEnrichActivity
$cfrom :: forall x.
DeviceShadowEnrichActivity -> Rep DeviceShadowEnrichActivity x
Prelude.Generic)

-- |
-- Create a value of 'DeviceShadowEnrichActivity' 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:
--
-- 'next', 'deviceShadowEnrichActivity_next' - The next activity in the pipeline.
--
-- 'name', 'deviceShadowEnrichActivity_name' - The name of the @deviceShadowEnrich@ activity.
--
-- 'attribute', 'deviceShadowEnrichActivity_attribute' - The name of the attribute that is added to the message.
--
-- 'thingName', 'deviceShadowEnrichActivity_thingName' - The name of the IoT device whose shadow information is added to the
-- message.
--
-- 'roleArn', 'deviceShadowEnrichActivity_roleArn' - The ARN of the role that allows access to the device\'s shadow.
newDeviceShadowEnrichActivity ::
  -- | 'name'
  Prelude.Text ->
  -- | 'attribute'
  Prelude.Text ->
  -- | 'thingName'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  DeviceShadowEnrichActivity
newDeviceShadowEnrichActivity :: Text -> Text -> Text -> Text -> DeviceShadowEnrichActivity
newDeviceShadowEnrichActivity
  Text
pName_
  Text
pAttribute_
  Text
pThingName_
  Text
pRoleArn_ =
    DeviceShadowEnrichActivity'
      { $sel:next:DeviceShadowEnrichActivity' :: Maybe Text
next = forall a. Maybe a
Prelude.Nothing,
        $sel:name:DeviceShadowEnrichActivity' :: Text
name = Text
pName_,
        $sel:attribute:DeviceShadowEnrichActivity' :: Text
attribute = Text
pAttribute_,
        $sel:thingName:DeviceShadowEnrichActivity' :: Text
thingName = Text
pThingName_,
        $sel:roleArn:DeviceShadowEnrichActivity' :: Text
roleArn = Text
pRoleArn_
      }

-- | The next activity in the pipeline.
deviceShadowEnrichActivity_next :: Lens.Lens' DeviceShadowEnrichActivity (Prelude.Maybe Prelude.Text)
deviceShadowEnrichActivity_next :: Lens' DeviceShadowEnrichActivity (Maybe Text)
deviceShadowEnrichActivity_next = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceShadowEnrichActivity' {Maybe Text
next :: Maybe Text
$sel:next:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Maybe Text
next} -> Maybe Text
next) (\s :: DeviceShadowEnrichActivity
s@DeviceShadowEnrichActivity' {} Maybe Text
a -> DeviceShadowEnrichActivity
s {$sel:next:DeviceShadowEnrichActivity' :: Maybe Text
next = Maybe Text
a} :: DeviceShadowEnrichActivity)

-- | The name of the @deviceShadowEnrich@ activity.
deviceShadowEnrichActivity_name :: Lens.Lens' DeviceShadowEnrichActivity Prelude.Text
deviceShadowEnrichActivity_name :: Lens' DeviceShadowEnrichActivity Text
deviceShadowEnrichActivity_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceShadowEnrichActivity' {Text
name :: Text
$sel:name:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
name} -> Text
name) (\s :: DeviceShadowEnrichActivity
s@DeviceShadowEnrichActivity' {} Text
a -> DeviceShadowEnrichActivity
s {$sel:name:DeviceShadowEnrichActivity' :: Text
name = Text
a} :: DeviceShadowEnrichActivity)

-- | The name of the attribute that is added to the message.
deviceShadowEnrichActivity_attribute :: Lens.Lens' DeviceShadowEnrichActivity Prelude.Text
deviceShadowEnrichActivity_attribute :: Lens' DeviceShadowEnrichActivity Text
deviceShadowEnrichActivity_attribute = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceShadowEnrichActivity' {Text
attribute :: Text
$sel:attribute:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
attribute} -> Text
attribute) (\s :: DeviceShadowEnrichActivity
s@DeviceShadowEnrichActivity' {} Text
a -> DeviceShadowEnrichActivity
s {$sel:attribute:DeviceShadowEnrichActivity' :: Text
attribute = Text
a} :: DeviceShadowEnrichActivity)

-- | The name of the IoT device whose shadow information is added to the
-- message.
deviceShadowEnrichActivity_thingName :: Lens.Lens' DeviceShadowEnrichActivity Prelude.Text
deviceShadowEnrichActivity_thingName :: Lens' DeviceShadowEnrichActivity Text
deviceShadowEnrichActivity_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceShadowEnrichActivity' {Text
thingName :: Text
$sel:thingName:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
thingName} -> Text
thingName) (\s :: DeviceShadowEnrichActivity
s@DeviceShadowEnrichActivity' {} Text
a -> DeviceShadowEnrichActivity
s {$sel:thingName:DeviceShadowEnrichActivity' :: Text
thingName = Text
a} :: DeviceShadowEnrichActivity)

-- | The ARN of the role that allows access to the device\'s shadow.
deviceShadowEnrichActivity_roleArn :: Lens.Lens' DeviceShadowEnrichActivity Prelude.Text
deviceShadowEnrichActivity_roleArn :: Lens' DeviceShadowEnrichActivity Text
deviceShadowEnrichActivity_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeviceShadowEnrichActivity' {Text
roleArn :: Text
$sel:roleArn:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
roleArn} -> Text
roleArn) (\s :: DeviceShadowEnrichActivity
s@DeviceShadowEnrichActivity' {} Text
a -> DeviceShadowEnrichActivity
s {$sel:roleArn:DeviceShadowEnrichActivity' :: Text
roleArn = Text
a} :: DeviceShadowEnrichActivity)

instance Data.FromJSON DeviceShadowEnrichActivity where
  parseJSON :: Value -> Parser DeviceShadowEnrichActivity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceShadowEnrichActivity"
      ( \Object
x ->
          Maybe Text
-> Text -> Text -> Text -> Text -> DeviceShadowEnrichActivity
DeviceShadowEnrichActivity'
            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
"next")
            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
"attribute")
            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
"thingName")
            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
"roleArn")
      )

instance Prelude.Hashable DeviceShadowEnrichActivity where
  hashWithSalt :: Int -> DeviceShadowEnrichActivity -> Int
hashWithSalt Int
_salt DeviceShadowEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:thingName:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:attribute:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:name:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:next:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
next
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attribute
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
thingName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData DeviceShadowEnrichActivity where
  rnf :: DeviceShadowEnrichActivity -> ()
rnf DeviceShadowEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:thingName:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:attribute:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:name:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:next:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
next
      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 Text
attribute
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
thingName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

instance Data.ToJSON DeviceShadowEnrichActivity where
  toJSON :: DeviceShadowEnrichActivity -> Value
toJSON DeviceShadowEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:thingName:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:attribute:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:name:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Text
$sel:next:DeviceShadowEnrichActivity' :: DeviceShadowEnrichActivity -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"next" 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 Text
next,
            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
"attribute" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
attribute),
            forall a. a -> Maybe a
Prelude.Just (Key
"thingName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
thingName),
            forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn)
          ]
      )