{-# 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.DisassociateWirelessDeviceFromThing
-- 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)
--
-- Disassociates a wireless device from its currently associated thing.
module Amazonka.IoTWireless.DisassociateWirelessDeviceFromThing
  ( -- * Creating a Request
    DisassociateWirelessDeviceFromThing (..),
    newDisassociateWirelessDeviceFromThing,

    -- * Request Lenses
    disassociateWirelessDeviceFromThing_id,

    -- * Destructuring the Response
    DisassociateWirelessDeviceFromThingResponse (..),
    newDisassociateWirelessDeviceFromThingResponse,

    -- * Response Lenses
    disassociateWirelessDeviceFromThingResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types
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:/ 'newDisassociateWirelessDeviceFromThing' smart constructor.
data DisassociateWirelessDeviceFromThing = DisassociateWirelessDeviceFromThing'
  { -- | The ID of the resource to update.
    DisassociateWirelessDeviceFromThing -> Text
id :: Prelude.Text
  }
  deriving (DisassociateWirelessDeviceFromThing
-> DisassociateWirelessDeviceFromThing -> Bool
(DisassociateWirelessDeviceFromThing
 -> DisassociateWirelessDeviceFromThing -> Bool)
-> (DisassociateWirelessDeviceFromThing
    -> DisassociateWirelessDeviceFromThing -> Bool)
-> Eq DisassociateWirelessDeviceFromThing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateWirelessDeviceFromThing
-> DisassociateWirelessDeviceFromThing -> Bool
$c/= :: DisassociateWirelessDeviceFromThing
-> DisassociateWirelessDeviceFromThing -> Bool
== :: DisassociateWirelessDeviceFromThing
-> DisassociateWirelessDeviceFromThing -> Bool
$c== :: DisassociateWirelessDeviceFromThing
-> DisassociateWirelessDeviceFromThing -> Bool
Prelude.Eq, ReadPrec [DisassociateWirelessDeviceFromThing]
ReadPrec DisassociateWirelessDeviceFromThing
Int -> ReadS DisassociateWirelessDeviceFromThing
ReadS [DisassociateWirelessDeviceFromThing]
(Int -> ReadS DisassociateWirelessDeviceFromThing)
-> ReadS [DisassociateWirelessDeviceFromThing]
-> ReadPrec DisassociateWirelessDeviceFromThing
-> ReadPrec [DisassociateWirelessDeviceFromThing]
-> Read DisassociateWirelessDeviceFromThing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateWirelessDeviceFromThing]
$creadListPrec :: ReadPrec [DisassociateWirelessDeviceFromThing]
readPrec :: ReadPrec DisassociateWirelessDeviceFromThing
$creadPrec :: ReadPrec DisassociateWirelessDeviceFromThing
readList :: ReadS [DisassociateWirelessDeviceFromThing]
$creadList :: ReadS [DisassociateWirelessDeviceFromThing]
readsPrec :: Int -> ReadS DisassociateWirelessDeviceFromThing
$creadsPrec :: Int -> ReadS DisassociateWirelessDeviceFromThing
Prelude.Read, Int -> DisassociateWirelessDeviceFromThing -> ShowS
[DisassociateWirelessDeviceFromThing] -> ShowS
DisassociateWirelessDeviceFromThing -> String
(Int -> DisassociateWirelessDeviceFromThing -> ShowS)
-> (DisassociateWirelessDeviceFromThing -> String)
-> ([DisassociateWirelessDeviceFromThing] -> ShowS)
-> Show DisassociateWirelessDeviceFromThing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateWirelessDeviceFromThing] -> ShowS
$cshowList :: [DisassociateWirelessDeviceFromThing] -> ShowS
show :: DisassociateWirelessDeviceFromThing -> String
$cshow :: DisassociateWirelessDeviceFromThing -> String
showsPrec :: Int -> DisassociateWirelessDeviceFromThing -> ShowS
$cshowsPrec :: Int -> DisassociateWirelessDeviceFromThing -> ShowS
Prelude.Show, (forall x.
 DisassociateWirelessDeviceFromThing
 -> Rep DisassociateWirelessDeviceFromThing x)
-> (forall x.
    Rep DisassociateWirelessDeviceFromThing x
    -> DisassociateWirelessDeviceFromThing)
-> Generic DisassociateWirelessDeviceFromThing
forall x.
Rep DisassociateWirelessDeviceFromThing x
-> DisassociateWirelessDeviceFromThing
forall x.
DisassociateWirelessDeviceFromThing
-> Rep DisassociateWirelessDeviceFromThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateWirelessDeviceFromThing x
-> DisassociateWirelessDeviceFromThing
$cfrom :: forall x.
DisassociateWirelessDeviceFromThing
-> Rep DisassociateWirelessDeviceFromThing x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateWirelessDeviceFromThing' 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', 'disassociateWirelessDeviceFromThing_id' - The ID of the resource to update.
newDisassociateWirelessDeviceFromThing ::
  -- | 'id'
  Prelude.Text ->
  DisassociateWirelessDeviceFromThing
newDisassociateWirelessDeviceFromThing :: Text -> DisassociateWirelessDeviceFromThing
newDisassociateWirelessDeviceFromThing Text
pId_ =
  DisassociateWirelessDeviceFromThing' :: Text -> DisassociateWirelessDeviceFromThing
DisassociateWirelessDeviceFromThing' {$sel:id:DisassociateWirelessDeviceFromThing' :: Text
id = Text
pId_}

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

instance
  Core.AWSRequest
    DisassociateWirelessDeviceFromThing
  where
  type
    AWSResponse DisassociateWirelessDeviceFromThing =
      DisassociateWirelessDeviceFromThingResponse
  request :: DisassociateWirelessDeviceFromThing
-> Request DisassociateWirelessDeviceFromThing
request = Service
-> DisassociateWirelessDeviceFromThing
-> Request DisassociateWirelessDeviceFromThing
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateWirelessDeviceFromThing
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateWirelessDeviceFromThing)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateWirelessDeviceFromThing))
-> Logger
-> Service
-> Proxy DisassociateWirelessDeviceFromThing
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateWirelessDeviceFromThing)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateWirelessDeviceFromThingResponse
DisassociateWirelessDeviceFromThingResponse'
            (Int -> DisassociateWirelessDeviceFromThingResponse)
-> Either String Int
-> Either String DisassociateWirelessDeviceFromThingResponse
forall (f :: * -> *) a b. Functor 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
    DisassociateWirelessDeviceFromThing

instance
  Prelude.NFData
    DisassociateWirelessDeviceFromThing

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

instance
  Core.ToPath
    DisassociateWirelessDeviceFromThing
  where
  toPath :: DisassociateWirelessDeviceFromThing -> ByteString
toPath DisassociateWirelessDeviceFromThing' {Text
id :: Text
$sel:id:DisassociateWirelessDeviceFromThing' :: DisassociateWirelessDeviceFromThing -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/wireless-devices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id, ByteString
"/thing"]

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

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

-- |
-- Create a value of 'DisassociateWirelessDeviceFromThingResponse' 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:
--
-- 'httpStatus', 'disassociateWirelessDeviceFromThingResponse_httpStatus' - The response's http status code.
newDisassociateWirelessDeviceFromThingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateWirelessDeviceFromThingResponse
newDisassociateWirelessDeviceFromThingResponse :: Int -> DisassociateWirelessDeviceFromThingResponse
newDisassociateWirelessDeviceFromThingResponse
  Int
pHttpStatus_ =
    DisassociateWirelessDeviceFromThingResponse' :: Int -> DisassociateWirelessDeviceFromThingResponse
DisassociateWirelessDeviceFromThingResponse'
      { $sel:httpStatus:DisassociateWirelessDeviceFromThingResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    DisassociateWirelessDeviceFromThingResponse