{-# 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.AlexaBusiness.DisassociateDeviceFromRoom
-- 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 device from its current room. The device continues to be
-- connected to the Wi-Fi network and is still registered to the account.
-- The device settings and skills are removed from the room.
module Amazonka.AlexaBusiness.DisassociateDeviceFromRoom
  ( -- * Creating a Request
    DisassociateDeviceFromRoom (..),
    newDisassociateDeviceFromRoom,

    -- * Request Lenses
    disassociateDeviceFromRoom_deviceArn,

    -- * Destructuring the Response
    DisassociateDeviceFromRoomResponse (..),
    newDisassociateDeviceFromRoomResponse,

    -- * Response Lenses
    disassociateDeviceFromRoomResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
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:/ 'newDisassociateDeviceFromRoom' smart constructor.
data DisassociateDeviceFromRoom = DisassociateDeviceFromRoom'
  { -- | The ARN of the device to disassociate from a room. Required.
    DisassociateDeviceFromRoom -> Maybe Text
deviceArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool
(DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool)
-> (DisassociateDeviceFromRoom
    -> DisassociateDeviceFromRoom -> Bool)
-> Eq DisassociateDeviceFromRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool
$c/= :: DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool
== :: DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool
$c== :: DisassociateDeviceFromRoom -> DisassociateDeviceFromRoom -> Bool
Prelude.Eq, ReadPrec [DisassociateDeviceFromRoom]
ReadPrec DisassociateDeviceFromRoom
Int -> ReadS DisassociateDeviceFromRoom
ReadS [DisassociateDeviceFromRoom]
(Int -> ReadS DisassociateDeviceFromRoom)
-> ReadS [DisassociateDeviceFromRoom]
-> ReadPrec DisassociateDeviceFromRoom
-> ReadPrec [DisassociateDeviceFromRoom]
-> Read DisassociateDeviceFromRoom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateDeviceFromRoom]
$creadListPrec :: ReadPrec [DisassociateDeviceFromRoom]
readPrec :: ReadPrec DisassociateDeviceFromRoom
$creadPrec :: ReadPrec DisassociateDeviceFromRoom
readList :: ReadS [DisassociateDeviceFromRoom]
$creadList :: ReadS [DisassociateDeviceFromRoom]
readsPrec :: Int -> ReadS DisassociateDeviceFromRoom
$creadsPrec :: Int -> ReadS DisassociateDeviceFromRoom
Prelude.Read, Int -> DisassociateDeviceFromRoom -> ShowS
[DisassociateDeviceFromRoom] -> ShowS
DisassociateDeviceFromRoom -> String
(Int -> DisassociateDeviceFromRoom -> ShowS)
-> (DisassociateDeviceFromRoom -> String)
-> ([DisassociateDeviceFromRoom] -> ShowS)
-> Show DisassociateDeviceFromRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateDeviceFromRoom] -> ShowS
$cshowList :: [DisassociateDeviceFromRoom] -> ShowS
show :: DisassociateDeviceFromRoom -> String
$cshow :: DisassociateDeviceFromRoom -> String
showsPrec :: Int -> DisassociateDeviceFromRoom -> ShowS
$cshowsPrec :: Int -> DisassociateDeviceFromRoom -> ShowS
Prelude.Show, (forall x.
 DisassociateDeviceFromRoom -> Rep DisassociateDeviceFromRoom x)
-> (forall x.
    Rep DisassociateDeviceFromRoom x -> DisassociateDeviceFromRoom)
-> Generic DisassociateDeviceFromRoom
forall x.
Rep DisassociateDeviceFromRoom x -> DisassociateDeviceFromRoom
forall x.
DisassociateDeviceFromRoom -> Rep DisassociateDeviceFromRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateDeviceFromRoom x -> DisassociateDeviceFromRoom
$cfrom :: forall x.
DisassociateDeviceFromRoom -> Rep DisassociateDeviceFromRoom x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateDeviceFromRoom' 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:
--
-- 'deviceArn', 'disassociateDeviceFromRoom_deviceArn' - The ARN of the device to disassociate from a room. Required.
newDisassociateDeviceFromRoom ::
  DisassociateDeviceFromRoom
newDisassociateDeviceFromRoom :: DisassociateDeviceFromRoom
newDisassociateDeviceFromRoom =
  DisassociateDeviceFromRoom' :: Maybe Text -> DisassociateDeviceFromRoom
DisassociateDeviceFromRoom'
    { $sel:deviceArn:DisassociateDeviceFromRoom' :: Maybe Text
deviceArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the device to disassociate from a room. Required.
disassociateDeviceFromRoom_deviceArn :: Lens.Lens' DisassociateDeviceFromRoom (Prelude.Maybe Prelude.Text)
disassociateDeviceFromRoom_deviceArn :: (Maybe Text -> f (Maybe Text))
-> DisassociateDeviceFromRoom -> f DisassociateDeviceFromRoom
disassociateDeviceFromRoom_deviceArn = (DisassociateDeviceFromRoom -> Maybe Text)
-> (DisassociateDeviceFromRoom
    -> Maybe Text -> DisassociateDeviceFromRoom)
-> Lens
     DisassociateDeviceFromRoom
     DisassociateDeviceFromRoom
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateDeviceFromRoom' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:DisassociateDeviceFromRoom' :: DisassociateDeviceFromRoom -> Maybe Text
deviceArn} -> Maybe Text
deviceArn) (\s :: DisassociateDeviceFromRoom
s@DisassociateDeviceFromRoom' {} Maybe Text
a -> DisassociateDeviceFromRoom
s {$sel:deviceArn:DisassociateDeviceFromRoom' :: Maybe Text
deviceArn = Maybe Text
a} :: DisassociateDeviceFromRoom)

instance Core.AWSRequest DisassociateDeviceFromRoom where
  type
    AWSResponse DisassociateDeviceFromRoom =
      DisassociateDeviceFromRoomResponse
  request :: DisassociateDeviceFromRoom -> Request DisassociateDeviceFromRoom
request = Service
-> DisassociateDeviceFromRoom -> Request DisassociateDeviceFromRoom
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisassociateDeviceFromRoom
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateDeviceFromRoom)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisassociateDeviceFromRoom))
-> Logger
-> Service
-> Proxy DisassociateDeviceFromRoom
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateDeviceFromRoom)))
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 -> DisassociateDeviceFromRoomResponse
DisassociateDeviceFromRoomResponse'
            (Int -> DisassociateDeviceFromRoomResponse)
-> Either String Int
-> Either String DisassociateDeviceFromRoomResponse
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 DisassociateDeviceFromRoom

instance Prelude.NFData DisassociateDeviceFromRoom

instance Core.ToHeaders DisassociateDeviceFromRoom where
  toHeaders :: DisassociateDeviceFromRoom -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisassociateDeviceFromRoom -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.DisassociateDeviceFromRoom" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DisassociateDeviceFromRoom where
  toJSON :: DisassociateDeviceFromRoom -> Value
toJSON DisassociateDeviceFromRoom' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:DisassociateDeviceFromRoom' :: DisassociateDeviceFromRoom -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"DeviceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deviceArn]
      )

instance Core.ToPath DisassociateDeviceFromRoom where
  toPath :: DisassociateDeviceFromRoom -> ByteString
toPath = ByteString -> DisassociateDeviceFromRoom -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance
  Prelude.NFData
    DisassociateDeviceFromRoomResponse