{-# 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.RemoveAttributesActivity
-- 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.RemoveAttributesActivity 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 removes attributes from a message.
--
-- /See:/ 'newRemoveAttributesActivity' smart constructor.
data RemoveAttributesActivity = RemoveAttributesActivity'
  { -- | The next activity in the pipeline.
    RemoveAttributesActivity -> Maybe Text
next :: Prelude.Maybe Prelude.Text,
    -- | The name of the @removeAttributes@ activity.
    RemoveAttributesActivity -> Text
name :: Prelude.Text,
    -- | A list of 1-50 attributes to remove from the message.
    RemoveAttributesActivity -> NonEmpty Text
attributes :: Prelude.NonEmpty Prelude.Text
  }
  deriving (RemoveAttributesActivity -> RemoveAttributesActivity -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveAttributesActivity -> RemoveAttributesActivity -> Bool
$c/= :: RemoveAttributesActivity -> RemoveAttributesActivity -> Bool
== :: RemoveAttributesActivity -> RemoveAttributesActivity -> Bool
$c== :: RemoveAttributesActivity -> RemoveAttributesActivity -> Bool
Prelude.Eq, ReadPrec [RemoveAttributesActivity]
ReadPrec RemoveAttributesActivity
Int -> ReadS RemoveAttributesActivity
ReadS [RemoveAttributesActivity]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveAttributesActivity]
$creadListPrec :: ReadPrec [RemoveAttributesActivity]
readPrec :: ReadPrec RemoveAttributesActivity
$creadPrec :: ReadPrec RemoveAttributesActivity
readList :: ReadS [RemoveAttributesActivity]
$creadList :: ReadS [RemoveAttributesActivity]
readsPrec :: Int -> ReadS RemoveAttributesActivity
$creadsPrec :: Int -> ReadS RemoveAttributesActivity
Prelude.Read, Int -> RemoveAttributesActivity -> ShowS
[RemoveAttributesActivity] -> ShowS
RemoveAttributesActivity -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveAttributesActivity] -> ShowS
$cshowList :: [RemoveAttributesActivity] -> ShowS
show :: RemoveAttributesActivity -> String
$cshow :: RemoveAttributesActivity -> String
showsPrec :: Int -> RemoveAttributesActivity -> ShowS
$cshowsPrec :: Int -> RemoveAttributesActivity -> ShowS
Prelude.Show, forall x.
Rep RemoveAttributesActivity x -> RemoveAttributesActivity
forall x.
RemoveAttributesActivity -> Rep RemoveAttributesActivity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveAttributesActivity x -> RemoveAttributesActivity
$cfrom :: forall x.
RemoveAttributesActivity -> Rep RemoveAttributesActivity x
Prelude.Generic)

-- |
-- Create a value of 'RemoveAttributesActivity' 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', 'removeAttributesActivity_next' - The next activity in the pipeline.
--
-- 'name', 'removeAttributesActivity_name' - The name of the @removeAttributes@ activity.
--
-- 'attributes', 'removeAttributesActivity_attributes' - A list of 1-50 attributes to remove from the message.
newRemoveAttributesActivity ::
  -- | 'name'
  Prelude.Text ->
  -- | 'attributes'
  Prelude.NonEmpty Prelude.Text ->
  RemoveAttributesActivity
newRemoveAttributesActivity :: Text -> NonEmpty Text -> RemoveAttributesActivity
newRemoveAttributesActivity Text
pName_ NonEmpty Text
pAttributes_ =
  RemoveAttributesActivity'
    { $sel:next:RemoveAttributesActivity' :: Maybe Text
next = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RemoveAttributesActivity' :: Text
name = Text
pName_,
      $sel:attributes:RemoveAttributesActivity' :: NonEmpty Text
attributes = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAttributes_
    }

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

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

-- | A list of 1-50 attributes to remove from the message.
removeAttributesActivity_attributes :: Lens.Lens' RemoveAttributesActivity (Prelude.NonEmpty Prelude.Text)
removeAttributesActivity_attributes :: Lens' RemoveAttributesActivity (NonEmpty Text)
removeAttributesActivity_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveAttributesActivity' {NonEmpty Text
attributes :: NonEmpty Text
$sel:attributes:RemoveAttributesActivity' :: RemoveAttributesActivity -> NonEmpty Text
attributes} -> NonEmpty Text
attributes) (\s :: RemoveAttributesActivity
s@RemoveAttributesActivity' {} NonEmpty Text
a -> RemoveAttributesActivity
s {$sel:attributes:RemoveAttributesActivity' :: NonEmpty Text
attributes = NonEmpty Text
a} :: RemoveAttributesActivity) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON RemoveAttributesActivity where
  parseJSON :: Value -> Parser RemoveAttributesActivity
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RemoveAttributesActivity"
      ( \Object
x ->
          Maybe Text -> Text -> NonEmpty Text -> RemoveAttributesActivity
RemoveAttributesActivity'
            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
"attributes")
      )

instance Prelude.Hashable RemoveAttributesActivity where
  hashWithSalt :: Int -> RemoveAttributesActivity -> Int
hashWithSalt Int
_salt RemoveAttributesActivity' {Maybe Text
NonEmpty Text
Text
attributes :: NonEmpty Text
name :: Text
next :: Maybe Text
$sel:attributes:RemoveAttributesActivity' :: RemoveAttributesActivity -> NonEmpty Text
$sel:name:RemoveAttributesActivity' :: RemoveAttributesActivity -> Text
$sel:next:RemoveAttributesActivity' :: RemoveAttributesActivity -> 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` NonEmpty Text
attributes

instance Prelude.NFData RemoveAttributesActivity where
  rnf :: RemoveAttributesActivity -> ()
rnf RemoveAttributesActivity' {Maybe Text
NonEmpty Text
Text
attributes :: NonEmpty Text
name :: Text
next :: Maybe Text
$sel:attributes:RemoveAttributesActivity' :: RemoveAttributesActivity -> NonEmpty Text
$sel:name:RemoveAttributesActivity' :: RemoveAttributesActivity -> Text
$sel:next:RemoveAttributesActivity' :: RemoveAttributesActivity -> 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 NonEmpty Text
attributes

instance Data.ToJSON RemoveAttributesActivity where
  toJSON :: RemoveAttributesActivity -> Value
toJSON RemoveAttributesActivity' {Maybe Text
NonEmpty Text
Text
attributes :: NonEmpty Text
name :: Text
next :: Maybe Text
$sel:attributes:RemoveAttributesActivity' :: RemoveAttributesActivity -> NonEmpty Text
$sel:name:RemoveAttributesActivity' :: RemoveAttributesActivity -> Text
$sel:next:RemoveAttributesActivity' :: RemoveAttributesActivity -> 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
"attributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
attributes)
          ]
      )