{-# 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 #-}
module Amazonka.WorkMail.UpdateResource
(
UpdateResource (..),
newUpdateResource,
updateResource_name,
updateResource_bookingOptions,
updateResource_organizationId,
updateResource_resourceId,
UpdateResourceResponse (..),
newUpdateResourceResponse,
updateResourceResponse_httpStatus,
)
where
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
import Amazonka.WorkMail.Types
data UpdateResource = UpdateResource'
{
UpdateResource -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateResource -> Maybe BookingOptions
bookingOptions :: Prelude.Maybe BookingOptions,
UpdateResource -> Text
organizationId :: Prelude.Text,
UpdateResource -> Text
resourceId :: Prelude.Text
}
deriving (UpdateResource -> UpdateResource -> Bool
(UpdateResource -> UpdateResource -> Bool)
-> (UpdateResource -> UpdateResource -> Bool) -> Eq UpdateResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResource -> UpdateResource -> Bool
$c/= :: UpdateResource -> UpdateResource -> Bool
== :: UpdateResource -> UpdateResource -> Bool
$c== :: UpdateResource -> UpdateResource -> Bool
Prelude.Eq, ReadPrec [UpdateResource]
ReadPrec UpdateResource
Int -> ReadS UpdateResource
ReadS [UpdateResource]
(Int -> ReadS UpdateResource)
-> ReadS [UpdateResource]
-> ReadPrec UpdateResource
-> ReadPrec [UpdateResource]
-> Read UpdateResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResource]
$creadListPrec :: ReadPrec [UpdateResource]
readPrec :: ReadPrec UpdateResource
$creadPrec :: ReadPrec UpdateResource
readList :: ReadS [UpdateResource]
$creadList :: ReadS [UpdateResource]
readsPrec :: Int -> ReadS UpdateResource
$creadsPrec :: Int -> ReadS UpdateResource
Prelude.Read, Int -> UpdateResource -> ShowS
[UpdateResource] -> ShowS
UpdateResource -> String
(Int -> UpdateResource -> ShowS)
-> (UpdateResource -> String)
-> ([UpdateResource] -> ShowS)
-> Show UpdateResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResource] -> ShowS
$cshowList :: [UpdateResource] -> ShowS
show :: UpdateResource -> String
$cshow :: UpdateResource -> String
showsPrec :: Int -> UpdateResource -> ShowS
$cshowsPrec :: Int -> UpdateResource -> ShowS
Prelude.Show, (forall x. UpdateResource -> Rep UpdateResource x)
-> (forall x. Rep UpdateResource x -> UpdateResource)
-> Generic UpdateResource
forall x. Rep UpdateResource x -> UpdateResource
forall x. UpdateResource -> Rep UpdateResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResource x -> UpdateResource
$cfrom :: forall x. UpdateResource -> Rep UpdateResource x
Prelude.Generic)
newUpdateResource ::
Prelude.Text ->
Prelude.Text ->
UpdateResource
newUpdateResource :: Text -> Text -> UpdateResource
newUpdateResource Text
pOrganizationId_ Text
pResourceId_ =
UpdateResource' :: Maybe Text
-> Maybe BookingOptions -> Text -> Text -> UpdateResource
UpdateResource'
{ $sel:name:UpdateResource' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bookingOptions:UpdateResource' :: Maybe BookingOptions
bookingOptions = Maybe BookingOptions
forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:UpdateResource' :: Text
organizationId = Text
pOrganizationId_,
$sel:resourceId:UpdateResource' :: Text
resourceId = Text
pResourceId_
}
updateResource_name :: Lens.Lens' UpdateResource (Prelude.Maybe Prelude.Text)
updateResource_name :: (Maybe Text -> f (Maybe Text))
-> UpdateResource -> f UpdateResource
updateResource_name = (UpdateResource -> Maybe Text)
-> (UpdateResource -> Maybe Text -> UpdateResource)
-> Lens UpdateResource UpdateResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Maybe Text
name :: Maybe Text
$sel:name:UpdateResource' :: UpdateResource -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateResource
s@UpdateResource' {} Maybe Text
a -> UpdateResource
s {$sel:name:UpdateResource' :: Maybe Text
name = Maybe Text
a} :: UpdateResource)
updateResource_bookingOptions :: Lens.Lens' UpdateResource (Prelude.Maybe BookingOptions)
updateResource_bookingOptions :: (Maybe BookingOptions -> f (Maybe BookingOptions))
-> UpdateResource -> f UpdateResource
updateResource_bookingOptions = (UpdateResource -> Maybe BookingOptions)
-> (UpdateResource -> Maybe BookingOptions -> UpdateResource)
-> Lens
UpdateResource
UpdateResource
(Maybe BookingOptions)
(Maybe BookingOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Maybe BookingOptions
bookingOptions :: Maybe BookingOptions
$sel:bookingOptions:UpdateResource' :: UpdateResource -> Maybe BookingOptions
bookingOptions} -> Maybe BookingOptions
bookingOptions) (\s :: UpdateResource
s@UpdateResource' {} Maybe BookingOptions
a -> UpdateResource
s {$sel:bookingOptions:UpdateResource' :: Maybe BookingOptions
bookingOptions = Maybe BookingOptions
a} :: UpdateResource)
updateResource_organizationId :: Lens.Lens' UpdateResource Prelude.Text
updateResource_organizationId :: (Text -> f Text) -> UpdateResource -> f UpdateResource
updateResource_organizationId = (UpdateResource -> Text)
-> (UpdateResource -> Text -> UpdateResource)
-> Lens UpdateResource UpdateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Text
organizationId :: Text
$sel:organizationId:UpdateResource' :: UpdateResource -> Text
organizationId} -> Text
organizationId) (\s :: UpdateResource
s@UpdateResource' {} Text
a -> UpdateResource
s {$sel:organizationId:UpdateResource' :: Text
organizationId = Text
a} :: UpdateResource)
updateResource_resourceId :: Lens.Lens' UpdateResource Prelude.Text
updateResource_resourceId :: (Text -> f Text) -> UpdateResource -> f UpdateResource
updateResource_resourceId = (UpdateResource -> Text)
-> (UpdateResource -> Text -> UpdateResource)
-> Lens UpdateResource UpdateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResource' {Text
resourceId :: Text
$sel:resourceId:UpdateResource' :: UpdateResource -> Text
resourceId} -> Text
resourceId) (\s :: UpdateResource
s@UpdateResource' {} Text
a -> UpdateResource
s {$sel:resourceId:UpdateResource' :: Text
resourceId = Text
a} :: UpdateResource)
instance Core.AWSRequest UpdateResource where
type
AWSResponse UpdateResource =
UpdateResourceResponse
request :: UpdateResource -> Request UpdateResource
request = Service -> UpdateResource -> Request UpdateResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateResource)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateResource))
-> Logger
-> Service
-> Proxy UpdateResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateResource)))
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 -> UpdateResourceResponse
UpdateResourceResponse'
(Int -> UpdateResourceResponse)
-> Either String Int -> Either String UpdateResourceResponse
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 UpdateResource
instance Prelude.NFData UpdateResource
instance Core.ToHeaders UpdateResource where
toHeaders :: UpdateResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateResource -> 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
"WorkMailService.UpdateResource" ::
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 UpdateResource where
toJSON :: UpdateResource -> Value
toJSON UpdateResource' {Maybe Text
Maybe BookingOptions
Text
resourceId :: Text
organizationId :: Text
bookingOptions :: Maybe BookingOptions
name :: Maybe Text
$sel:resourceId:UpdateResource' :: UpdateResource -> Text
$sel:organizationId:UpdateResource' :: UpdateResource -> Text
$sel:bookingOptions:UpdateResource' :: UpdateResource -> Maybe BookingOptions
$sel:name:UpdateResource' :: UpdateResource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Name" 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
name,
(Text
"BookingOptions" Text -> BookingOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(BookingOptions -> Pair) -> Maybe BookingOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BookingOptions
bookingOptions,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
]
)
instance Core.ToPath UpdateResource where
toPath :: UpdateResource -> ByteString
toPath = ByteString -> UpdateResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateResource where
toQuery :: UpdateResource -> QueryString
toQuery = QueryString -> UpdateResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateResourceResponse = UpdateResourceResponse'
{
UpdateResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateResourceResponse -> UpdateResourceResponse -> Bool
(UpdateResourceResponse -> UpdateResourceResponse -> Bool)
-> (UpdateResourceResponse -> UpdateResourceResponse -> Bool)
-> Eq UpdateResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
$c/= :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
== :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
$c== :: UpdateResourceResponse -> UpdateResourceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateResourceResponse]
ReadPrec UpdateResourceResponse
Int -> ReadS UpdateResourceResponse
ReadS [UpdateResourceResponse]
(Int -> ReadS UpdateResourceResponse)
-> ReadS [UpdateResourceResponse]
-> ReadPrec UpdateResourceResponse
-> ReadPrec [UpdateResourceResponse]
-> Read UpdateResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResourceResponse]
$creadListPrec :: ReadPrec [UpdateResourceResponse]
readPrec :: ReadPrec UpdateResourceResponse
$creadPrec :: ReadPrec UpdateResourceResponse
readList :: ReadS [UpdateResourceResponse]
$creadList :: ReadS [UpdateResourceResponse]
readsPrec :: Int -> ReadS UpdateResourceResponse
$creadsPrec :: Int -> ReadS UpdateResourceResponse
Prelude.Read, Int -> UpdateResourceResponse -> ShowS
[UpdateResourceResponse] -> ShowS
UpdateResourceResponse -> String
(Int -> UpdateResourceResponse -> ShowS)
-> (UpdateResourceResponse -> String)
-> ([UpdateResourceResponse] -> ShowS)
-> Show UpdateResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResourceResponse] -> ShowS
$cshowList :: [UpdateResourceResponse] -> ShowS
show :: UpdateResourceResponse -> String
$cshow :: UpdateResourceResponse -> String
showsPrec :: Int -> UpdateResourceResponse -> ShowS
$cshowsPrec :: Int -> UpdateResourceResponse -> ShowS
Prelude.Show, (forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x)
-> (forall x.
Rep UpdateResourceResponse x -> UpdateResourceResponse)
-> Generic UpdateResourceResponse
forall x. Rep UpdateResourceResponse x -> UpdateResourceResponse
forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResourceResponse x -> UpdateResourceResponse
$cfrom :: forall x. UpdateResourceResponse -> Rep UpdateResourceResponse x
Prelude.Generic)
newUpdateResourceResponse ::
Prelude.Int ->
UpdateResourceResponse
newUpdateResourceResponse :: Int -> UpdateResourceResponse
newUpdateResourceResponse Int
pHttpStatus_ =
UpdateResourceResponse' :: Int -> UpdateResourceResponse
UpdateResourceResponse' {$sel:httpStatus:UpdateResourceResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateResourceResponse_httpStatus :: Lens.Lens' UpdateResourceResponse Prelude.Int
updateResourceResponse_httpStatus :: (Int -> f Int)
-> UpdateResourceResponse -> f UpdateResourceResponse
updateResourceResponse_httpStatus = (UpdateResourceResponse -> Int)
-> (UpdateResourceResponse -> Int -> UpdateResourceResponse)
-> Lens UpdateResourceResponse UpdateResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateResourceResponse' :: UpdateResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateResourceResponse
s@UpdateResourceResponse' {} Int
a -> UpdateResourceResponse
s {$sel:httpStatus:UpdateResourceResponse' :: Int
httpStatus = Int
a} :: UpdateResourceResponse)
instance Prelude.NFData UpdateResourceResponse