amazonka-iot1click-devices-2.0: gen/Amazonka/IoT1ClickDevices/DescribeDevice.hs
{-# 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.DescribeDevice
-- Copyright : (c) 2013-2023 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Given a device ID, returns a DescribeDeviceResponse object describing
-- the details of the device.
module Amazonka.IoT1ClickDevices.DescribeDevice
( -- * Creating a Request
DescribeDevice (..),
newDescribeDevice,
-- * Request Lenses
describeDevice_deviceId,
-- * Destructuring the Response
DescribeDeviceResponse (..),
newDescribeDeviceResponse,
-- * Response Lenses
describeDeviceResponse_deviceDescription,
describeDeviceResponse_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:/ 'newDescribeDevice' smart constructor.
data DescribeDevice = DescribeDevice'
{ -- | The unique identifier of the device.
deviceId :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DescribeDevice' 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:
--
-- 'deviceId', 'describeDevice_deviceId' - The unique identifier of the device.
newDescribeDevice ::
-- | 'deviceId'
Prelude.Text ->
DescribeDevice
newDescribeDevice pDeviceId_ =
DescribeDevice' {deviceId = pDeviceId_}
-- | The unique identifier of the device.
describeDevice_deviceId :: Lens.Lens' DescribeDevice Prelude.Text
describeDevice_deviceId = Lens.lens (\DescribeDevice' {deviceId} -> deviceId) (\s@DescribeDevice' {} a -> s {deviceId = a} :: DescribeDevice)
instance Core.AWSRequest DescribeDevice where
type
AWSResponse DescribeDevice =
DescribeDeviceResponse
request overrides =
Request.get (overrides defaultService)
response =
Response.receiveJSON
( \s h x ->
DescribeDeviceResponse'
Prelude.<$> (x Data..?> "deviceDescription")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable DescribeDevice where
hashWithSalt _salt DescribeDevice' {..} =
_salt `Prelude.hashWithSalt` deviceId
instance Prelude.NFData DescribeDevice where
rnf DescribeDevice' {..} = Prelude.rnf deviceId
instance Data.ToHeaders DescribeDevice where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "Content-Type"
Data.=# ( "application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath DescribeDevice where
toPath DescribeDevice' {..} =
Prelude.mconcat ["/devices/", Data.toBS deviceId]
instance Data.ToQuery DescribeDevice where
toQuery = Prelude.const Prelude.mempty
-- | /See:/ 'newDescribeDeviceResponse' smart constructor.
data DescribeDeviceResponse = DescribeDeviceResponse'
{ -- | Device details.
deviceDescription :: Prelude.Maybe DeviceDescription,
-- | The response's http status code.
httpStatus :: Prelude.Int
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DescribeDeviceResponse' 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:
--
-- 'deviceDescription', 'describeDeviceResponse_deviceDescription' - Device details.
--
-- 'httpStatus', 'describeDeviceResponse_httpStatus' - The response's http status code.
newDescribeDeviceResponse ::
-- | 'httpStatus'
Prelude.Int ->
DescribeDeviceResponse
newDescribeDeviceResponse pHttpStatus_ =
DescribeDeviceResponse'
{ deviceDescription =
Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | Device details.
describeDeviceResponse_deviceDescription :: Lens.Lens' DescribeDeviceResponse (Prelude.Maybe DeviceDescription)
describeDeviceResponse_deviceDescription = Lens.lens (\DescribeDeviceResponse' {deviceDescription} -> deviceDescription) (\s@DescribeDeviceResponse' {} a -> s {deviceDescription = a} :: DescribeDeviceResponse)
-- | The response's http status code.
describeDeviceResponse_httpStatus :: Lens.Lens' DescribeDeviceResponse Prelude.Int
describeDeviceResponse_httpStatus = Lens.lens (\DescribeDeviceResponse' {httpStatus} -> httpStatus) (\s@DescribeDeviceResponse' {} a -> s {httpStatus = a} :: DescribeDeviceResponse)
instance Prelude.NFData DescribeDeviceResponse where
rnf DescribeDeviceResponse' {..} =
Prelude.rnf deviceDescription
`Prelude.seq` Prelude.rnf httpStatus