{-# 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.AlexaBusiness.ListDeviceEvents
-- 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)
--
-- Lists the device event history, including device connection status, for
-- up to 30 days.
--
-- This operation returns paginated results.
module Amazonka.AlexaBusiness.ListDeviceEvents
  ( -- * Creating a Request
    ListDeviceEvents (..),
    newListDeviceEvents,

    -- * Request Lenses
    listDeviceEvents_nextToken,
    listDeviceEvents_eventType,
    listDeviceEvents_maxResults,
    listDeviceEvents_deviceArn,

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

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

import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response only includes results beyond the token, up to the value
    -- specified by MaxResults. When the end of results is reached, the
    -- response has a value of null.
    ListDeviceEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The event type to filter device events. If EventType isn\'t specified,
    -- this returns a list of all device events in reverse chronological order.
    -- If EventType is specified, this returns a list of device events for that
    -- EventType in reverse chronological order.
    ListDeviceEvents -> Maybe DeviceEventType
eventType :: Prelude.Maybe DeviceEventType,
    -- | The maximum number of results to include in the response. The default
    -- value is 50. If more results exist than the specified MaxResults value,
    -- a token is included in the response so that the remaining results can be
    -- retrieved.
    ListDeviceEvents -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ARN of a device.
    ListDeviceEvents -> Text
deviceArn :: Prelude.Text
  }
  deriving (ListDeviceEvents -> ListDeviceEvents -> Bool
(ListDeviceEvents -> ListDeviceEvents -> Bool)
-> (ListDeviceEvents -> ListDeviceEvents -> Bool)
-> Eq ListDeviceEvents
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]
(Int -> ReadS ListDeviceEvents)
-> ReadS [ListDeviceEvents]
-> ReadPrec ListDeviceEvents
-> ReadPrec [ListDeviceEvents]
-> Read 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
(Int -> ListDeviceEvents -> ShowS)
-> (ListDeviceEvents -> String)
-> ([ListDeviceEvents] -> ShowS)
-> Show ListDeviceEvents
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. ListDeviceEvents -> Rep ListDeviceEvents x)
-> (forall x. Rep ListDeviceEvents x -> ListDeviceEvents)
-> Generic ListDeviceEvents
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:
--
-- 'nextToken', 'listDeviceEvents_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response only includes results beyond the token, up to the value
-- specified by MaxResults. When the end of results is reached, the
-- response has a value of null.
--
-- 'eventType', 'listDeviceEvents_eventType' - The event type to filter device events. If EventType isn\'t specified,
-- this returns a list of all device events in reverse chronological order.
-- If EventType is specified, this returns a list of device events for that
-- EventType in reverse chronological order.
--
-- 'maxResults', 'listDeviceEvents_maxResults' - The maximum number of results to include in the response. The default
-- value is 50. If more results exist than the specified MaxResults value,
-- a token is included in the response so that the remaining results can be
-- retrieved.
--
-- 'deviceArn', 'listDeviceEvents_deviceArn' - The ARN of a device.
newListDeviceEvents ::
  -- | 'deviceArn'
  Prelude.Text ->
  ListDeviceEvents
newListDeviceEvents :: Text -> ListDeviceEvents
newListDeviceEvents Text
pDeviceArn_ =
  ListDeviceEvents' :: Maybe Text
-> Maybe DeviceEventType
-> Maybe Natural
-> Text
-> ListDeviceEvents
ListDeviceEvents'
    { $sel:nextToken:ListDeviceEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventType:ListDeviceEvents' :: Maybe DeviceEventType
eventType = Maybe DeviceEventType
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListDeviceEvents' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceArn:ListDeviceEvents' :: Text
deviceArn = Text
pDeviceArn_
    }

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response only includes results beyond the token, up to the value
-- specified by MaxResults. When the end of results is reached, the
-- response has a value of null.
listDeviceEvents_nextToken :: Lens.Lens' ListDeviceEvents (Prelude.Maybe Prelude.Text)
listDeviceEvents_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDeviceEvents -> f ListDeviceEvents
listDeviceEvents_nextToken = (ListDeviceEvents -> Maybe Text)
-> (ListDeviceEvents -> Maybe Text -> ListDeviceEvents)
-> Lens ListDeviceEvents ListDeviceEvents (Maybe Text) (Maybe Text)
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 event type to filter device events. If EventType isn\'t specified,
-- this returns a list of all device events in reverse chronological order.
-- If EventType is specified, this returns a list of device events for that
-- EventType in reverse chronological order.
listDeviceEvents_eventType :: Lens.Lens' ListDeviceEvents (Prelude.Maybe DeviceEventType)
listDeviceEvents_eventType :: (Maybe DeviceEventType -> f (Maybe DeviceEventType))
-> ListDeviceEvents -> f ListDeviceEvents
listDeviceEvents_eventType = (ListDeviceEvents -> Maybe DeviceEventType)
-> (ListDeviceEvents -> Maybe DeviceEventType -> ListDeviceEvents)
-> Lens
     ListDeviceEvents
     ListDeviceEvents
     (Maybe DeviceEventType)
     (Maybe DeviceEventType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {Maybe DeviceEventType
eventType :: Maybe DeviceEventType
$sel:eventType:ListDeviceEvents' :: ListDeviceEvents -> Maybe DeviceEventType
eventType} -> Maybe DeviceEventType
eventType) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} Maybe DeviceEventType
a -> ListDeviceEvents
s {$sel:eventType:ListDeviceEvents' :: Maybe DeviceEventType
eventType = Maybe DeviceEventType
a} :: ListDeviceEvents)

-- | The maximum number of results to include in the response. The default
-- value is 50. If more results exist than the specified MaxResults value,
-- a token is included in the response so that the remaining results can be
-- retrieved.
listDeviceEvents_maxResults :: Lens.Lens' ListDeviceEvents (Prelude.Maybe Prelude.Natural)
listDeviceEvents_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListDeviceEvents -> f ListDeviceEvents
listDeviceEvents_maxResults = (ListDeviceEvents -> Maybe Natural)
-> (ListDeviceEvents -> Maybe Natural -> ListDeviceEvents)
-> Lens
     ListDeviceEvents ListDeviceEvents (Maybe Natural) (Maybe Natural)
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 ARN of a device.
listDeviceEvents_deviceArn :: Lens.Lens' ListDeviceEvents Prelude.Text
listDeviceEvents_deviceArn :: (Text -> f Text) -> ListDeviceEvents -> f ListDeviceEvents
listDeviceEvents_deviceArn = (ListDeviceEvents -> Text)
-> (ListDeviceEvents -> Text -> ListDeviceEvents)
-> Lens ListDeviceEvents ListDeviceEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEvents' {Text
deviceArn :: Text
$sel:deviceArn:ListDeviceEvents' :: ListDeviceEvents -> Text
deviceArn} -> Text
deviceArn) (\s :: ListDeviceEvents
s@ListDeviceEvents' {} Text
a -> ListDeviceEvents
s {$sel:deviceArn:ListDeviceEvents' :: Text
deviceArn = Text
a} :: ListDeviceEvents)

instance Core.AWSPager ListDeviceEvents where
  page :: ListDeviceEvents
-> AWSResponse ListDeviceEvents -> Maybe ListDeviceEvents
page ListDeviceEvents
rq AWSResponse ListDeviceEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDeviceEvents
ListDeviceEventsResponse
rs
            ListDeviceEventsResponse
-> Getting (First Text) ListDeviceEventsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDeviceEventsResponse
-> Const (First Text) ListDeviceEventsResponse
Lens' ListDeviceEventsResponse (Maybe Text)
listDeviceEventsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDeviceEventsResponse
 -> Const (First Text) ListDeviceEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDeviceEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDeviceEvents
forall a. Maybe a
Prelude.Nothing
    | Maybe [DeviceEvent] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListDeviceEvents
ListDeviceEventsResponse
rs
            ListDeviceEventsResponse
-> Getting
     (First [DeviceEvent]) ListDeviceEventsResponse [DeviceEvent]
-> Maybe [DeviceEvent]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DeviceEvent]
 -> Const (First [DeviceEvent]) (Maybe [DeviceEvent]))
-> ListDeviceEventsResponse
-> Const (First [DeviceEvent]) ListDeviceEventsResponse
Lens' ListDeviceEventsResponse (Maybe [DeviceEvent])
listDeviceEventsResponse_deviceEvents
              ((Maybe [DeviceEvent]
  -> Const (First [DeviceEvent]) (Maybe [DeviceEvent]))
 -> ListDeviceEventsResponse
 -> Const (First [DeviceEvent]) ListDeviceEventsResponse)
-> (([DeviceEvent] -> Const (First [DeviceEvent]) [DeviceEvent])
    -> Maybe [DeviceEvent]
    -> Const (First [DeviceEvent]) (Maybe [DeviceEvent]))
-> Getting
     (First [DeviceEvent]) ListDeviceEventsResponse [DeviceEvent]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DeviceEvent] -> Const (First [DeviceEvent]) [DeviceEvent])
-> Maybe [DeviceEvent]
-> Const (First [DeviceEvent]) (Maybe [DeviceEvent])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListDeviceEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListDeviceEvents -> Maybe ListDeviceEvents
forall a. a -> Maybe a
Prelude.Just (ListDeviceEvents -> Maybe ListDeviceEvents)
-> ListDeviceEvents -> Maybe ListDeviceEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        ListDeviceEvents
rq
          ListDeviceEvents
-> (ListDeviceEvents -> ListDeviceEvents) -> ListDeviceEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDeviceEvents -> Identity ListDeviceEvents
Lens ListDeviceEvents ListDeviceEvents (Maybe Text) (Maybe Text)
listDeviceEvents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListDeviceEvents -> Identity ListDeviceEvents)
-> Maybe Text -> ListDeviceEvents -> ListDeviceEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDeviceEvents
ListDeviceEventsResponse
rs
          ListDeviceEventsResponse
-> Getting (First Text) ListDeviceEventsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDeviceEventsResponse
-> Const (First Text) ListDeviceEventsResponse
Lens' ListDeviceEventsResponse (Maybe Text)
listDeviceEventsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListDeviceEventsResponse
 -> Const (First Text) ListDeviceEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDeviceEventsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListDeviceEvents where
  type
    AWSResponse ListDeviceEvents =
      ListDeviceEventsResponse
  request :: ListDeviceEvents -> Request ListDeviceEvents
request = Service -> ListDeviceEvents -> Request ListDeviceEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListDeviceEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDeviceEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListDeviceEvents))
-> Logger
-> Service
-> Proxy ListDeviceEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDeviceEvents)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [DeviceEvent] -> Int -> ListDeviceEventsResponse
ListDeviceEventsResponse'
            (Maybe Text
 -> Maybe [DeviceEvent] -> Int -> ListDeviceEventsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [DeviceEvent] -> Int -> ListDeviceEventsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String (Maybe [DeviceEvent] -> Int -> ListDeviceEventsResponse)
-> Either String (Maybe [DeviceEvent])
-> Either String (Int -> ListDeviceEventsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [DeviceEvent]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DeviceEvents" Either String (Maybe (Maybe [DeviceEvent]))
-> Maybe [DeviceEvent] -> Either String (Maybe [DeviceEvent])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DeviceEvent]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListDeviceEventsResponse)
-> Either String Int -> Either String ListDeviceEventsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListDeviceEvents

instance Prelude.NFData ListDeviceEvents

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

instance Core.ToJSON ListDeviceEvents where
  toJSON :: ListDeviceEvents -> Value
toJSON ListDeviceEvents' {Maybe Natural
Maybe Text
Maybe DeviceEventType
Text
deviceArn :: Text
maxResults :: Maybe Natural
eventType :: Maybe DeviceEventType
nextToken :: Maybe Text
$sel:deviceArn:ListDeviceEvents' :: ListDeviceEvents -> Text
$sel:maxResults:ListDeviceEvents' :: ListDeviceEvents -> Maybe Natural
$sel:eventType:ListDeviceEvents' :: ListDeviceEvents -> Maybe DeviceEventType
$sel:nextToken:ListDeviceEvents' :: ListDeviceEvents -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"EventType" Text -> DeviceEventType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DeviceEventType -> Pair) -> Maybe DeviceEventType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeviceEventType
eventType,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceArn)
          ]
      )

instance Core.ToPath ListDeviceEvents where
  toPath :: ListDeviceEvents -> ByteString
toPath = ByteString -> ListDeviceEvents -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListDeviceEvents where
  toQuery :: ListDeviceEvents -> QueryString
toQuery = QueryString -> ListDeviceEvents -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListDeviceEventsResponse' smart constructor.
data ListDeviceEventsResponse = ListDeviceEventsResponse'
  { -- | The token returned to indicate that there is more data available.
    ListDeviceEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The device events requested for the device ARN.
    ListDeviceEventsResponse -> Maybe [DeviceEvent]
deviceEvents :: Prelude.Maybe [DeviceEvent],
    -- | The response's http status code.
    ListDeviceEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool
(ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool)
-> (ListDeviceEventsResponse -> ListDeviceEventsResponse -> Bool)
-> Eq ListDeviceEventsResponse
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]
(Int -> ReadS ListDeviceEventsResponse)
-> ReadS [ListDeviceEventsResponse]
-> ReadPrec ListDeviceEventsResponse
-> ReadPrec [ListDeviceEventsResponse]
-> Read 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
(Int -> ListDeviceEventsResponse -> ShowS)
-> (ListDeviceEventsResponse -> String)
-> ([ListDeviceEventsResponse] -> ShowS)
-> Show ListDeviceEventsResponse
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.
 ListDeviceEventsResponse -> Rep ListDeviceEventsResponse x)
-> (forall x.
    Rep ListDeviceEventsResponse x -> ListDeviceEventsResponse)
-> Generic ListDeviceEventsResponse
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:
--
-- 'nextToken', 'listDeviceEventsResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'deviceEvents', 'listDeviceEventsResponse_deviceEvents' - The device events requested for the device ARN.
--
-- 'httpStatus', 'listDeviceEventsResponse_httpStatus' - The response's http status code.
newListDeviceEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDeviceEventsResponse
newListDeviceEventsResponse :: Int -> ListDeviceEventsResponse
newListDeviceEventsResponse Int
pHttpStatus_ =
  ListDeviceEventsResponse' :: Maybe Text
-> Maybe [DeviceEvent] -> Int -> ListDeviceEventsResponse
ListDeviceEventsResponse'
    { $sel:nextToken:ListDeviceEventsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceEvents:ListDeviceEventsResponse' :: Maybe [DeviceEvent]
deviceEvents = Maybe [DeviceEvent]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDeviceEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token returned to indicate that there is more data available.
listDeviceEventsResponse_nextToken :: Lens.Lens' ListDeviceEventsResponse (Prelude.Maybe Prelude.Text)
listDeviceEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDeviceEventsResponse -> f ListDeviceEventsResponse
listDeviceEventsResponse_nextToken = (ListDeviceEventsResponse -> Maybe Text)
-> (ListDeviceEventsResponse
    -> Maybe Text -> ListDeviceEventsResponse)
-> Lens' ListDeviceEventsResponse (Maybe Text)
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 device events requested for the device ARN.
listDeviceEventsResponse_deviceEvents :: Lens.Lens' ListDeviceEventsResponse (Prelude.Maybe [DeviceEvent])
listDeviceEventsResponse_deviceEvents :: (Maybe [DeviceEvent] -> f (Maybe [DeviceEvent]))
-> ListDeviceEventsResponse -> f ListDeviceEventsResponse
listDeviceEventsResponse_deviceEvents = (ListDeviceEventsResponse -> Maybe [DeviceEvent])
-> (ListDeviceEventsResponse
    -> Maybe [DeviceEvent] -> ListDeviceEventsResponse)
-> Lens' ListDeviceEventsResponse (Maybe [DeviceEvent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeviceEventsResponse' {Maybe [DeviceEvent]
deviceEvents :: Maybe [DeviceEvent]
$sel:deviceEvents:ListDeviceEventsResponse' :: ListDeviceEventsResponse -> Maybe [DeviceEvent]
deviceEvents} -> Maybe [DeviceEvent]
deviceEvents) (\s :: ListDeviceEventsResponse
s@ListDeviceEventsResponse' {} Maybe [DeviceEvent]
a -> ListDeviceEventsResponse
s {$sel:deviceEvents:ListDeviceEventsResponse' :: Maybe [DeviceEvent]
deviceEvents = Maybe [DeviceEvent]
a} :: ListDeviceEventsResponse) ((Maybe [DeviceEvent] -> f (Maybe [DeviceEvent]))
 -> ListDeviceEventsResponse -> f ListDeviceEventsResponse)
-> ((Maybe [DeviceEvent] -> f (Maybe [DeviceEvent]))
    -> Maybe [DeviceEvent] -> f (Maybe [DeviceEvent]))
-> (Maybe [DeviceEvent] -> f (Maybe [DeviceEvent]))
-> ListDeviceEventsResponse
-> f ListDeviceEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DeviceEvent] [DeviceEvent] [DeviceEvent] [DeviceEvent]
-> Iso
     (Maybe [DeviceEvent])
     (Maybe [DeviceEvent])
     (Maybe [DeviceEvent])
     (Maybe [DeviceEvent])
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 AnIso [DeviceEvent] [DeviceEvent] [DeviceEvent] [DeviceEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listDeviceEventsResponse_httpStatus :: Lens.Lens' ListDeviceEventsResponse Prelude.Int
listDeviceEventsResponse_httpStatus :: (Int -> f Int)
-> ListDeviceEventsResponse -> f ListDeviceEventsResponse
listDeviceEventsResponse_httpStatus = (ListDeviceEventsResponse -> Int)
-> (ListDeviceEventsResponse -> Int -> ListDeviceEventsResponse)
-> Lens ListDeviceEventsResponse ListDeviceEventsResponse Int Int
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