{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
    { $sel:deviceArn:DisassociateDeviceFromRoom' :: Maybe Text
deviceArn =
        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 :: Lens' DisassociateDeviceFromRoom (Maybe Text)
disassociateDeviceFromRoom_deviceArn = 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 :: (Service -> Service)
-> DisassociateDeviceFromRoom -> Request DisassociateDeviceFromRoom
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisassociateDeviceFromRoom
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisassociateDeviceFromRoom)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateDeviceFromRoomResponse
DisassociateDeviceFromRoomResponse'
            forall (f :: * -> *) a b. Functor 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 DisassociateDeviceFromRoom where
  hashWithSalt :: Int -> DisassociateDeviceFromRoom -> Int
hashWithSalt Int
_salt DisassociateDeviceFromRoom' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:DisassociateDeviceFromRoom' :: DisassociateDeviceFromRoom -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deviceArn

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

instance Data.ToHeaders DisassociateDeviceFromRoom where
  toHeaders :: DisassociateDeviceFromRoom -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AlexaForBusiness.DisassociateDeviceFromRoom" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DisassociateDeviceFromRoom where
  toJSON :: DisassociateDeviceFromRoom -> Value
toJSON DisassociateDeviceFromRoom' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:DisassociateDeviceFromRoom' :: DisassociateDeviceFromRoom -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"DeviceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deviceArn]
      )

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

instance Data.ToQuery DisassociateDeviceFromRoom where
  toQuery :: DisassociateDeviceFromRoom -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DisassociateDeviceFromRoomResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
disassociateDeviceFromRoomResponse_httpStatus :: Lens.Lens' DisassociateDeviceFromRoomResponse Prelude.Int
disassociateDeviceFromRoomResponse_httpStatus :: Lens' DisassociateDeviceFromRoomResponse Int
disassociateDeviceFromRoomResponse_httpStatus = 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
  where
  rnf :: DisassociateDeviceFromRoomResponse -> ()
rnf DisassociateDeviceFromRoomResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateDeviceFromRoomResponse' :: DisassociateDeviceFromRoomResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus