{-# 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-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.IoTAnalytics.Types.DeviceRegistryEnrichActivity where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DeviceRegistryEnrichActivity
 -> DeviceRegistryEnrichActivity -> Bool)
-> (DeviceRegistryEnrichActivity
    -> DeviceRegistryEnrichActivity -> Bool)
-> Eq DeviceRegistryEnrichActivity
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]
(Int -> ReadS DeviceRegistryEnrichActivity)
-> ReadS [DeviceRegistryEnrichActivity]
-> ReadPrec DeviceRegistryEnrichActivity
-> ReadPrec [DeviceRegistryEnrichActivity]
-> Read 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
(Int -> DeviceRegistryEnrichActivity -> ShowS)
-> (DeviceRegistryEnrichActivity -> String)
-> ([DeviceRegistryEnrichActivity] -> ShowS)
-> Show DeviceRegistryEnrichActivity
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.
 DeviceRegistryEnrichActivity -> Rep DeviceRegistryEnrichActivity x)
-> (forall x.
    Rep DeviceRegistryEnrichActivity x -> DeviceRegistryEnrichActivity)
-> Generic DeviceRegistryEnrichActivity
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' :: Maybe Text
-> Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity
DeviceRegistryEnrichActivity'
      { $sel:next:DeviceRegistryEnrichActivity' :: Maybe Text
next =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeviceRegistryEnrichActivity -> f DeviceRegistryEnrichActivity
deviceRegistryEnrichActivity_next = (DeviceRegistryEnrichActivity -> Maybe Text)
-> (DeviceRegistryEnrichActivity
    -> Maybe Text -> DeviceRegistryEnrichActivity)
-> Lens
     DeviceRegistryEnrichActivity
     DeviceRegistryEnrichActivity
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> DeviceRegistryEnrichActivity -> f DeviceRegistryEnrichActivity
deviceRegistryEnrichActivity_name = (DeviceRegistryEnrichActivity -> Text)
-> (DeviceRegistryEnrichActivity
    -> Text -> DeviceRegistryEnrichActivity)
-> Lens
     DeviceRegistryEnrichActivity DeviceRegistryEnrichActivity Text Text
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 :: (Text -> f Text)
-> DeviceRegistryEnrichActivity -> f DeviceRegistryEnrichActivity
deviceRegistryEnrichActivity_attribute = (DeviceRegistryEnrichActivity -> Text)
-> (DeviceRegistryEnrichActivity
    -> Text -> DeviceRegistryEnrichActivity)
-> Lens
     DeviceRegistryEnrichActivity DeviceRegistryEnrichActivity Text Text
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 :: (Text -> f Text)
-> DeviceRegistryEnrichActivity -> f DeviceRegistryEnrichActivity
deviceRegistryEnrichActivity_thingName = (DeviceRegistryEnrichActivity -> Text)
-> (DeviceRegistryEnrichActivity
    -> Text -> DeviceRegistryEnrichActivity)
-> Lens
     DeviceRegistryEnrichActivity DeviceRegistryEnrichActivity Text Text
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 :: (Text -> f Text)
-> DeviceRegistryEnrichActivity -> f DeviceRegistryEnrichActivity
deviceRegistryEnrichActivity_roleArn = (DeviceRegistryEnrichActivity -> Text)
-> (DeviceRegistryEnrichActivity
    -> Text -> DeviceRegistryEnrichActivity)
-> Lens
     DeviceRegistryEnrichActivity DeviceRegistryEnrichActivity Text Text
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 Core.FromJSON DeviceRegistryEnrichActivity where
  parseJSON :: Value -> Parser DeviceRegistryEnrichActivity
parseJSON =
    String
-> (Object -> Parser DeviceRegistryEnrichActivity)
-> Value
-> Parser DeviceRegistryEnrichActivity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DeviceRegistryEnrichActivity"
      ( \Object
x ->
          Maybe Text
-> Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity
DeviceRegistryEnrichActivity'
            (Maybe Text
 -> Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity)
-> Parser (Maybe Text)
-> Parser
     (Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"next")
            Parser
  (Text -> Text -> Text -> Text -> DeviceRegistryEnrichActivity)
-> Parser Text
-> Parser (Text -> Text -> Text -> DeviceRegistryEnrichActivity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
            Parser (Text -> Text -> Text -> DeviceRegistryEnrichActivity)
-> Parser Text
-> Parser (Text -> Text -> DeviceRegistryEnrichActivity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"attribute")
            Parser (Text -> Text -> DeviceRegistryEnrichActivity)
-> Parser Text -> Parser (Text -> DeviceRegistryEnrichActivity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"thingName")
            Parser (Text -> DeviceRegistryEnrichActivity)
-> Parser Text -> Parser DeviceRegistryEnrichActivity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
      )

instance
  Prelude.Hashable
    DeviceRegistryEnrichActivity

instance Prelude.NFData DeviceRegistryEnrichActivity

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"next" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
next,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"attribute" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
attribute),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"thingName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
thingName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
          ]
      )