{-# 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.IoT.Types.TopicRuleListItem
-- 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.IoT.Types.TopicRuleListItem 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

-- | Describes a rule.
--
-- /See:/ 'newTopicRuleListItem' smart constructor.
data TopicRuleListItem = TopicRuleListItem'
  { -- | The date and time the rule was created.
    TopicRuleListItem -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The rule ARN.
    TopicRuleListItem -> Maybe Text
ruleArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether the rule is disabled.
    TopicRuleListItem -> Maybe Bool
ruleDisabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the rule.
    TopicRuleListItem -> Maybe Text
ruleName :: Prelude.Maybe Prelude.Text,
    -- | The pattern for the topic names that apply.
    TopicRuleListItem -> Maybe Text
topicPattern :: Prelude.Maybe Prelude.Text
  }
  deriving (TopicRuleListItem -> TopicRuleListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopicRuleListItem -> TopicRuleListItem -> Bool
$c/= :: TopicRuleListItem -> TopicRuleListItem -> Bool
== :: TopicRuleListItem -> TopicRuleListItem -> Bool
$c== :: TopicRuleListItem -> TopicRuleListItem -> Bool
Prelude.Eq, ReadPrec [TopicRuleListItem]
ReadPrec TopicRuleListItem
Int -> ReadS TopicRuleListItem
ReadS [TopicRuleListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TopicRuleListItem]
$creadListPrec :: ReadPrec [TopicRuleListItem]
readPrec :: ReadPrec TopicRuleListItem
$creadPrec :: ReadPrec TopicRuleListItem
readList :: ReadS [TopicRuleListItem]
$creadList :: ReadS [TopicRuleListItem]
readsPrec :: Int -> ReadS TopicRuleListItem
$creadsPrec :: Int -> ReadS TopicRuleListItem
Prelude.Read, Int -> TopicRuleListItem -> ShowS
[TopicRuleListItem] -> ShowS
TopicRuleListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopicRuleListItem] -> ShowS
$cshowList :: [TopicRuleListItem] -> ShowS
show :: TopicRuleListItem -> String
$cshow :: TopicRuleListItem -> String
showsPrec :: Int -> TopicRuleListItem -> ShowS
$cshowsPrec :: Int -> TopicRuleListItem -> ShowS
Prelude.Show, forall x. Rep TopicRuleListItem x -> TopicRuleListItem
forall x. TopicRuleListItem -> Rep TopicRuleListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TopicRuleListItem x -> TopicRuleListItem
$cfrom :: forall x. TopicRuleListItem -> Rep TopicRuleListItem x
Prelude.Generic)

-- |
-- Create a value of 'TopicRuleListItem' 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:
--
-- 'createdAt', 'topicRuleListItem_createdAt' - The date and time the rule was created.
--
-- 'ruleArn', 'topicRuleListItem_ruleArn' - The rule ARN.
--
-- 'ruleDisabled', 'topicRuleListItem_ruleDisabled' - Specifies whether the rule is disabled.
--
-- 'ruleName', 'topicRuleListItem_ruleName' - The name of the rule.
--
-- 'topicPattern', 'topicRuleListItem_topicPattern' - The pattern for the topic names that apply.
newTopicRuleListItem ::
  TopicRuleListItem
newTopicRuleListItem :: TopicRuleListItem
newTopicRuleListItem =
  TopicRuleListItem'
    { $sel:createdAt:TopicRuleListItem' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleArn:TopicRuleListItem' :: Maybe Text
ruleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleDisabled:TopicRuleListItem' :: Maybe Bool
ruleDisabled = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleName:TopicRuleListItem' :: Maybe Text
ruleName = forall a. Maybe a
Prelude.Nothing,
      $sel:topicPattern:TopicRuleListItem' :: Maybe Text
topicPattern = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time the rule was created.
topicRuleListItem_createdAt :: Lens.Lens' TopicRuleListItem (Prelude.Maybe Prelude.UTCTime)
topicRuleListItem_createdAt :: Lens' TopicRuleListItem (Maybe UTCTime)
topicRuleListItem_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleListItem' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:TopicRuleListItem' :: TopicRuleListItem -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: TopicRuleListItem
s@TopicRuleListItem' {} Maybe POSIX
a -> TopicRuleListItem
s {$sel:createdAt:TopicRuleListItem' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: TopicRuleListItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The rule ARN.
topicRuleListItem_ruleArn :: Lens.Lens' TopicRuleListItem (Prelude.Maybe Prelude.Text)
topicRuleListItem_ruleArn :: Lens' TopicRuleListItem (Maybe Text)
topicRuleListItem_ruleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleListItem' {Maybe Text
ruleArn :: Maybe Text
$sel:ruleArn:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
ruleArn} -> Maybe Text
ruleArn) (\s :: TopicRuleListItem
s@TopicRuleListItem' {} Maybe Text
a -> TopicRuleListItem
s {$sel:ruleArn:TopicRuleListItem' :: Maybe Text
ruleArn = Maybe Text
a} :: TopicRuleListItem)

-- | Specifies whether the rule is disabled.
topicRuleListItem_ruleDisabled :: Lens.Lens' TopicRuleListItem (Prelude.Maybe Prelude.Bool)
topicRuleListItem_ruleDisabled :: Lens' TopicRuleListItem (Maybe Bool)
topicRuleListItem_ruleDisabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleListItem' {Maybe Bool
ruleDisabled :: Maybe Bool
$sel:ruleDisabled:TopicRuleListItem' :: TopicRuleListItem -> Maybe Bool
ruleDisabled} -> Maybe Bool
ruleDisabled) (\s :: TopicRuleListItem
s@TopicRuleListItem' {} Maybe Bool
a -> TopicRuleListItem
s {$sel:ruleDisabled:TopicRuleListItem' :: Maybe Bool
ruleDisabled = Maybe Bool
a} :: TopicRuleListItem)

-- | The name of the rule.
topicRuleListItem_ruleName :: Lens.Lens' TopicRuleListItem (Prelude.Maybe Prelude.Text)
topicRuleListItem_ruleName :: Lens' TopicRuleListItem (Maybe Text)
topicRuleListItem_ruleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleListItem' {Maybe Text
ruleName :: Maybe Text
$sel:ruleName:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
ruleName} -> Maybe Text
ruleName) (\s :: TopicRuleListItem
s@TopicRuleListItem' {} Maybe Text
a -> TopicRuleListItem
s {$sel:ruleName:TopicRuleListItem' :: Maybe Text
ruleName = Maybe Text
a} :: TopicRuleListItem)

-- | The pattern for the topic names that apply.
topicRuleListItem_topicPattern :: Lens.Lens' TopicRuleListItem (Prelude.Maybe Prelude.Text)
topicRuleListItem_topicPattern :: Lens' TopicRuleListItem (Maybe Text)
topicRuleListItem_topicPattern = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleListItem' {Maybe Text
topicPattern :: Maybe Text
$sel:topicPattern:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
topicPattern} -> Maybe Text
topicPattern) (\s :: TopicRuleListItem
s@TopicRuleListItem' {} Maybe Text
a -> TopicRuleListItem
s {$sel:topicPattern:TopicRuleListItem' :: Maybe Text
topicPattern = Maybe Text
a} :: TopicRuleListItem)

instance Data.FromJSON TopicRuleListItem where
  parseJSON :: Value -> Parser TopicRuleListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TopicRuleListItem"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> TopicRuleListItem
TopicRuleListItem'
            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
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ruleArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ruleDisabled")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ruleName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"topicPattern")
      )

instance Prelude.Hashable TopicRuleListItem where
  hashWithSalt :: Int -> TopicRuleListItem -> Int
hashWithSalt Int
_salt TopicRuleListItem' {Maybe Bool
Maybe Text
Maybe POSIX
topicPattern :: Maybe Text
ruleName :: Maybe Text
ruleDisabled :: Maybe Bool
ruleArn :: Maybe Text
createdAt :: Maybe POSIX
$sel:topicPattern:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:ruleName:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:ruleDisabled:TopicRuleListItem' :: TopicRuleListItem -> Maybe Bool
$sel:ruleArn:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:createdAt:TopicRuleListItem' :: TopicRuleListItem -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ruleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ruleDisabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
ruleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
topicPattern

instance Prelude.NFData TopicRuleListItem where
  rnf :: TopicRuleListItem -> ()
rnf TopicRuleListItem' {Maybe Bool
Maybe Text
Maybe POSIX
topicPattern :: Maybe Text
ruleName :: Maybe Text
ruleDisabled :: Maybe Bool
ruleArn :: Maybe Text
createdAt :: Maybe POSIX
$sel:topicPattern:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:ruleName:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:ruleDisabled:TopicRuleListItem' :: TopicRuleListItem -> Maybe Bool
$sel:ruleArn:TopicRuleListItem' :: TopicRuleListItem -> Maybe Text
$sel:createdAt:TopicRuleListItem' :: TopicRuleListItem -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ruleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ruleDisabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
ruleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
topicPattern