{-# 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.DeleteRoom
-- 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 room by the room ARN.
module Amazonka.AlexaBusiness.DeleteRoom
  ( -- * Creating a Request
    DeleteRoom (..),
    newDeleteRoom,

    -- * Request Lenses
    deleteRoom_roomArn,

    -- * Destructuring the Response
    DeleteRoomResponse (..),
    newDeleteRoomResponse,

    -- * Response Lenses
    deleteRoomResponse_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:/ 'newDeleteRoom' smart constructor.
data DeleteRoom = DeleteRoom'
  { -- | The ARN of the room to delete. Required.
    DeleteRoom -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text
  }
  deriving (DeleteRoom -> DeleteRoom -> Bool
(DeleteRoom -> DeleteRoom -> Bool)
-> (DeleteRoom -> DeleteRoom -> Bool) -> Eq DeleteRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRoom -> DeleteRoom -> Bool
$c/= :: DeleteRoom -> DeleteRoom -> Bool
== :: DeleteRoom -> DeleteRoom -> Bool
$c== :: DeleteRoom -> DeleteRoom -> Bool
Prelude.Eq, ReadPrec [DeleteRoom]
ReadPrec DeleteRoom
Int -> ReadS DeleteRoom
ReadS [DeleteRoom]
(Int -> ReadS DeleteRoom)
-> ReadS [DeleteRoom]
-> ReadPrec DeleteRoom
-> ReadPrec [DeleteRoom]
-> Read DeleteRoom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRoom]
$creadListPrec :: ReadPrec [DeleteRoom]
readPrec :: ReadPrec DeleteRoom
$creadPrec :: ReadPrec DeleteRoom
readList :: ReadS [DeleteRoom]
$creadList :: ReadS [DeleteRoom]
readsPrec :: Int -> ReadS DeleteRoom
$creadsPrec :: Int -> ReadS DeleteRoom
Prelude.Read, Int -> DeleteRoom -> ShowS
[DeleteRoom] -> ShowS
DeleteRoom -> String
(Int -> DeleteRoom -> ShowS)
-> (DeleteRoom -> String)
-> ([DeleteRoom] -> ShowS)
-> Show DeleteRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRoom] -> ShowS
$cshowList :: [DeleteRoom] -> ShowS
show :: DeleteRoom -> String
$cshow :: DeleteRoom -> String
showsPrec :: Int -> DeleteRoom -> ShowS
$cshowsPrec :: Int -> DeleteRoom -> ShowS
Prelude.Show, (forall x. DeleteRoom -> Rep DeleteRoom x)
-> (forall x. Rep DeleteRoom x -> DeleteRoom) -> Generic DeleteRoom
forall x. Rep DeleteRoom x -> DeleteRoom
forall x. DeleteRoom -> Rep DeleteRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRoom x -> DeleteRoom
$cfrom :: forall x. DeleteRoom -> Rep DeleteRoom x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRoom' 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:
--
-- 'roomArn', 'deleteRoom_roomArn' - The ARN of the room to delete. Required.
newDeleteRoom ::
  DeleteRoom
newDeleteRoom :: DeleteRoom
newDeleteRoom =
  DeleteRoom' :: Maybe Text -> DeleteRoom
DeleteRoom' {$sel:roomArn:DeleteRoom' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The ARN of the room to delete. Required.
deleteRoom_roomArn :: Lens.Lens' DeleteRoom (Prelude.Maybe Prelude.Text)
deleteRoom_roomArn :: (Maybe Text -> f (Maybe Text)) -> DeleteRoom -> f DeleteRoom
deleteRoom_roomArn = (DeleteRoom -> Maybe Text)
-> (DeleteRoom -> Maybe Text -> DeleteRoom)
-> Lens DeleteRoom DeleteRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRoom' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:DeleteRoom' :: DeleteRoom -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: DeleteRoom
s@DeleteRoom' {} Maybe Text
a -> DeleteRoom
s {$sel:roomArn:DeleteRoom' :: Maybe Text
roomArn = Maybe Text
a} :: DeleteRoom)

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

instance Prelude.NFData DeleteRoom

instance Core.ToHeaders DeleteRoom where
  toHeaders :: DeleteRoom -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRoom -> 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.DeleteRoom" ::
                          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 DeleteRoom where
  toJSON :: DeleteRoom -> Value
toJSON DeleteRoom' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:DeleteRoom' :: DeleteRoom -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"RoomArn" 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
roomArn]
      )

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

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

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

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

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

instance Prelude.NFData DeleteRoomResponse