{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.ListViolationEvents
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the Device Defender security profile violations discovered during
-- the given time period. You can use filters to limit the results to those
-- alerts issued for a particular security profile, behavior, or thing
-- (device).
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions ListViolationEvents>
-- action.
--
-- This operation returns paginated results.
module Amazonka.IoT.ListViolationEvents
  ( -- * Creating a Request
    ListViolationEvents (..),
    newListViolationEvents,

    -- * Request Lenses
    listViolationEvents_behaviorCriteriaType,
    listViolationEvents_listSuppressedAlerts,
    listViolationEvents_maxResults,
    listViolationEvents_nextToken,
    listViolationEvents_securityProfileName,
    listViolationEvents_thingName,
    listViolationEvents_verificationState,
    listViolationEvents_startTime,
    listViolationEvents_endTime,

    -- * Destructuring the Response
    ListViolationEventsResponse (..),
    newListViolationEventsResponse,

    -- * Response Lenses
    listViolationEventsResponse_nextToken,
    listViolationEventsResponse_violationEvents,
    listViolationEventsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListViolationEvents' smart constructor.
data ListViolationEvents = ListViolationEvents'
  { -- | The criteria for a behavior.
    ListViolationEvents -> Maybe BehaviorCriteriaType
behaviorCriteriaType :: Prelude.Maybe BehaviorCriteriaType,
    -- | A list of all suppressed alerts.
    ListViolationEvents -> Maybe Bool
listSuppressedAlerts :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of results to return at one time.
    ListViolationEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of results.
    ListViolationEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A filter to limit results to those alerts generated by the specified
    -- security profile.
    ListViolationEvents -> Maybe Text
securityProfileName :: Prelude.Maybe Prelude.Text,
    -- | A filter to limit results to those alerts caused by the specified thing.
    ListViolationEvents -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text,
    -- | The verification state of the violation (detect alarm).
    ListViolationEvents -> Maybe VerificationState
verificationState :: Prelude.Maybe VerificationState,
    -- | The start time for the alerts to be listed.
    ListViolationEvents -> POSIX
startTime :: Data.POSIX,
    -- | The end time for the alerts to be listed.
    ListViolationEvents -> POSIX
endTime :: Data.POSIX
  }
  deriving (ListViolationEvents -> ListViolationEvents -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListViolationEvents -> ListViolationEvents -> Bool
$c/= :: ListViolationEvents -> ListViolationEvents -> Bool
== :: ListViolationEvents -> ListViolationEvents -> Bool
$c== :: ListViolationEvents -> ListViolationEvents -> Bool
Prelude.Eq, ReadPrec [ListViolationEvents]
ReadPrec ListViolationEvents
Int -> ReadS ListViolationEvents
ReadS [ListViolationEvents]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListViolationEvents]
$creadListPrec :: ReadPrec [ListViolationEvents]
readPrec :: ReadPrec ListViolationEvents
$creadPrec :: ReadPrec ListViolationEvents
readList :: ReadS [ListViolationEvents]
$creadList :: ReadS [ListViolationEvents]
readsPrec :: Int -> ReadS ListViolationEvents
$creadsPrec :: Int -> ReadS ListViolationEvents
Prelude.Read, Int -> ListViolationEvents -> ShowS
[ListViolationEvents] -> ShowS
ListViolationEvents -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListViolationEvents] -> ShowS
$cshowList :: [ListViolationEvents] -> ShowS
show :: ListViolationEvents -> String
$cshow :: ListViolationEvents -> String
showsPrec :: Int -> ListViolationEvents -> ShowS
$cshowsPrec :: Int -> ListViolationEvents -> ShowS
Prelude.Show, forall x. Rep ListViolationEvents x -> ListViolationEvents
forall x. ListViolationEvents -> Rep ListViolationEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListViolationEvents x -> ListViolationEvents
$cfrom :: forall x. ListViolationEvents -> Rep ListViolationEvents x
Prelude.Generic)

-- |
-- Create a value of 'ListViolationEvents' 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:
--
-- 'behaviorCriteriaType', 'listViolationEvents_behaviorCriteriaType' - The criteria for a behavior.
--
-- 'listSuppressedAlerts', 'listViolationEvents_listSuppressedAlerts' - A list of all suppressed alerts.
--
-- 'maxResults', 'listViolationEvents_maxResults' - The maximum number of results to return at one time.
--
-- 'nextToken', 'listViolationEvents_nextToken' - The token for the next set of results.
--
-- 'securityProfileName', 'listViolationEvents_securityProfileName' - A filter to limit results to those alerts generated by the specified
-- security profile.
--
-- 'thingName', 'listViolationEvents_thingName' - A filter to limit results to those alerts caused by the specified thing.
--
-- 'verificationState', 'listViolationEvents_verificationState' - The verification state of the violation (detect alarm).
--
-- 'startTime', 'listViolationEvents_startTime' - The start time for the alerts to be listed.
--
-- 'endTime', 'listViolationEvents_endTime' - The end time for the alerts to be listed.
newListViolationEvents ::
  -- | 'startTime'
  Prelude.UTCTime ->
  -- | 'endTime'
  Prelude.UTCTime ->
  ListViolationEvents
newListViolationEvents :: UTCTime -> UTCTime -> ListViolationEvents
newListViolationEvents UTCTime
pStartTime_ UTCTime
pEndTime_ =
  ListViolationEvents'
    { $sel:behaviorCriteriaType:ListViolationEvents' :: Maybe BehaviorCriteriaType
behaviorCriteriaType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:listSuppressedAlerts:ListViolationEvents' :: Maybe Bool
listSuppressedAlerts = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListViolationEvents' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListViolationEvents' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:securityProfileName:ListViolationEvents' :: Maybe Text
securityProfileName = forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:ListViolationEvents' :: Maybe Text
thingName = forall a. Maybe a
Prelude.Nothing,
      $sel:verificationState:ListViolationEvents' :: Maybe VerificationState
verificationState = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:ListViolationEvents' :: POSIX
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
      $sel:endTime:ListViolationEvents' :: POSIX
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_
    }

-- | The criteria for a behavior.
listViolationEvents_behaviorCriteriaType :: Lens.Lens' ListViolationEvents (Prelude.Maybe BehaviorCriteriaType)
listViolationEvents_behaviorCriteriaType :: Lens' ListViolationEvents (Maybe BehaviorCriteriaType)
listViolationEvents_behaviorCriteriaType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe BehaviorCriteriaType
behaviorCriteriaType :: Maybe BehaviorCriteriaType
$sel:behaviorCriteriaType:ListViolationEvents' :: ListViolationEvents -> Maybe BehaviorCriteriaType
behaviorCriteriaType} -> Maybe BehaviorCriteriaType
behaviorCriteriaType) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe BehaviorCriteriaType
a -> ListViolationEvents
s {$sel:behaviorCriteriaType:ListViolationEvents' :: Maybe BehaviorCriteriaType
behaviorCriteriaType = Maybe BehaviorCriteriaType
a} :: ListViolationEvents)

-- | A list of all suppressed alerts.
listViolationEvents_listSuppressedAlerts :: Lens.Lens' ListViolationEvents (Prelude.Maybe Prelude.Bool)
listViolationEvents_listSuppressedAlerts :: Lens' ListViolationEvents (Maybe Bool)
listViolationEvents_listSuppressedAlerts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe Bool
listSuppressedAlerts :: Maybe Bool
$sel:listSuppressedAlerts:ListViolationEvents' :: ListViolationEvents -> Maybe Bool
listSuppressedAlerts} -> Maybe Bool
listSuppressedAlerts) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe Bool
a -> ListViolationEvents
s {$sel:listSuppressedAlerts:ListViolationEvents' :: Maybe Bool
listSuppressedAlerts = Maybe Bool
a} :: ListViolationEvents)

-- | The maximum number of results to return at one time.
listViolationEvents_maxResults :: Lens.Lens' ListViolationEvents (Prelude.Maybe Prelude.Natural)
listViolationEvents_maxResults :: Lens' ListViolationEvents (Maybe Natural)
listViolationEvents_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListViolationEvents' :: ListViolationEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe Natural
a -> ListViolationEvents
s {$sel:maxResults:ListViolationEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListViolationEvents)

-- | The token for the next set of results.
listViolationEvents_nextToken :: Lens.Lens' ListViolationEvents (Prelude.Maybe Prelude.Text)
listViolationEvents_nextToken :: Lens' ListViolationEvents (Maybe Text)
listViolationEvents_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListViolationEvents' :: ListViolationEvents -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe Text
a -> ListViolationEvents
s {$sel:nextToken:ListViolationEvents' :: Maybe Text
nextToken = Maybe Text
a} :: ListViolationEvents)

-- | A filter to limit results to those alerts generated by the specified
-- security profile.
listViolationEvents_securityProfileName :: Lens.Lens' ListViolationEvents (Prelude.Maybe Prelude.Text)
listViolationEvents_securityProfileName :: Lens' ListViolationEvents (Maybe Text)
listViolationEvents_securityProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe Text
securityProfileName :: Maybe Text
$sel:securityProfileName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
securityProfileName} -> Maybe Text
securityProfileName) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe Text
a -> ListViolationEvents
s {$sel:securityProfileName:ListViolationEvents' :: Maybe Text
securityProfileName = Maybe Text
a} :: ListViolationEvents)

-- | A filter to limit results to those alerts caused by the specified thing.
listViolationEvents_thingName :: Lens.Lens' ListViolationEvents (Prelude.Maybe Prelude.Text)
listViolationEvents_thingName :: Lens' ListViolationEvents (Maybe Text)
listViolationEvents_thingName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe Text
thingName :: Maybe Text
$sel:thingName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe Text
a -> ListViolationEvents
s {$sel:thingName:ListViolationEvents' :: Maybe Text
thingName = Maybe Text
a} :: ListViolationEvents)

-- | The verification state of the violation (detect alarm).
listViolationEvents_verificationState :: Lens.Lens' ListViolationEvents (Prelude.Maybe VerificationState)
listViolationEvents_verificationState :: Lens' ListViolationEvents (Maybe VerificationState)
listViolationEvents_verificationState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {Maybe VerificationState
verificationState :: Maybe VerificationState
$sel:verificationState:ListViolationEvents' :: ListViolationEvents -> Maybe VerificationState
verificationState} -> Maybe VerificationState
verificationState) (\s :: ListViolationEvents
s@ListViolationEvents' {} Maybe VerificationState
a -> ListViolationEvents
s {$sel:verificationState:ListViolationEvents' :: Maybe VerificationState
verificationState = Maybe VerificationState
a} :: ListViolationEvents)

-- | The start time for the alerts to be listed.
listViolationEvents_startTime :: Lens.Lens' ListViolationEvents Prelude.UTCTime
listViolationEvents_startTime :: Lens' ListViolationEvents UTCTime
listViolationEvents_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {POSIX
startTime :: POSIX
$sel:startTime:ListViolationEvents' :: ListViolationEvents -> POSIX
startTime} -> POSIX
startTime) (\s :: ListViolationEvents
s@ListViolationEvents' {} POSIX
a -> ListViolationEvents
s {$sel:startTime:ListViolationEvents' :: POSIX
startTime = POSIX
a} :: ListViolationEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The end time for the alerts to be listed.
listViolationEvents_endTime :: Lens.Lens' ListViolationEvents Prelude.UTCTime
listViolationEvents_endTime :: Lens' ListViolationEvents UTCTime
listViolationEvents_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEvents' {POSIX
endTime :: POSIX
$sel:endTime:ListViolationEvents' :: ListViolationEvents -> POSIX
endTime} -> POSIX
endTime) (\s :: ListViolationEvents
s@ListViolationEvents' {} POSIX
a -> ListViolationEvents
s {$sel:endTime:ListViolationEvents' :: POSIX
endTime = POSIX
a} :: ListViolationEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Core.AWSPager ListViolationEvents where
  page :: ListViolationEvents
-> AWSResponse ListViolationEvents -> Maybe ListViolationEvents
page ListViolationEvents
rq AWSResponse ListViolationEvents
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListViolationEvents
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListViolationEventsResponse (Maybe Text)
listViolationEventsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListViolationEvents
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListViolationEventsResponse (Maybe [ViolationEvent])
listViolationEventsResponse_violationEvents
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListViolationEvents
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListViolationEvents (Maybe Text)
listViolationEvents_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListViolationEvents
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListViolationEventsResponse (Maybe Text)
listViolationEventsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListViolationEvents where
  type
    AWSResponse ListViolationEvents =
      ListViolationEventsResponse
  request :: (Service -> Service)
-> ListViolationEvents -> Request ListViolationEvents
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListViolationEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListViolationEvents)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ViolationEvent] -> Int -> ListViolationEventsResponse
ListViolationEventsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"violationEvents"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListViolationEvents where
  hashWithSalt :: Int -> ListViolationEvents -> Int
hashWithSalt Int
_salt ListViolationEvents' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BehaviorCriteriaType
Maybe VerificationState
POSIX
endTime :: POSIX
startTime :: POSIX
verificationState :: Maybe VerificationState
thingName :: Maybe Text
securityProfileName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedAlerts :: Maybe Bool
behaviorCriteriaType :: Maybe BehaviorCriteriaType
$sel:endTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:startTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:verificationState:ListViolationEvents' :: ListViolationEvents -> Maybe VerificationState
$sel:thingName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:securityProfileName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:nextToken:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:maxResults:ListViolationEvents' :: ListViolationEvents -> Maybe Natural
$sel:listSuppressedAlerts:ListViolationEvents' :: ListViolationEvents -> Maybe Bool
$sel:behaviorCriteriaType:ListViolationEvents' :: ListViolationEvents -> Maybe BehaviorCriteriaType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe BehaviorCriteriaType
behaviorCriteriaType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
listSuppressedAlerts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
securityProfileName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
thingName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VerificationState
verificationState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
endTime

instance Prelude.NFData ListViolationEvents where
  rnf :: ListViolationEvents -> ()
rnf ListViolationEvents' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BehaviorCriteriaType
Maybe VerificationState
POSIX
endTime :: POSIX
startTime :: POSIX
verificationState :: Maybe VerificationState
thingName :: Maybe Text
securityProfileName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedAlerts :: Maybe Bool
behaviorCriteriaType :: Maybe BehaviorCriteriaType
$sel:endTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:startTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:verificationState:ListViolationEvents' :: ListViolationEvents -> Maybe VerificationState
$sel:thingName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:securityProfileName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:nextToken:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:maxResults:ListViolationEvents' :: ListViolationEvents -> Maybe Natural
$sel:listSuppressedAlerts:ListViolationEvents' :: ListViolationEvents -> Maybe Bool
$sel:behaviorCriteriaType:ListViolationEvents' :: ListViolationEvents -> Maybe BehaviorCriteriaType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe BehaviorCriteriaType
behaviorCriteriaType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
listSuppressedAlerts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
securityProfileName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
thingName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VerificationState
verificationState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
endTime

instance Data.ToHeaders ListViolationEvents where
  toHeaders :: ListViolationEvents -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListViolationEvents where
  toPath :: ListViolationEvents -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/violation-events"

instance Data.ToQuery ListViolationEvents where
  toQuery :: ListViolationEvents -> QueryString
toQuery ListViolationEvents' {Maybe Bool
Maybe Natural
Maybe Text
Maybe BehaviorCriteriaType
Maybe VerificationState
POSIX
endTime :: POSIX
startTime :: POSIX
verificationState :: Maybe VerificationState
thingName :: Maybe Text
securityProfileName :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
listSuppressedAlerts :: Maybe Bool
behaviorCriteriaType :: Maybe BehaviorCriteriaType
$sel:endTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:startTime:ListViolationEvents' :: ListViolationEvents -> POSIX
$sel:verificationState:ListViolationEvents' :: ListViolationEvents -> Maybe VerificationState
$sel:thingName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:securityProfileName:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:nextToken:ListViolationEvents' :: ListViolationEvents -> Maybe Text
$sel:maxResults:ListViolationEvents' :: ListViolationEvents -> Maybe Natural
$sel:listSuppressedAlerts:ListViolationEvents' :: ListViolationEvents -> Maybe Bool
$sel:behaviorCriteriaType:ListViolationEvents' :: ListViolationEvents -> Maybe BehaviorCriteriaType
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"behaviorCriteriaType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe BehaviorCriteriaType
behaviorCriteriaType,
        ByteString
"listSuppressedAlerts" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
listSuppressedAlerts,
        ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"securityProfileName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
securityProfileName,
        ByteString
"thingName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
thingName,
        ByteString
"verificationState" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe VerificationState
verificationState,
        ByteString
"startTime" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: POSIX
startTime,
        ByteString
"endTime" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: POSIX
endTime
      ]

-- | /See:/ 'newListViolationEventsResponse' smart constructor.
data ListViolationEventsResponse = ListViolationEventsResponse'
  { -- | A token that can be used to retrieve the next set of results, or @null@
    -- if there are no additional results.
    ListViolationEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The security profile violation alerts issued for this account during the
    -- given time period, potentially filtered by security profile, behavior
    -- violated, or thing (device) violating.
    ListViolationEventsResponse -> Maybe [ViolationEvent]
violationEvents :: Prelude.Maybe [ViolationEvent],
    -- | The response's http status code.
    ListViolationEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListViolationEventsResponse -> ListViolationEventsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListViolationEventsResponse -> ListViolationEventsResponse -> Bool
$c/= :: ListViolationEventsResponse -> ListViolationEventsResponse -> Bool
== :: ListViolationEventsResponse -> ListViolationEventsResponse -> Bool
$c== :: ListViolationEventsResponse -> ListViolationEventsResponse -> Bool
Prelude.Eq, ReadPrec [ListViolationEventsResponse]
ReadPrec ListViolationEventsResponse
Int -> ReadS ListViolationEventsResponse
ReadS [ListViolationEventsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListViolationEventsResponse]
$creadListPrec :: ReadPrec [ListViolationEventsResponse]
readPrec :: ReadPrec ListViolationEventsResponse
$creadPrec :: ReadPrec ListViolationEventsResponse
readList :: ReadS [ListViolationEventsResponse]
$creadList :: ReadS [ListViolationEventsResponse]
readsPrec :: Int -> ReadS ListViolationEventsResponse
$creadsPrec :: Int -> ReadS ListViolationEventsResponse
Prelude.Read, Int -> ListViolationEventsResponse -> ShowS
[ListViolationEventsResponse] -> ShowS
ListViolationEventsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListViolationEventsResponse] -> ShowS
$cshowList :: [ListViolationEventsResponse] -> ShowS
show :: ListViolationEventsResponse -> String
$cshow :: ListViolationEventsResponse -> String
showsPrec :: Int -> ListViolationEventsResponse -> ShowS
$cshowsPrec :: Int -> ListViolationEventsResponse -> ShowS
Prelude.Show, forall x.
Rep ListViolationEventsResponse x -> ListViolationEventsResponse
forall x.
ListViolationEventsResponse -> Rep ListViolationEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListViolationEventsResponse x -> ListViolationEventsResponse
$cfrom :: forall x.
ListViolationEventsResponse -> Rep ListViolationEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListViolationEventsResponse' 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:
--
-- 'nextToken', 'listViolationEventsResponse_nextToken' - A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
--
-- 'violationEvents', 'listViolationEventsResponse_violationEvents' - The security profile violation alerts issued for this account during the
-- given time period, potentially filtered by security profile, behavior
-- violated, or thing (device) violating.
--
-- 'httpStatus', 'listViolationEventsResponse_httpStatus' - The response's http status code.
newListViolationEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListViolationEventsResponse
newListViolationEventsResponse :: Int -> ListViolationEventsResponse
newListViolationEventsResponse Int
pHttpStatus_ =
  ListViolationEventsResponse'
    { $sel:nextToken:ListViolationEventsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:violationEvents:ListViolationEventsResponse' :: Maybe [ViolationEvent]
violationEvents = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListViolationEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A token that can be used to retrieve the next set of results, or @null@
-- if there are no additional results.
listViolationEventsResponse_nextToken :: Lens.Lens' ListViolationEventsResponse (Prelude.Maybe Prelude.Text)
listViolationEventsResponse_nextToken :: Lens' ListViolationEventsResponse (Maybe Text)
listViolationEventsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListViolationEventsResponse' :: ListViolationEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListViolationEventsResponse
s@ListViolationEventsResponse' {} Maybe Text
a -> ListViolationEventsResponse
s {$sel:nextToken:ListViolationEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListViolationEventsResponse)

-- | The security profile violation alerts issued for this account during the
-- given time period, potentially filtered by security profile, behavior
-- violated, or thing (device) violating.
listViolationEventsResponse_violationEvents :: Lens.Lens' ListViolationEventsResponse (Prelude.Maybe [ViolationEvent])
listViolationEventsResponse_violationEvents :: Lens' ListViolationEventsResponse (Maybe [ViolationEvent])
listViolationEventsResponse_violationEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEventsResponse' {Maybe [ViolationEvent]
violationEvents :: Maybe [ViolationEvent]
$sel:violationEvents:ListViolationEventsResponse' :: ListViolationEventsResponse -> Maybe [ViolationEvent]
violationEvents} -> Maybe [ViolationEvent]
violationEvents) (\s :: ListViolationEventsResponse
s@ListViolationEventsResponse' {} Maybe [ViolationEvent]
a -> ListViolationEventsResponse
s {$sel:violationEvents:ListViolationEventsResponse' :: Maybe [ViolationEvent]
violationEvents = Maybe [ViolationEvent]
a} :: ListViolationEventsResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listViolationEventsResponse_httpStatus :: Lens.Lens' ListViolationEventsResponse Prelude.Int
listViolationEventsResponse_httpStatus :: Lens' ListViolationEventsResponse Int
listViolationEventsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListViolationEventsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListViolationEventsResponse' :: ListViolationEventsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListViolationEventsResponse
s@ListViolationEventsResponse' {} Int
a -> ListViolationEventsResponse
s {$sel:httpStatus:ListViolationEventsResponse' :: Int
httpStatus = Int
a} :: ListViolationEventsResponse)

instance Prelude.NFData ListViolationEventsResponse where
  rnf :: ListViolationEventsResponse -> ()
rnf ListViolationEventsResponse' {Int
Maybe [ViolationEvent]
Maybe Text
httpStatus :: Int
violationEvents :: Maybe [ViolationEvent]
nextToken :: Maybe Text
$sel:httpStatus:ListViolationEventsResponse' :: ListViolationEventsResponse -> Int
$sel:violationEvents:ListViolationEventsResponse' :: ListViolationEventsResponse -> Maybe [ViolationEvent]
$sel:nextToken:ListViolationEventsResponse' :: ListViolationEventsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ViolationEvent]
violationEvents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus