{-# 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.GetWirelessGatewayFirmwareInformation
-- 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 the firmware version and other information about a wireless
-- gateway.
module Amazonka.IoTWireless.GetWirelessGatewayFirmwareInformation
  ( -- * Creating a Request
    GetWirelessGatewayFirmwareInformation (..),
    newGetWirelessGatewayFirmwareInformation,

    -- * Request Lenses
    getWirelessGatewayFirmwareInformation_id,

    -- * Destructuring the Response
    GetWirelessGatewayFirmwareInformationResponse (..),
    newGetWirelessGatewayFirmwareInformationResponse,

    -- * Response Lenses
    getWirelessGatewayFirmwareInformationResponse_loRaWAN,
    getWirelessGatewayFirmwareInformationResponse_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:/ 'newGetWirelessGatewayFirmwareInformation' smart constructor.
data GetWirelessGatewayFirmwareInformation = GetWirelessGatewayFirmwareInformation'
  { -- | The ID of the resource to get.
    GetWirelessGatewayFirmwareInformation -> Text
id :: Prelude.Text
  }
  deriving (GetWirelessGatewayFirmwareInformation
-> GetWirelessGatewayFirmwareInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWirelessGatewayFirmwareInformation
-> GetWirelessGatewayFirmwareInformation -> Bool
$c/= :: GetWirelessGatewayFirmwareInformation
-> GetWirelessGatewayFirmwareInformation -> Bool
== :: GetWirelessGatewayFirmwareInformation
-> GetWirelessGatewayFirmwareInformation -> Bool
$c== :: GetWirelessGatewayFirmwareInformation
-> GetWirelessGatewayFirmwareInformation -> Bool
Prelude.Eq, ReadPrec [GetWirelessGatewayFirmwareInformation]
ReadPrec GetWirelessGatewayFirmwareInformation
Int -> ReadS GetWirelessGatewayFirmwareInformation
ReadS [GetWirelessGatewayFirmwareInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWirelessGatewayFirmwareInformation]
$creadListPrec :: ReadPrec [GetWirelessGatewayFirmwareInformation]
readPrec :: ReadPrec GetWirelessGatewayFirmwareInformation
$creadPrec :: ReadPrec GetWirelessGatewayFirmwareInformation
readList :: ReadS [GetWirelessGatewayFirmwareInformation]
$creadList :: ReadS [GetWirelessGatewayFirmwareInformation]
readsPrec :: Int -> ReadS GetWirelessGatewayFirmwareInformation
$creadsPrec :: Int -> ReadS GetWirelessGatewayFirmwareInformation
Prelude.Read, Int -> GetWirelessGatewayFirmwareInformation -> ShowS
[GetWirelessGatewayFirmwareInformation] -> ShowS
GetWirelessGatewayFirmwareInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWirelessGatewayFirmwareInformation] -> ShowS
$cshowList :: [GetWirelessGatewayFirmwareInformation] -> ShowS
show :: GetWirelessGatewayFirmwareInformation -> String
$cshow :: GetWirelessGatewayFirmwareInformation -> String
showsPrec :: Int -> GetWirelessGatewayFirmwareInformation -> ShowS
$cshowsPrec :: Int -> GetWirelessGatewayFirmwareInformation -> ShowS
Prelude.Show, forall x.
Rep GetWirelessGatewayFirmwareInformation x
-> GetWirelessGatewayFirmwareInformation
forall x.
GetWirelessGatewayFirmwareInformation
-> Rep GetWirelessGatewayFirmwareInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetWirelessGatewayFirmwareInformation x
-> GetWirelessGatewayFirmwareInformation
$cfrom :: forall x.
GetWirelessGatewayFirmwareInformation
-> Rep GetWirelessGatewayFirmwareInformation x
Prelude.Generic)

-- |
-- Create a value of 'GetWirelessGatewayFirmwareInformation' 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:
--
-- 'id', 'getWirelessGatewayFirmwareInformation_id' - The ID of the resource to get.
newGetWirelessGatewayFirmwareInformation ::
  -- | 'id'
  Prelude.Text ->
  GetWirelessGatewayFirmwareInformation
newGetWirelessGatewayFirmwareInformation :: Text -> GetWirelessGatewayFirmwareInformation
newGetWirelessGatewayFirmwareInformation Text
pId_ =
  GetWirelessGatewayFirmwareInformation' {$sel:id:GetWirelessGatewayFirmwareInformation' :: Text
id = Text
pId_}

-- | The ID of the resource to get.
getWirelessGatewayFirmwareInformation_id :: Lens.Lens' GetWirelessGatewayFirmwareInformation Prelude.Text
getWirelessGatewayFirmwareInformation_id :: Lens' GetWirelessGatewayFirmwareInformation Text
getWirelessGatewayFirmwareInformation_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayFirmwareInformation' {Text
id :: Text
$sel:id:GetWirelessGatewayFirmwareInformation' :: GetWirelessGatewayFirmwareInformation -> Text
id} -> Text
id) (\s :: GetWirelessGatewayFirmwareInformation
s@GetWirelessGatewayFirmwareInformation' {} Text
a -> GetWirelessGatewayFirmwareInformation
s {$sel:id:GetWirelessGatewayFirmwareInformation' :: Text
id = Text
a} :: GetWirelessGatewayFirmwareInformation)

instance
  Core.AWSRequest
    GetWirelessGatewayFirmwareInformation
  where
  type
    AWSResponse
      GetWirelessGatewayFirmwareInformation =
      GetWirelessGatewayFirmwareInformationResponse
  request :: (Service -> Service)
-> GetWirelessGatewayFirmwareInformation
-> Request GetWirelessGatewayFirmwareInformation
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 GetWirelessGatewayFirmwareInformation
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetWirelessGatewayFirmwareInformation)))
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 LoRaWANGatewayCurrentVersion
-> Int -> GetWirelessGatewayFirmwareInformationResponse
GetWirelessGatewayFirmwareInformationResponse'
            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
"LoRaWAN")
            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
    GetWirelessGatewayFirmwareInformation
  where
  hashWithSalt :: Int -> GetWirelessGatewayFirmwareInformation -> Int
hashWithSalt
    Int
_salt
    GetWirelessGatewayFirmwareInformation' {Text
id :: Text
$sel:id:GetWirelessGatewayFirmwareInformation' :: GetWirelessGatewayFirmwareInformation -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

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

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

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

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

-- | /See:/ 'newGetWirelessGatewayFirmwareInformationResponse' smart constructor.
data GetWirelessGatewayFirmwareInformationResponse = GetWirelessGatewayFirmwareInformationResponse'
  { -- | Information about the wireless gateway\'s firmware.
    GetWirelessGatewayFirmwareInformationResponse
-> Maybe LoRaWANGatewayCurrentVersion
loRaWAN :: Prelude.Maybe LoRaWANGatewayCurrentVersion,
    -- | The response's http status code.
    GetWirelessGatewayFirmwareInformationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetWirelessGatewayFirmwareInformationResponse
-> GetWirelessGatewayFirmwareInformationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWirelessGatewayFirmwareInformationResponse
-> GetWirelessGatewayFirmwareInformationResponse -> Bool
$c/= :: GetWirelessGatewayFirmwareInformationResponse
-> GetWirelessGatewayFirmwareInformationResponse -> Bool
== :: GetWirelessGatewayFirmwareInformationResponse
-> GetWirelessGatewayFirmwareInformationResponse -> Bool
$c== :: GetWirelessGatewayFirmwareInformationResponse
-> GetWirelessGatewayFirmwareInformationResponse -> Bool
Prelude.Eq, ReadPrec [GetWirelessGatewayFirmwareInformationResponse]
ReadPrec GetWirelessGatewayFirmwareInformationResponse
Int -> ReadS GetWirelessGatewayFirmwareInformationResponse
ReadS [GetWirelessGatewayFirmwareInformationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWirelessGatewayFirmwareInformationResponse]
$creadListPrec :: ReadPrec [GetWirelessGatewayFirmwareInformationResponse]
readPrec :: ReadPrec GetWirelessGatewayFirmwareInformationResponse
$creadPrec :: ReadPrec GetWirelessGatewayFirmwareInformationResponse
readList :: ReadS [GetWirelessGatewayFirmwareInformationResponse]
$creadList :: ReadS [GetWirelessGatewayFirmwareInformationResponse]
readsPrec :: Int -> ReadS GetWirelessGatewayFirmwareInformationResponse
$creadsPrec :: Int -> ReadS GetWirelessGatewayFirmwareInformationResponse
Prelude.Read, Int -> GetWirelessGatewayFirmwareInformationResponse -> ShowS
[GetWirelessGatewayFirmwareInformationResponse] -> ShowS
GetWirelessGatewayFirmwareInformationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWirelessGatewayFirmwareInformationResponse] -> ShowS
$cshowList :: [GetWirelessGatewayFirmwareInformationResponse] -> ShowS
show :: GetWirelessGatewayFirmwareInformationResponse -> String
$cshow :: GetWirelessGatewayFirmwareInformationResponse -> String
showsPrec :: Int -> GetWirelessGatewayFirmwareInformationResponse -> ShowS
$cshowsPrec :: Int -> GetWirelessGatewayFirmwareInformationResponse -> ShowS
Prelude.Show, forall x.
Rep GetWirelessGatewayFirmwareInformationResponse x
-> GetWirelessGatewayFirmwareInformationResponse
forall x.
GetWirelessGatewayFirmwareInformationResponse
-> Rep GetWirelessGatewayFirmwareInformationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetWirelessGatewayFirmwareInformationResponse x
-> GetWirelessGatewayFirmwareInformationResponse
$cfrom :: forall x.
GetWirelessGatewayFirmwareInformationResponse
-> Rep GetWirelessGatewayFirmwareInformationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetWirelessGatewayFirmwareInformationResponse' 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:
--
-- 'loRaWAN', 'getWirelessGatewayFirmwareInformationResponse_loRaWAN' - Information about the wireless gateway\'s firmware.
--
-- 'httpStatus', 'getWirelessGatewayFirmwareInformationResponse_httpStatus' - The response's http status code.
newGetWirelessGatewayFirmwareInformationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetWirelessGatewayFirmwareInformationResponse
newGetWirelessGatewayFirmwareInformationResponse :: Int -> GetWirelessGatewayFirmwareInformationResponse
newGetWirelessGatewayFirmwareInformationResponse
  Int
pHttpStatus_ =
    GetWirelessGatewayFirmwareInformationResponse'
      { $sel:loRaWAN:GetWirelessGatewayFirmwareInformationResponse' :: Maybe LoRaWANGatewayCurrentVersion
loRaWAN =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetWirelessGatewayFirmwareInformationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the wireless gateway\'s firmware.
getWirelessGatewayFirmwareInformationResponse_loRaWAN :: Lens.Lens' GetWirelessGatewayFirmwareInformationResponse (Prelude.Maybe LoRaWANGatewayCurrentVersion)
getWirelessGatewayFirmwareInformationResponse_loRaWAN :: Lens'
  GetWirelessGatewayFirmwareInformationResponse
  (Maybe LoRaWANGatewayCurrentVersion)
getWirelessGatewayFirmwareInformationResponse_loRaWAN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWirelessGatewayFirmwareInformationResponse' {Maybe LoRaWANGatewayCurrentVersion
loRaWAN :: Maybe LoRaWANGatewayCurrentVersion
$sel:loRaWAN:GetWirelessGatewayFirmwareInformationResponse' :: GetWirelessGatewayFirmwareInformationResponse
-> Maybe LoRaWANGatewayCurrentVersion
loRaWAN} -> Maybe LoRaWANGatewayCurrentVersion
loRaWAN) (\s :: GetWirelessGatewayFirmwareInformationResponse
s@GetWirelessGatewayFirmwareInformationResponse' {} Maybe LoRaWANGatewayCurrentVersion
a -> GetWirelessGatewayFirmwareInformationResponse
s {$sel:loRaWAN:GetWirelessGatewayFirmwareInformationResponse' :: Maybe LoRaWANGatewayCurrentVersion
loRaWAN = Maybe LoRaWANGatewayCurrentVersion
a} :: GetWirelessGatewayFirmwareInformationResponse)

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

instance
  Prelude.NFData
    GetWirelessGatewayFirmwareInformationResponse
  where
  rnf :: GetWirelessGatewayFirmwareInformationResponse -> ()
rnf
    GetWirelessGatewayFirmwareInformationResponse' {Int
Maybe LoRaWANGatewayCurrentVersion
httpStatus :: Int
loRaWAN :: Maybe LoRaWANGatewayCurrentVersion
$sel:httpStatus:GetWirelessGatewayFirmwareInformationResponse' :: GetWirelessGatewayFirmwareInformationResponse -> Int
$sel:loRaWAN:GetWirelessGatewayFirmwareInformationResponse' :: GetWirelessGatewayFirmwareInformationResponse
-> Maybe LoRaWANGatewayCurrentVersion
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe LoRaWANGatewayCurrentVersion
loRaWAN
        seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus