{-# 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.IoT1ClickDevices.ListDeviceEvents
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Using a device ID, returns a DeviceEventsResponse object containing an
-- array of events for the device.
--
-- This operation returns paginated results.
module Amazonka.IoT1ClickDevices.ListDeviceEvents
  ( -- * Creating a Request
    ListDeviceEvents (..),
    newListDeviceEvents,

    -- * Request Lenses
    listDeviceEvents_maxResults,
    listDeviceEvents_nextToken,
    listDeviceEvents_deviceId,
    listDeviceEvents_fromTimeStamp,
    listDeviceEvents_toTimeStamp,

    -- * Destructuring the Response
    ListDeviceEventsResponse (..),
    newListDeviceEventsResponse,

    -- * Response Lenses
    listDeviceEventsResponse_events,
    listDeviceEventsResponse_nextToken,
    listDeviceEventsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListDeviceEvents' smart constructor.
data ListDeviceEvents = ListDeviceEvents'
  { -- | The maximum number of results to return per request. If not set, a
    -- default value of 100 is used.
    ListDeviceEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to retrieve the next set of results.
    ListDeviceEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the device.
    ListDeviceEvents -> Text
deviceId :: Prelude.Text,
    -- | The start date for the device event query, in ISO8061 format. For
    -- example, 2018-03-28T15:45:12.880Z
    ListDeviceEvents -> ISO8601
fromTimeStamp :: Data.ISO8601,
    -- | The end date for the device event query, in ISO8061 format. For example,
    -- 2018-03-28T15:45:12.880Z
    ListDeviceEvents -> ISO8601
toTimeStamp :: Data.ISO8601
  }
  deriving (ListDeviceEvents -> ListDeviceEvents -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceEvents -> ListDeviceEvents -> Bool
$c/= :: ListDeviceEvents -> ListDeviceEvents -> Bool
== :: ListDeviceEvents -> ListDeviceEvents -> Bool
$c== :: ListDeviceEvents -> ListDeviceEvents -> Bool
Prelude.Eq, ReadPrec [ListDeviceEvents]
ReadPrec ListDeviceEvents
Int -> ReadS ListDeviceEvents
ReadS [ListDeviceEvents]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceEvents]
$creadListPrec :: ReadPrec [ListDeviceEvents]
readPrec :: ReadPrec ListDeviceEvents
$creadPrec :: ReadPrec ListDeviceEvents
readList :: ReadS [ListDeviceEvents]
$creadList :: ReadS [ListDeviceEvents]
readsPrec :: Int -> ReadS ListDeviceEvents
$creadsPrec :: Int -> ReadS ListDeviceEvents
Prelude.Read, Int -> ListDeviceEvents -> ShowS
[ListDeviceEvents] -> ShowS
ListDeviceEvents -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceEvents] -> ShowS
$cshowList :: [ListDeviceEvents] -> ShowS
show :: ListDeviceEvents -> String
$cshow :: ListDeviceEvents -> String
showsPrec :: Int -> ListDeviceEvents -> ShowS
$cshowsPrec :: Int -> ListDeviceEvents -> ShowS
Prelude.Show, forall x. Rep ListDeviceEvents x -> ListDeviceEvents
forall x. ListDeviceEvents -> Rep ListDeviceEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDeviceEvents x -> ListDeviceEvents
$cfrom :: forall x. ListDeviceEvents -> Rep ListDeviceEvents x
Prelude.Generic)

-- |
-- Create a value of 'ListDeviceEvents' 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:
--
-- 'maxResults', 'listDeviceEvents_maxResults' - The maximum number of results to return per request. If not set, a
-- default value of 100 is used.
--
-- 'nextToken', 'listDeviceEvents_nextToken' - The token to retrieve the next set of results.
--
-- 'deviceId', 'listDeviceEvents_deviceId' - The unique identifier of the device.
--
-- 'fromTimeStamp', 'listDeviceEvents_fromTimeStamp' - The start date for the device event query, in ISO8061 format. For
-- example, 2018-03-28T15:45:12.880Z
--
-- 'toTimeStamp', 'listDeviceEvents_toTimeStamp' - The end date for the device event query, in ISO8061 format. For example,
-- 2018-03-28T15:45:12.880Z
newListDeviceEvents ::
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'fromTimeStamp'
  Prelude.UTCTime ->
  -- | 'toTimeStamp'
  Prelude.UTCTime ->
  ListDeviceEvents
newListDeviceEvents :: Text -> UTCTime -> UTCTime -> ListDeviceEvents
newListDeviceEvents
  Text
pDeviceId_
  UTCTime
pFromTimeStamp_
  UTCTime
pToTimeStamp_ =
    ListDeviceEvents'
      { $sel:maxResults:ListDeviceEvents' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListDeviceEvents' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:deviceId:ListDeviceEvents' :: Text
deviceId = Text
pDeviceId_,
        $sel:fromTimeStamp:ListDeviceEvents' :: ISO8601
fromTimeStamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pFromTimeStamp_,
        $sel:toTimeStamp:ListDeviceEvents' :: ISO8601
toTimeStamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pToTimeStamp_
      }

-- | The maximum number of results to return per request. If not set, a
-- default value of 100 is used.
listDeviceEvents_maxResults :: Lens.Lens' ListDeviceEvents (Prelude.Maybe Prelude.Natural)
listDeviceEvents_maxResults :: Lens' ListDeviceEvents (Maybe Natural)
listDeviceEvents_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} Maybe Natural
a -> ListDeviceEvents
s {$sel:maxResults:ListDeviceEvents' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDeviceEvents)

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

-- | The unique identifier of the device.
listDeviceEvents_deviceId :: Lens.Lens' ListDeviceEvents Prelude.Text
listDeviceEvents_deviceId :: Lens' ListDeviceEvents Text
listDeviceEvents_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {Text
deviceId :: Text
$sel:deviceId:ListDeviceEvents' :: ListDeviceEvents -> Text
deviceId} -> Text
deviceId) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} Text
a -> ListDeviceEvents
s {$sel:deviceId:ListDeviceEvents' :: Text
deviceId = Text
a} :: ListDeviceEvents)

-- | The start date for the device event query, in ISO8061 format. For
-- example, 2018-03-28T15:45:12.880Z
listDeviceEvents_fromTimeStamp :: Lens.Lens' ListDeviceEvents Prelude.UTCTime
listDeviceEvents_fromTimeStamp :: Lens' ListDeviceEvents UTCTime
listDeviceEvents_fromTimeStamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {ISO8601
fromTimeStamp :: ISO8601
$sel:fromTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
fromTimeStamp} -> ISO8601
fromTimeStamp) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} ISO8601
a -> ListDeviceEvents
s {$sel:fromTimeStamp:ListDeviceEvents' :: ISO8601
fromTimeStamp = ISO8601
a} :: ListDeviceEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The end date for the device event query, in ISO8061 format. For example,
-- 2018-03-28T15:45:12.880Z
listDeviceEvents_toTimeStamp :: Lens.Lens' ListDeviceEvents Prelude.UTCTime
listDeviceEvents_toTimeStamp :: Lens' ListDeviceEvents UTCTime
listDeviceEvents_toTimeStamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {ISO8601
toTimeStamp :: ISO8601
$sel:toTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
toTimeStamp} -> ISO8601
toTimeStamp) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} ISO8601
a -> ListDeviceEvents
s {$sel:toTimeStamp:ListDeviceEvents' :: ISO8601
toTimeStamp = ISO8601
a} :: ListDeviceEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Core.AWSPager ListDeviceEvents where
  page :: ListDeviceEvents
-> AWSResponse ListDeviceEvents -> Maybe ListDeviceEvents
page ListDeviceEvents
rq AWSResponse ListDeviceEvents
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDeviceEvents
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceEventsResponse (Maybe Text)
listDeviceEventsResponse_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 ListDeviceEvents
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceEventsResponse (Maybe [DeviceEvent])
listDeviceEventsResponse_events
            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.$ ListDeviceEvents
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDeviceEvents (Maybe Text)
listDeviceEvents_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDeviceEvents
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDeviceEventsResponse (Maybe Text)
listDeviceEventsResponse_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 ListDeviceEvents where
  type
    AWSResponse ListDeviceEvents =
      ListDeviceEventsResponse
  request :: (Service -> Service)
-> ListDeviceEvents -> Request ListDeviceEvents
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 ListDeviceEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDeviceEvents)))
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 [DeviceEvent]
-> Maybe Text -> Int -> ListDeviceEventsResponse
ListDeviceEventsResponse'
            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
"events" 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.<*> (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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListDeviceEvents where
  hashWithSalt :: Int -> ListDeviceEvents -> Int
hashWithSalt Int
_salt ListDeviceEvents' {Maybe Natural
Maybe Text
Text
ISO8601
toTimeStamp :: ISO8601
fromTimeStamp :: ISO8601
deviceId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:toTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:fromTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:deviceId:ListDeviceEvents' :: ListDeviceEvents -> Text
$sel:nextToken:ListDeviceEvents' :: ListDeviceEvents -> Maybe Text
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
..} =
    Int
_salt
      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` Text
deviceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
fromTimeStamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
toTimeStamp

instance Prelude.NFData ListDeviceEvents where
  rnf :: ListDeviceEvents -> ()
rnf ListDeviceEvents' {Maybe Natural
Maybe Text
Text
ISO8601
toTimeStamp :: ISO8601
fromTimeStamp :: ISO8601
deviceId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:toTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:fromTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:deviceId:ListDeviceEvents' :: ListDeviceEvents -> Text
$sel:nextToken:ListDeviceEvents' :: ListDeviceEvents -> Maybe Text
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
..} =
    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 Text
deviceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
fromTimeStamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
toTimeStamp

instance Data.ToHeaders ListDeviceEvents where
  toHeaders :: ListDeviceEvents -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath ListDeviceEvents where
  toPath :: ListDeviceEvents -> ByteString
toPath ListDeviceEvents' {Maybe Natural
Maybe Text
Text
ISO8601
toTimeStamp :: ISO8601
fromTimeStamp :: ISO8601
deviceId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:toTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:fromTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:deviceId:ListDeviceEvents' :: ListDeviceEvents -> Text
$sel:nextToken:ListDeviceEvents' :: ListDeviceEvents -> Maybe Text
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/devices/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
deviceId, ByteString
"/events"]

instance Data.ToQuery ListDeviceEvents where
  toQuery :: ListDeviceEvents -> QueryString
toQuery ListDeviceEvents' {Maybe Natural
Maybe Text
Text
ISO8601
toTimeStamp :: ISO8601
fromTimeStamp :: ISO8601
deviceId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:toTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:fromTimeStamp:ListDeviceEvents' :: ListDeviceEvents -> ISO8601
$sel:deviceId:ListDeviceEvents' :: ListDeviceEvents -> Text
$sel:nextToken:ListDeviceEvents' :: ListDeviceEvents -> Maybe Text
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ 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
"fromTimeStamp" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ISO8601
fromTimeStamp,
        ByteString
"toTimeStamp" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ISO8601
toTimeStamp
      ]

-- | /See:/ 'newListDeviceEventsResponse' smart constructor.
data ListDeviceEventsResponse = ListDeviceEventsResponse'
  { -- | An array of zero or more elements describing the event(s) associated
    -- with the device.
    ListDeviceEventsResponse -> Maybe [DeviceEvent]
events :: Prelude.Maybe [DeviceEvent],
    -- | The token to retrieve the next set of results.
    ListDeviceEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDeviceEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
$c/= :: ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
== :: ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
$c== :: ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
Prelude.Eq, ReadPrec [ListDeviceEventsResponse]
ReadPrec ListDeviceEventsResponse
Int -> ReadS ListDeviceEventsResponse
ReadS [ListDeviceEventsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeviceEventsResponse]
$creadListPrec :: ReadPrec [ListDeviceEventsResponse]
readPrec :: ReadPrec ListDeviceEventsResponse
$creadPrec :: ReadPrec ListDeviceEventsResponse
readList :: ReadS [ListDeviceEventsResponse]
$creadList :: ReadS [ListDeviceEventsResponse]
readsPrec :: Int -> ReadS ListDeviceEventsResponse
$creadsPrec :: Int -> ReadS ListDeviceEventsResponse
Prelude.Read, Int -> ListDeviceEventsResponse -> ShowS
[ListDeviceEventsResponse] -> ShowS
ListDeviceEventsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeviceEventsResponse] -> ShowS
$cshowList :: [ListDeviceEventsResponse] -> ShowS
show :: ListDeviceEventsResponse -> String
$cshow :: ListDeviceEventsResponse -> String
showsPrec :: Int -> ListDeviceEventsResponse -> ShowS
$cshowsPrec :: Int -> ListDeviceEventsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDeviceEventsResponse x -> ListDeviceEventsResponse
forall x.
ListDeviceEventsResponse -> Rep ListDeviceEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeviceEventsResponse x -> ListDeviceEventsResponse
$cfrom :: forall x.
ListDeviceEventsResponse -> Rep ListDeviceEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDeviceEventsResponse' 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:
--
-- 'events', 'listDeviceEventsResponse_events' - An array of zero or more elements describing the event(s) associated
-- with the device.
--
-- 'nextToken', 'listDeviceEventsResponse_nextToken' - The token to retrieve the next set of results.
--
-- 'httpStatus', 'listDeviceEventsResponse_httpStatus' - The response's http status code.
newListDeviceEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDeviceEventsResponse
newListDeviceEventsResponse :: Int -> ListDeviceEventsResponse
newListDeviceEventsResponse Int
pHttpStatus_ =
  ListDeviceEventsResponse'
    { $sel:events:ListDeviceEventsResponse' :: Maybe [DeviceEvent]
events = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDeviceEventsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDeviceEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of zero or more elements describing the event(s) associated
-- with the device.
listDeviceEventsResponse_events :: Lens.Lens' ListDeviceEventsResponse (Prelude.Maybe [DeviceEvent])
listDeviceEventsResponse_events :: Lens' ListDeviceEventsResponse (Maybe [DeviceEvent])
listDeviceEventsResponse_events = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEventsResponse' {Maybe [DeviceEvent]
events :: Maybe [DeviceEvent]
$sel:events:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Maybe [DeviceEvent]
events} -> Maybe [DeviceEvent]
events) (\s :: ListDeviceEventsResponse
s@ListDeviceEventsResponse' {} Maybe [DeviceEvent]
a -> ListDeviceEventsResponse
s {$sel:events:ListDeviceEventsResponse' :: Maybe [DeviceEvent]
events = Maybe [DeviceEvent]
a} :: ListDeviceEventsResponse) 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 token to retrieve the next set of results.
listDeviceEventsResponse_nextToken :: Lens.Lens' ListDeviceEventsResponse (Prelude.Maybe Prelude.Text)
listDeviceEventsResponse_nextToken :: Lens' ListDeviceEventsResponse (Maybe Text)
listDeviceEventsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeviceEventsResponse
s@ListDeviceEventsResponse' {} Maybe Text
a -> ListDeviceEventsResponse
s {$sel:nextToken:ListDeviceEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeviceEventsResponse)

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

instance Prelude.NFData ListDeviceEventsResponse where
  rnf :: ListDeviceEventsResponse -> ()
rnf ListDeviceEventsResponse' {Int
Maybe [DeviceEvent]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
events :: Maybe [DeviceEvent]
$sel:httpStatus:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Int
$sel:nextToken:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Maybe Text
$sel:events:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Maybe [DeviceEvent]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeviceEvent]
events
      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 Int
httpStatus