{-# 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.Panorama.DeleteDevice
-- 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)
--
-- Deletes a device.
module Amazonka.Panorama.DeleteDevice
  ( -- * Creating a Request
    DeleteDevice (..),
    newDeleteDevice,

    -- * Request Lenses
    deleteDevice_deviceId,

    -- * Destructuring the Response
    DeleteDeviceResponse (..),
    newDeleteDeviceResponse,

    -- * Response Lenses
    deleteDeviceResponse_deviceId,
    deleteDeviceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteDevice' smart constructor.
data DeleteDevice = DeleteDevice'
  { -- | The device\'s ID.
    DeleteDevice -> Text
deviceId :: Prelude.Text
  }
  deriving (DeleteDevice -> DeleteDevice -> Bool
(DeleteDevice -> DeleteDevice -> Bool)
-> (DeleteDevice -> DeleteDevice -> Bool) -> Eq DeleteDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDevice -> DeleteDevice -> Bool
$c/= :: DeleteDevice -> DeleteDevice -> Bool
== :: DeleteDevice -> DeleteDevice -> Bool
$c== :: DeleteDevice -> DeleteDevice -> Bool
Prelude.Eq, ReadPrec [DeleteDevice]
ReadPrec DeleteDevice
Int -> ReadS DeleteDevice
ReadS [DeleteDevice]
(Int -> ReadS DeleteDevice)
-> ReadS [DeleteDevice]
-> ReadPrec DeleteDevice
-> ReadPrec [DeleteDevice]
-> Read DeleteDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDevice]
$creadListPrec :: ReadPrec [DeleteDevice]
readPrec :: ReadPrec DeleteDevice
$creadPrec :: ReadPrec DeleteDevice
readList :: ReadS [DeleteDevice]
$creadList :: ReadS [DeleteDevice]
readsPrec :: Int -> ReadS DeleteDevice
$creadsPrec :: Int -> ReadS DeleteDevice
Prelude.Read, Int -> DeleteDevice -> ShowS
[DeleteDevice] -> ShowS
DeleteDevice -> String
(Int -> DeleteDevice -> ShowS)
-> (DeleteDevice -> String)
-> ([DeleteDevice] -> ShowS)
-> Show DeleteDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDevice] -> ShowS
$cshowList :: [DeleteDevice] -> ShowS
show :: DeleteDevice -> String
$cshow :: DeleteDevice -> String
showsPrec :: Int -> DeleteDevice -> ShowS
$cshowsPrec :: Int -> DeleteDevice -> ShowS
Prelude.Show, (forall x. DeleteDevice -> Rep DeleteDevice x)
-> (forall x. Rep DeleteDevice x -> DeleteDevice)
-> Generic DeleteDevice
forall x. Rep DeleteDevice x -> DeleteDevice
forall x. DeleteDevice -> Rep DeleteDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDevice x -> DeleteDevice
$cfrom :: forall x. DeleteDevice -> Rep DeleteDevice x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDevice' 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', 'deleteDevice_deviceId' - The device\'s ID.
newDeleteDevice ::
  -- | 'deviceId'
  Prelude.Text ->
  DeleteDevice
newDeleteDevice :: Text -> DeleteDevice
newDeleteDevice Text
pDeviceId_ =
  DeleteDevice' :: Text -> DeleteDevice
DeleteDevice' {$sel:deviceId:DeleteDevice' :: Text
deviceId = Text
pDeviceId_}

-- | The device\'s ID.
deleteDevice_deviceId :: Lens.Lens' DeleteDevice Prelude.Text
deleteDevice_deviceId :: (Text -> f Text) -> DeleteDevice -> f DeleteDevice
deleteDevice_deviceId = (DeleteDevice -> Text)
-> (DeleteDevice -> Text -> DeleteDevice)
-> Lens DeleteDevice DeleteDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDevice' {Text
deviceId :: Text
$sel:deviceId:DeleteDevice' :: DeleteDevice -> Text
deviceId} -> Text
deviceId) (\s :: DeleteDevice
s@DeleteDevice' {} Text
a -> DeleteDevice
s {$sel:deviceId:DeleteDevice' :: Text
deviceId = Text
a} :: DeleteDevice)

instance Core.AWSRequest DeleteDevice where
  type AWSResponse DeleteDevice = DeleteDeviceResponse
  request :: DeleteDevice -> Request DeleteDevice
request = Service -> DeleteDevice -> Request DeleteDevice
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDevice)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteDevice))
-> Logger
-> Service
-> Proxy DeleteDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDevice)))
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 -> Int -> DeleteDeviceResponse
DeleteDeviceResponse'
            (Maybe Text -> Int -> DeleteDeviceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteDeviceResponse)
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
"DeviceId")
            Either String (Int -> DeleteDeviceResponse)
-> Either String Int -> Either String DeleteDeviceResponse
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 DeleteDevice

instance Prelude.NFData DeleteDevice

instance Core.ToHeaders DeleteDevice where
  toHeaders :: DeleteDevice -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDevice -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath DeleteDevice where
  toPath :: DeleteDevice -> ByteString
toPath DeleteDevice' {Text
deviceId :: Text
$sel:deviceId:DeleteDevice' :: DeleteDevice -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/devices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceId]

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

-- | /See:/ 'newDeleteDeviceResponse' smart constructor.
data DeleteDeviceResponse = DeleteDeviceResponse'
  { -- | The device\'s ID.
    DeleteDeviceResponse -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteDeviceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteDeviceResponse -> DeleteDeviceResponse -> Bool
(DeleteDeviceResponse -> DeleteDeviceResponse -> Bool)
-> (DeleteDeviceResponse -> DeleteDeviceResponse -> Bool)
-> Eq DeleteDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDeviceResponse -> DeleteDeviceResponse -> Bool
$c/= :: DeleteDeviceResponse -> DeleteDeviceResponse -> Bool
== :: DeleteDeviceResponse -> DeleteDeviceResponse -> Bool
$c== :: DeleteDeviceResponse -> DeleteDeviceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDeviceResponse]
ReadPrec DeleteDeviceResponse
Int -> ReadS DeleteDeviceResponse
ReadS [DeleteDeviceResponse]
(Int -> ReadS DeleteDeviceResponse)
-> ReadS [DeleteDeviceResponse]
-> ReadPrec DeleteDeviceResponse
-> ReadPrec [DeleteDeviceResponse]
-> Read DeleteDeviceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDeviceResponse]
$creadListPrec :: ReadPrec [DeleteDeviceResponse]
readPrec :: ReadPrec DeleteDeviceResponse
$creadPrec :: ReadPrec DeleteDeviceResponse
readList :: ReadS [DeleteDeviceResponse]
$creadList :: ReadS [DeleteDeviceResponse]
readsPrec :: Int -> ReadS DeleteDeviceResponse
$creadsPrec :: Int -> ReadS DeleteDeviceResponse
Prelude.Read, Int -> DeleteDeviceResponse -> ShowS
[DeleteDeviceResponse] -> ShowS
DeleteDeviceResponse -> String
(Int -> DeleteDeviceResponse -> ShowS)
-> (DeleteDeviceResponse -> String)
-> ([DeleteDeviceResponse] -> ShowS)
-> Show DeleteDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDeviceResponse] -> ShowS
$cshowList :: [DeleteDeviceResponse] -> ShowS
show :: DeleteDeviceResponse -> String
$cshow :: DeleteDeviceResponse -> String
showsPrec :: Int -> DeleteDeviceResponse -> ShowS
$cshowsPrec :: Int -> DeleteDeviceResponse -> ShowS
Prelude.Show, (forall x. DeleteDeviceResponse -> Rep DeleteDeviceResponse x)
-> (forall x. Rep DeleteDeviceResponse x -> DeleteDeviceResponse)
-> Generic DeleteDeviceResponse
forall x. Rep DeleteDeviceResponse x -> DeleteDeviceResponse
forall x. DeleteDeviceResponse -> Rep DeleteDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDeviceResponse x -> DeleteDeviceResponse
$cfrom :: forall x. DeleteDeviceResponse -> Rep DeleteDeviceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDeviceResponse' 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', 'deleteDeviceResponse_deviceId' - The device\'s ID.
--
-- 'httpStatus', 'deleteDeviceResponse_httpStatus' - The response's http status code.
newDeleteDeviceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDeviceResponse
newDeleteDeviceResponse :: Int -> DeleteDeviceResponse
newDeleteDeviceResponse Int
pHttpStatus_ =
  DeleteDeviceResponse' :: Maybe Text -> Int -> DeleteDeviceResponse
DeleteDeviceResponse'
    { $sel:deviceId:DeleteDeviceResponse' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The device\'s ID.
deleteDeviceResponse_deviceId :: Lens.Lens' DeleteDeviceResponse (Prelude.Maybe Prelude.Text)
deleteDeviceResponse_deviceId :: (Maybe Text -> f (Maybe Text))
-> DeleteDeviceResponse -> f DeleteDeviceResponse
deleteDeviceResponse_deviceId = (DeleteDeviceResponse -> Maybe Text)
-> (DeleteDeviceResponse -> Maybe Text -> DeleteDeviceResponse)
-> Lens
     DeleteDeviceResponse DeleteDeviceResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeviceResponse' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:DeleteDeviceResponse' :: DeleteDeviceResponse -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: DeleteDeviceResponse
s@DeleteDeviceResponse' {} Maybe Text
a -> DeleteDeviceResponse
s {$sel:deviceId:DeleteDeviceResponse' :: Maybe Text
deviceId = Maybe Text
a} :: DeleteDeviceResponse)

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

instance Prelude.NFData DeleteDeviceResponse