{-# 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.UpdateRoom
-- 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)
--
-- Updates room details by room ARN.
module Amazonka.AlexaBusiness.UpdateRoom
  ( -- * Creating a Request
    UpdateRoom (..),
    newUpdateRoom,

    -- * Request Lenses
    updateRoom_profileArn,
    updateRoom_providerCalendarId,
    updateRoom_roomArn,
    updateRoom_roomName,
    updateRoom_description,

    -- * Destructuring the Response
    UpdateRoomResponse (..),
    newUpdateRoomResponse,

    -- * Response Lenses
    updateRoomResponse_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:/ 'newUpdateRoom' smart constructor.
data UpdateRoom = UpdateRoom'
  { -- | The updated profile ARN for the room.
    UpdateRoom -> Maybe Text
profileArn :: Prelude.Maybe Prelude.Text,
    -- | The updated provider calendar ARN for the room.
    UpdateRoom -> Maybe Text
providerCalendarId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the room to update.
    UpdateRoom -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text,
    -- | The updated name for the room.
    UpdateRoom -> Maybe Text
roomName :: Prelude.Maybe Prelude.Text,
    -- | The updated description for the room.
    UpdateRoom -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateRoom -> UpdateRoom -> Bool
(UpdateRoom -> UpdateRoom -> Bool)
-> (UpdateRoom -> UpdateRoom -> Bool) -> Eq UpdateRoom
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateRoom -> UpdateRoom -> Bool
$c/= :: UpdateRoom -> UpdateRoom -> Bool
== :: UpdateRoom -> UpdateRoom -> Bool
$c== :: UpdateRoom -> UpdateRoom -> Bool
Prelude.Eq, ReadPrec [UpdateRoom]
ReadPrec UpdateRoom
Int -> ReadS UpdateRoom
ReadS [UpdateRoom]
(Int -> ReadS UpdateRoom)
-> ReadS [UpdateRoom]
-> ReadPrec UpdateRoom
-> ReadPrec [UpdateRoom]
-> Read UpdateRoom
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateRoom]
$creadListPrec :: ReadPrec [UpdateRoom]
readPrec :: ReadPrec UpdateRoom
$creadPrec :: ReadPrec UpdateRoom
readList :: ReadS [UpdateRoom]
$creadList :: ReadS [UpdateRoom]
readsPrec :: Int -> ReadS UpdateRoom
$creadsPrec :: Int -> ReadS UpdateRoom
Prelude.Read, Int -> UpdateRoom -> ShowS
[UpdateRoom] -> ShowS
UpdateRoom -> String
(Int -> UpdateRoom -> ShowS)
-> (UpdateRoom -> String)
-> ([UpdateRoom] -> ShowS)
-> Show UpdateRoom
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateRoom] -> ShowS
$cshowList :: [UpdateRoom] -> ShowS
show :: UpdateRoom -> String
$cshow :: UpdateRoom -> String
showsPrec :: Int -> UpdateRoom -> ShowS
$cshowsPrec :: Int -> UpdateRoom -> ShowS
Prelude.Show, (forall x. UpdateRoom -> Rep UpdateRoom x)
-> (forall x. Rep UpdateRoom x -> UpdateRoom) -> Generic UpdateRoom
forall x. Rep UpdateRoom x -> UpdateRoom
forall x. UpdateRoom -> Rep UpdateRoom x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateRoom x -> UpdateRoom
$cfrom :: forall x. UpdateRoom -> Rep UpdateRoom x
Prelude.Generic)

-- |
-- Create a value of 'UpdateRoom' 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:
--
-- 'profileArn', 'updateRoom_profileArn' - The updated profile ARN for the room.
--
-- 'providerCalendarId', 'updateRoom_providerCalendarId' - The updated provider calendar ARN for the room.
--
-- 'roomArn', 'updateRoom_roomArn' - The ARN of the room to update.
--
-- 'roomName', 'updateRoom_roomName' - The updated name for the room.
--
-- 'description', 'updateRoom_description' - The updated description for the room.
newUpdateRoom ::
  UpdateRoom
newUpdateRoom :: UpdateRoom
newUpdateRoom =
  UpdateRoom' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UpdateRoom
UpdateRoom'
    { $sel:profileArn:UpdateRoom' :: Maybe Text
profileArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:providerCalendarId:UpdateRoom' :: Maybe Text
providerCalendarId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roomArn:UpdateRoom' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roomName:UpdateRoom' :: Maybe Text
roomName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateRoom' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The updated profile ARN for the room.
updateRoom_profileArn :: Lens.Lens' UpdateRoom (Prelude.Maybe Prelude.Text)
updateRoom_profileArn :: (Maybe Text -> f (Maybe Text)) -> UpdateRoom -> f UpdateRoom
updateRoom_profileArn = (UpdateRoom -> Maybe Text)
-> (UpdateRoom -> Maybe Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Maybe Text
profileArn :: Maybe Text
$sel:profileArn:UpdateRoom' :: UpdateRoom -> Maybe Text
profileArn} -> Maybe Text
profileArn) (\s :: UpdateRoom
s@UpdateRoom' {} Maybe Text
a -> UpdateRoom
s {$sel:profileArn:UpdateRoom' :: Maybe Text
profileArn = Maybe Text
a} :: UpdateRoom)

-- | The updated provider calendar ARN for the room.
updateRoom_providerCalendarId :: Lens.Lens' UpdateRoom (Prelude.Maybe Prelude.Text)
updateRoom_providerCalendarId :: (Maybe Text -> f (Maybe Text)) -> UpdateRoom -> f UpdateRoom
updateRoom_providerCalendarId = (UpdateRoom -> Maybe Text)
-> (UpdateRoom -> Maybe Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Maybe Text
providerCalendarId :: Maybe Text
$sel:providerCalendarId:UpdateRoom' :: UpdateRoom -> Maybe Text
providerCalendarId} -> Maybe Text
providerCalendarId) (\s :: UpdateRoom
s@UpdateRoom' {} Maybe Text
a -> UpdateRoom
s {$sel:providerCalendarId:UpdateRoom' :: Maybe Text
providerCalendarId = Maybe Text
a} :: UpdateRoom)

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

-- | The updated name for the room.
updateRoom_roomName :: Lens.Lens' UpdateRoom (Prelude.Maybe Prelude.Text)
updateRoom_roomName :: (Maybe Text -> f (Maybe Text)) -> UpdateRoom -> f UpdateRoom
updateRoom_roomName = (UpdateRoom -> Maybe Text)
-> (UpdateRoom -> Maybe Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Maybe Text
roomName :: Maybe Text
$sel:roomName:UpdateRoom' :: UpdateRoom -> Maybe Text
roomName} -> Maybe Text
roomName) (\s :: UpdateRoom
s@UpdateRoom' {} Maybe Text
a -> UpdateRoom
s {$sel:roomName:UpdateRoom' :: Maybe Text
roomName = Maybe Text
a} :: UpdateRoom)

-- | The updated description for the room.
updateRoom_description :: Lens.Lens' UpdateRoom (Prelude.Maybe Prelude.Text)
updateRoom_description :: (Maybe Text -> f (Maybe Text)) -> UpdateRoom -> f UpdateRoom
updateRoom_description = (UpdateRoom -> Maybe Text)
-> (UpdateRoom -> Maybe Text -> UpdateRoom)
-> Lens UpdateRoom UpdateRoom (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateRoom' {Maybe Text
description :: Maybe Text
$sel:description:UpdateRoom' :: UpdateRoom -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateRoom
s@UpdateRoom' {} Maybe Text
a -> UpdateRoom
s {$sel:description:UpdateRoom' :: Maybe Text
description = Maybe Text
a} :: UpdateRoom)

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

instance Prelude.NFData UpdateRoom

instance Core.ToHeaders UpdateRoom where
  toHeaders :: UpdateRoom -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateRoom -> 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.UpdateRoom" ::
                          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 UpdateRoom where
  toJSON :: UpdateRoom -> Value
toJSON UpdateRoom' {Maybe Text
description :: Maybe Text
roomName :: Maybe Text
roomArn :: Maybe Text
providerCalendarId :: Maybe Text
profileArn :: Maybe Text
$sel:description:UpdateRoom' :: UpdateRoom -> Maybe Text
$sel:roomName:UpdateRoom' :: UpdateRoom -> Maybe Text
$sel:roomArn:UpdateRoom' :: UpdateRoom -> Maybe Text
$sel:providerCalendarId:UpdateRoom' :: UpdateRoom -> Maybe Text
$sel:profileArn:UpdateRoom' :: UpdateRoom -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ProfileArn" 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
profileArn,
            (Text
"ProviderCalendarId" 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
providerCalendarId,
            (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,
            (Text
"RoomName" 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
roomName,
            (Text
"Description" 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
description
          ]
      )

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

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

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

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

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

instance Prelude.NFData UpdateRoomResponse