{-# 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.IoTWireless.GetWirelessGatewayStatistics
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets operating information about a wireless gateway.
module Amazonka.IoTWireless.GetWirelessGatewayStatistics
  ( -- * Creating a Request
    GetWirelessGatewayStatistics (..),
    newGetWirelessGatewayStatistics,

    -- * Request Lenses
    getWirelessGatewayStatistics_wirelessGatewayId,

    -- * Destructuring the Response
    GetWirelessGatewayStatisticsResponse (..),
    newGetWirelessGatewayStatisticsResponse,

    -- * Response Lenses
    getWirelessGatewayStatisticsResponse_connectionStatus,
    getWirelessGatewayStatisticsResponse_lastUplinkReceivedAt,
    getWirelessGatewayStatisticsResponse_wirelessGatewayId,
    getWirelessGatewayStatisticsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetWirelessGatewayStatistics' smart constructor.
data GetWirelessGatewayStatistics = GetWirelessGatewayStatistics'
  { -- | The ID of the wireless gateway for which to get the data.
    GetWirelessGatewayStatistics -> Text
wirelessGatewayId :: Prelude.Text
  }
  deriving (GetWirelessGatewayStatistics
-> GetWirelessGatewayStatistics -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWirelessGatewayStatistics
-> GetWirelessGatewayStatistics -> Bool
$c/= :: GetWirelessGatewayStatistics
-> GetWirelessGatewayStatistics -> Bool
== :: GetWirelessGatewayStatistics
-> GetWirelessGatewayStatistics -> Bool
$c== :: GetWirelessGatewayStatistics
-> GetWirelessGatewayStatistics -> Bool
Prelude.Eq, ReadPrec [GetWirelessGatewayStatistics]
ReadPrec GetWirelessGatewayStatistics
Int -> ReadS GetWirelessGatewayStatistics
ReadS [GetWirelessGatewayStatistics]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWirelessGatewayStatistics]
$creadListPrec :: ReadPrec [GetWirelessGatewayStatistics]
readPrec :: ReadPrec GetWirelessGatewayStatistics
$creadPrec :: ReadPrec GetWirelessGatewayStatistics
readList :: ReadS [GetWirelessGatewayStatistics]
$creadList :: ReadS [GetWirelessGatewayStatistics]
readsPrec :: Int -> ReadS GetWirelessGatewayStatistics
$creadsPrec :: Int -> ReadS GetWirelessGatewayStatistics
Prelude.Read, Int -> GetWirelessGatewayStatistics -> ShowS
[GetWirelessGatewayStatistics] -> ShowS
GetWirelessGatewayStatistics -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWirelessGatewayStatistics] -> ShowS
$cshowList :: [GetWirelessGatewayStatistics] -> ShowS
show :: GetWirelessGatewayStatistics -> String
$cshow :: GetWirelessGatewayStatistics -> String
showsPrec :: Int -> GetWirelessGatewayStatistics -> ShowS
$cshowsPrec :: Int -> GetWirelessGatewayStatistics -> ShowS
Prelude.Show, forall x.
Rep GetWirelessGatewayStatistics x -> GetWirelessGatewayStatistics
forall x.
GetWirelessGatewayStatistics -> Rep GetWirelessGatewayStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetWirelessGatewayStatistics x -> GetWirelessGatewayStatistics
$cfrom :: forall x.
GetWirelessGatewayStatistics -> Rep GetWirelessGatewayStatistics x
Prelude.Generic)

-- |
-- Create a value of 'GetWirelessGatewayStatistics' 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:
--
-- 'wirelessGatewayId', 'getWirelessGatewayStatistics_wirelessGatewayId' - The ID of the wireless gateway for which to get the data.
newGetWirelessGatewayStatistics ::
  -- | 'wirelessGatewayId'
  Prelude.Text ->
  GetWirelessGatewayStatistics
newGetWirelessGatewayStatistics :: Text -> GetWirelessGatewayStatistics
newGetWirelessGatewayStatistics Text
pWirelessGatewayId_ =
  GetWirelessGatewayStatistics'
    { $sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: Text
wirelessGatewayId =
        Text
pWirelessGatewayId_
    }

-- | The ID of the wireless gateway for which to get the data.
getWirelessGatewayStatistics_wirelessGatewayId :: Lens.Lens' GetWirelessGatewayStatistics Prelude.Text
getWirelessGatewayStatistics_wirelessGatewayId :: Lens' GetWirelessGatewayStatistics Text
getWirelessGatewayStatistics_wirelessGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayStatistics' {Text
wirelessGatewayId :: Text
$sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: GetWirelessGatewayStatistics -> Text
wirelessGatewayId} -> Text
wirelessGatewayId) (\s :: GetWirelessGatewayStatistics
s@GetWirelessGatewayStatistics' {} Text
a -> GetWirelessGatewayStatistics
s {$sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: Text
wirelessGatewayId = Text
a} :: GetWirelessGatewayStatistics)

instance Core.AWSRequest GetWirelessGatewayStatistics where
  type
    AWSResponse GetWirelessGatewayStatistics =
      GetWirelessGatewayStatisticsResponse
  request :: (Service -> Service)
-> GetWirelessGatewayStatistics
-> Request GetWirelessGatewayStatistics
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 GetWirelessGatewayStatistics
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetWirelessGatewayStatistics)))
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 ConnectionStatus
-> Maybe Text
-> Maybe Text
-> Int
-> GetWirelessGatewayStatisticsResponse
GetWirelessGatewayStatisticsResponse'
            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
"ConnectionStatus")
            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
"LastUplinkReceivedAt")
            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
"WirelessGatewayId")
            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
    GetWirelessGatewayStatistics
  where
  hashWithSalt :: Int -> GetWirelessGatewayStatistics -> Int
hashWithSalt Int
_salt GetWirelessGatewayStatistics' {Text
wirelessGatewayId :: Text
$sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: GetWirelessGatewayStatistics -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
wirelessGatewayId

instance Prelude.NFData GetWirelessGatewayStatistics where
  rnf :: GetWirelessGatewayStatistics -> ()
rnf GetWirelessGatewayStatistics' {Text
wirelessGatewayId :: Text
$sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: GetWirelessGatewayStatistics -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
wirelessGatewayId

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

instance Data.ToPath GetWirelessGatewayStatistics where
  toPath :: GetWirelessGatewayStatistics -> ByteString
toPath GetWirelessGatewayStatistics' {Text
wirelessGatewayId :: Text
$sel:wirelessGatewayId:GetWirelessGatewayStatistics' :: GetWirelessGatewayStatistics -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/wireless-gateways/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
wirelessGatewayId,
        ByteString
"/statistics"
      ]

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

-- | /See:/ 'newGetWirelessGatewayStatisticsResponse' smart constructor.
data GetWirelessGatewayStatisticsResponse = GetWirelessGatewayStatisticsResponse'
  { -- | The connection status of the wireless gateway.
    GetWirelessGatewayStatisticsResponse -> Maybe ConnectionStatus
connectionStatus :: Prelude.Maybe ConnectionStatus,
    -- | The date and time when the most recent uplink was received.
    GetWirelessGatewayStatisticsResponse -> Maybe Text
lastUplinkReceivedAt :: Prelude.Maybe Prelude.Text,
    -- | The ID of the wireless gateway.
    GetWirelessGatewayStatisticsResponse -> Maybe Text
wirelessGatewayId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetWirelessGatewayStatisticsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetWirelessGatewayStatisticsResponse
-> GetWirelessGatewayStatisticsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWirelessGatewayStatisticsResponse
-> GetWirelessGatewayStatisticsResponse -> Bool
$c/= :: GetWirelessGatewayStatisticsResponse
-> GetWirelessGatewayStatisticsResponse -> Bool
== :: GetWirelessGatewayStatisticsResponse
-> GetWirelessGatewayStatisticsResponse -> Bool
$c== :: GetWirelessGatewayStatisticsResponse
-> GetWirelessGatewayStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [GetWirelessGatewayStatisticsResponse]
ReadPrec GetWirelessGatewayStatisticsResponse
Int -> ReadS GetWirelessGatewayStatisticsResponse
ReadS [GetWirelessGatewayStatisticsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWirelessGatewayStatisticsResponse]
$creadListPrec :: ReadPrec [GetWirelessGatewayStatisticsResponse]
readPrec :: ReadPrec GetWirelessGatewayStatisticsResponse
$creadPrec :: ReadPrec GetWirelessGatewayStatisticsResponse
readList :: ReadS [GetWirelessGatewayStatisticsResponse]
$creadList :: ReadS [GetWirelessGatewayStatisticsResponse]
readsPrec :: Int -> ReadS GetWirelessGatewayStatisticsResponse
$creadsPrec :: Int -> ReadS GetWirelessGatewayStatisticsResponse
Prelude.Read, Int -> GetWirelessGatewayStatisticsResponse -> ShowS
[GetWirelessGatewayStatisticsResponse] -> ShowS
GetWirelessGatewayStatisticsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWirelessGatewayStatisticsResponse] -> ShowS
$cshowList :: [GetWirelessGatewayStatisticsResponse] -> ShowS
show :: GetWirelessGatewayStatisticsResponse -> String
$cshow :: GetWirelessGatewayStatisticsResponse -> String
showsPrec :: Int -> GetWirelessGatewayStatisticsResponse -> ShowS
$cshowsPrec :: Int -> GetWirelessGatewayStatisticsResponse -> ShowS
Prelude.Show, forall x.
Rep GetWirelessGatewayStatisticsResponse x
-> GetWirelessGatewayStatisticsResponse
forall x.
GetWirelessGatewayStatisticsResponse
-> Rep GetWirelessGatewayStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetWirelessGatewayStatisticsResponse x
-> GetWirelessGatewayStatisticsResponse
$cfrom :: forall x.
GetWirelessGatewayStatisticsResponse
-> Rep GetWirelessGatewayStatisticsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetWirelessGatewayStatisticsResponse' 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:
--
-- 'connectionStatus', 'getWirelessGatewayStatisticsResponse_connectionStatus' - The connection status of the wireless gateway.
--
-- 'lastUplinkReceivedAt', 'getWirelessGatewayStatisticsResponse_lastUplinkReceivedAt' - The date and time when the most recent uplink was received.
--
-- 'wirelessGatewayId', 'getWirelessGatewayStatisticsResponse_wirelessGatewayId' - The ID of the wireless gateway.
--
-- 'httpStatus', 'getWirelessGatewayStatisticsResponse_httpStatus' - The response's http status code.
newGetWirelessGatewayStatisticsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetWirelessGatewayStatisticsResponse
newGetWirelessGatewayStatisticsResponse :: Int -> GetWirelessGatewayStatisticsResponse
newGetWirelessGatewayStatisticsResponse Int
pHttpStatus_ =
  GetWirelessGatewayStatisticsResponse'
    { $sel:connectionStatus:GetWirelessGatewayStatisticsResponse' :: Maybe ConnectionStatus
connectionStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastUplinkReceivedAt:GetWirelessGatewayStatisticsResponse' :: Maybe Text
lastUplinkReceivedAt =
        forall a. Maybe a
Prelude.Nothing,
      $sel:wirelessGatewayId:GetWirelessGatewayStatisticsResponse' :: Maybe Text
wirelessGatewayId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetWirelessGatewayStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The connection status of the wireless gateway.
getWirelessGatewayStatisticsResponse_connectionStatus :: Lens.Lens' GetWirelessGatewayStatisticsResponse (Prelude.Maybe ConnectionStatus)
getWirelessGatewayStatisticsResponse_connectionStatus :: Lens' GetWirelessGatewayStatisticsResponse (Maybe ConnectionStatus)
getWirelessGatewayStatisticsResponse_connectionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayStatisticsResponse' {Maybe ConnectionStatus
connectionStatus :: Maybe ConnectionStatus
$sel:connectionStatus:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe ConnectionStatus
connectionStatus} -> Maybe ConnectionStatus
connectionStatus) (\s :: GetWirelessGatewayStatisticsResponse
s@GetWirelessGatewayStatisticsResponse' {} Maybe ConnectionStatus
a -> GetWirelessGatewayStatisticsResponse
s {$sel:connectionStatus:GetWirelessGatewayStatisticsResponse' :: Maybe ConnectionStatus
connectionStatus = Maybe ConnectionStatus
a} :: GetWirelessGatewayStatisticsResponse)

-- | The date and time when the most recent uplink was received.
getWirelessGatewayStatisticsResponse_lastUplinkReceivedAt :: Lens.Lens' GetWirelessGatewayStatisticsResponse (Prelude.Maybe Prelude.Text)
getWirelessGatewayStatisticsResponse_lastUplinkReceivedAt :: Lens' GetWirelessGatewayStatisticsResponse (Maybe Text)
getWirelessGatewayStatisticsResponse_lastUplinkReceivedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayStatisticsResponse' {Maybe Text
lastUplinkReceivedAt :: Maybe Text
$sel:lastUplinkReceivedAt:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe Text
lastUplinkReceivedAt} -> Maybe Text
lastUplinkReceivedAt) (\s :: GetWirelessGatewayStatisticsResponse
s@GetWirelessGatewayStatisticsResponse' {} Maybe Text
a -> GetWirelessGatewayStatisticsResponse
s {$sel:lastUplinkReceivedAt:GetWirelessGatewayStatisticsResponse' :: Maybe Text
lastUplinkReceivedAt = Maybe Text
a} :: GetWirelessGatewayStatisticsResponse)

-- | The ID of the wireless gateway.
getWirelessGatewayStatisticsResponse_wirelessGatewayId :: Lens.Lens' GetWirelessGatewayStatisticsResponse (Prelude.Maybe Prelude.Text)
getWirelessGatewayStatisticsResponse_wirelessGatewayId :: Lens' GetWirelessGatewayStatisticsResponse (Maybe Text)
getWirelessGatewayStatisticsResponse_wirelessGatewayId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayStatisticsResponse' {Maybe Text
wirelessGatewayId :: Maybe Text
$sel:wirelessGatewayId:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe Text
wirelessGatewayId} -> Maybe Text
wirelessGatewayId) (\s :: GetWirelessGatewayStatisticsResponse
s@GetWirelessGatewayStatisticsResponse' {} Maybe Text
a -> GetWirelessGatewayStatisticsResponse
s {$sel:wirelessGatewayId:GetWirelessGatewayStatisticsResponse' :: Maybe Text
wirelessGatewayId = Maybe Text
a} :: GetWirelessGatewayStatisticsResponse)

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

instance
  Prelude.NFData
    GetWirelessGatewayStatisticsResponse
  where
  rnf :: GetWirelessGatewayStatisticsResponse -> ()
rnf GetWirelessGatewayStatisticsResponse' {Int
Maybe Text
Maybe ConnectionStatus
httpStatus :: Int
wirelessGatewayId :: Maybe Text
lastUplinkReceivedAt :: Maybe Text
connectionStatus :: Maybe ConnectionStatus
$sel:httpStatus:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Int
$sel:wirelessGatewayId:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe Text
$sel:lastUplinkReceivedAt:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe Text
$sel:connectionStatus:GetWirelessGatewayStatisticsResponse' :: GetWirelessGatewayStatisticsResponse -> Maybe ConnectionStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectionStatus
connectionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUplinkReceivedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
wirelessGatewayId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus