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

-- |
-- Create a value of 'DeviceRegistryEnrichActivity' 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', 'deviceRegistryEnrichActivity_next' - The next activity in the pipeline.
--
-- 'name', 'deviceRegistryEnrichActivity_name' - The name of the @deviceRegistryEnrich@ activity.
--
-- 'attribute', 'deviceRegistryEnrichActivity_attribute' - The name of the attribute that is added to the message.
--
-- 'thingName', 'deviceRegistryEnrichActivity_thingName' - The name of the IoT device whose registry information is added to the
-- message.
--
-- 'roleArn', 'deviceRegistryEnrichActivity_roleArn' - The ARN of the role that allows access to the device\'s registry
-- information.
newDeviceRegistryEnrichActivity ::
  -- | 'name'
  Prelude.Text ->
  -- | 'attribute'
  Prelude.Text ->
  -- | 'thingName'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  DeviceRegistryEnrichActivity
newDeviceRegistryEnrichActivity :: Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity
newDeviceRegistryEnrichActivity
  Text
pName_
  Text
pAttribute_
  Text
pThingName_
  Text
pRoleArn_ =
    DeviceRegistryEnrichActivity'
      { $sel:next:DeviceRegistryEnrichActivity' :: Maybe Text
next =
          forall a. Maybe a
Prelude.Nothing,
        $sel:name:DeviceRegistryEnrichActivity' :: Text
name = Text
pName_,
        $sel:attribute:DeviceRegistryEnrichActivity' :: Text
attribute = Text
pAttribute_,
        $sel:thingName:DeviceRegistryEnrichActivity' :: Text
thingName = Text
pThingName_,
        $sel:roleArn:DeviceRegistryEnrichActivity' :: Text
roleArn = Text
pRoleArn_
      }

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

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

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

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

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

instance Data.FromJSON DeviceRegistryEnrichActivity where
  parseJSON :: Value -> Parser DeviceRegistryEnrichActivity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeviceRegistryEnrichActivity"
      ( \Object
x ->
          Maybe Text
-> Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity
DeviceRegistryEnrichActivity'
            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
    DeviceRegistryEnrichActivity
  where
  hashWithSalt :: Int -> DeviceRegistryEnrichActivity -> Int
hashWithSalt Int
_salt DeviceRegistryEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:thingName:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:attribute:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:name:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:next:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> 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 DeviceRegistryEnrichActivity where
  rnf :: DeviceRegistryEnrichActivity -> ()
rnf DeviceRegistryEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:thingName:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:attribute:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:name:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:next:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> 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 DeviceRegistryEnrichActivity where
  toJSON :: DeviceRegistryEnrichActivity -> Value
toJSON DeviceRegistryEnrichActivity' {Maybe Text
Text
roleArn :: Text
thingName :: Text
attribute :: Text
name :: Text
next :: Maybe Text
$sel:roleArn:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:thingName:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:attribute:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:name:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> Text
$sel:next:DeviceRegistryEnrichActivity' :: DeviceRegistryEnrichActivity -> 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)
          ]
      )