{-# 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.MechanicalTurk.UpdateNotificationSettings
(
UpdateNotificationSettings (..),
newUpdateNotificationSettings,
updateNotificationSettings_notification,
updateNotificationSettings_active,
updateNotificationSettings_hITTypeId,
UpdateNotificationSettingsResponse (..),
newUpdateNotificationSettingsResponse,
updateNotificationSettingsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MechanicalTurk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateNotificationSettings = UpdateNotificationSettings'
{
UpdateNotificationSettings -> Maybe NotificationSpecification
notification :: Prelude.Maybe NotificationSpecification,
UpdateNotificationSettings -> Maybe Bool
active :: Prelude.Maybe Prelude.Bool,
UpdateNotificationSettings -> Text
hITTypeId :: Prelude.Text
}
deriving (UpdateNotificationSettings -> UpdateNotificationSettings -> Bool
(UpdateNotificationSettings -> UpdateNotificationSettings -> Bool)
-> (UpdateNotificationSettings
-> UpdateNotificationSettings -> Bool)
-> Eq UpdateNotificationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationSettings -> UpdateNotificationSettings -> Bool
$c/= :: UpdateNotificationSettings -> UpdateNotificationSettings -> Bool
== :: UpdateNotificationSettings -> UpdateNotificationSettings -> Bool
$c== :: UpdateNotificationSettings -> UpdateNotificationSettings -> Bool
Prelude.Eq, ReadPrec [UpdateNotificationSettings]
ReadPrec UpdateNotificationSettings
Int -> ReadS UpdateNotificationSettings
ReadS [UpdateNotificationSettings]
(Int -> ReadS UpdateNotificationSettings)
-> ReadS [UpdateNotificationSettings]
-> ReadPrec UpdateNotificationSettings
-> ReadPrec [UpdateNotificationSettings]
-> Read UpdateNotificationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotificationSettings]
$creadListPrec :: ReadPrec [UpdateNotificationSettings]
readPrec :: ReadPrec UpdateNotificationSettings
$creadPrec :: ReadPrec UpdateNotificationSettings
readList :: ReadS [UpdateNotificationSettings]
$creadList :: ReadS [UpdateNotificationSettings]
readsPrec :: Int -> ReadS UpdateNotificationSettings
$creadsPrec :: Int -> ReadS UpdateNotificationSettings
Prelude.Read, Int -> UpdateNotificationSettings -> ShowS
[UpdateNotificationSettings] -> ShowS
UpdateNotificationSettings -> String
(Int -> UpdateNotificationSettings -> ShowS)
-> (UpdateNotificationSettings -> String)
-> ([UpdateNotificationSettings] -> ShowS)
-> Show UpdateNotificationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationSettings] -> ShowS
$cshowList :: [UpdateNotificationSettings] -> ShowS
show :: UpdateNotificationSettings -> String
$cshow :: UpdateNotificationSettings -> String
showsPrec :: Int -> UpdateNotificationSettings -> ShowS
$cshowsPrec :: Int -> UpdateNotificationSettings -> ShowS
Prelude.Show, (forall x.
UpdateNotificationSettings -> Rep UpdateNotificationSettings x)
-> (forall x.
Rep UpdateNotificationSettings x -> UpdateNotificationSettings)
-> Generic UpdateNotificationSettings
forall x.
Rep UpdateNotificationSettings x -> UpdateNotificationSettings
forall x.
UpdateNotificationSettings -> Rep UpdateNotificationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNotificationSettings x -> UpdateNotificationSettings
$cfrom :: forall x.
UpdateNotificationSettings -> Rep UpdateNotificationSettings x
Prelude.Generic)
newUpdateNotificationSettings ::
Prelude.Text ->
UpdateNotificationSettings
newUpdateNotificationSettings :: Text -> UpdateNotificationSettings
newUpdateNotificationSettings Text
pHITTypeId_ =
UpdateNotificationSettings' :: Maybe NotificationSpecification
-> Maybe Bool -> Text -> UpdateNotificationSettings
UpdateNotificationSettings'
{ $sel:notification:UpdateNotificationSettings' :: Maybe NotificationSpecification
notification =
Maybe NotificationSpecification
forall a. Maybe a
Prelude.Nothing,
$sel:active:UpdateNotificationSettings' :: Maybe Bool
active = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:hITTypeId:UpdateNotificationSettings' :: Text
hITTypeId = Text
pHITTypeId_
}
updateNotificationSettings_notification :: Lens.Lens' UpdateNotificationSettings (Prelude.Maybe NotificationSpecification)
updateNotificationSettings_notification :: (Maybe NotificationSpecification
-> f (Maybe NotificationSpecification))
-> UpdateNotificationSettings -> f UpdateNotificationSettings
updateNotificationSettings_notification = (UpdateNotificationSettings -> Maybe NotificationSpecification)
-> (UpdateNotificationSettings
-> Maybe NotificationSpecification -> UpdateNotificationSettings)
-> Lens
UpdateNotificationSettings
UpdateNotificationSettings
(Maybe NotificationSpecification)
(Maybe NotificationSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationSettings' {Maybe NotificationSpecification
notification :: Maybe NotificationSpecification
$sel:notification:UpdateNotificationSettings' :: UpdateNotificationSettings -> Maybe NotificationSpecification
notification} -> Maybe NotificationSpecification
notification) (\s :: UpdateNotificationSettings
s@UpdateNotificationSettings' {} Maybe NotificationSpecification
a -> UpdateNotificationSettings
s {$sel:notification:UpdateNotificationSettings' :: Maybe NotificationSpecification
notification = Maybe NotificationSpecification
a} :: UpdateNotificationSettings)
updateNotificationSettings_active :: Lens.Lens' UpdateNotificationSettings (Prelude.Maybe Prelude.Bool)
updateNotificationSettings_active :: (Maybe Bool -> f (Maybe Bool))
-> UpdateNotificationSettings -> f UpdateNotificationSettings
updateNotificationSettings_active = (UpdateNotificationSettings -> Maybe Bool)
-> (UpdateNotificationSettings
-> Maybe Bool -> UpdateNotificationSettings)
-> Lens
UpdateNotificationSettings
UpdateNotificationSettings
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationSettings' {Maybe Bool
active :: Maybe Bool
$sel:active:UpdateNotificationSettings' :: UpdateNotificationSettings -> Maybe Bool
active} -> Maybe Bool
active) (\s :: UpdateNotificationSettings
s@UpdateNotificationSettings' {} Maybe Bool
a -> UpdateNotificationSettings
s {$sel:active:UpdateNotificationSettings' :: Maybe Bool
active = Maybe Bool
a} :: UpdateNotificationSettings)
updateNotificationSettings_hITTypeId :: Lens.Lens' UpdateNotificationSettings Prelude.Text
updateNotificationSettings_hITTypeId :: (Text -> f Text)
-> UpdateNotificationSettings -> f UpdateNotificationSettings
updateNotificationSettings_hITTypeId = (UpdateNotificationSettings -> Text)
-> (UpdateNotificationSettings
-> Text -> UpdateNotificationSettings)
-> Lens
UpdateNotificationSettings UpdateNotificationSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationSettings' {Text
hITTypeId :: Text
$sel:hITTypeId:UpdateNotificationSettings' :: UpdateNotificationSettings -> Text
hITTypeId} -> Text
hITTypeId) (\s :: UpdateNotificationSettings
s@UpdateNotificationSettings' {} Text
a -> UpdateNotificationSettings
s {$sel:hITTypeId:UpdateNotificationSettings' :: Text
hITTypeId = Text
a} :: UpdateNotificationSettings)
instance Core.AWSRequest UpdateNotificationSettings where
type
AWSResponse UpdateNotificationSettings =
UpdateNotificationSettingsResponse
request :: UpdateNotificationSettings -> Request UpdateNotificationSettings
request = Service
-> UpdateNotificationSettings -> Request UpdateNotificationSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateNotificationSettings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateNotificationSettings)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateNotificationSettings))
-> Logger
-> Service
-> Proxy UpdateNotificationSettings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateNotificationSettings)))
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 -> UpdateNotificationSettingsResponse
UpdateNotificationSettingsResponse'
(Int -> UpdateNotificationSettingsResponse)
-> Either String Int
-> Either String UpdateNotificationSettingsResponse
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 UpdateNotificationSettings
instance Prelude.NFData UpdateNotificationSettings
instance Core.ToHeaders UpdateNotificationSettings where
toHeaders :: UpdateNotificationSettings -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateNotificationSettings -> 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
"MTurkRequesterServiceV20170117.UpdateNotificationSettings" ::
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 UpdateNotificationSettings where
toJSON :: UpdateNotificationSettings -> Value
toJSON UpdateNotificationSettings' {Maybe Bool
Maybe NotificationSpecification
Text
hITTypeId :: Text
active :: Maybe Bool
notification :: Maybe NotificationSpecification
$sel:hITTypeId:UpdateNotificationSettings' :: UpdateNotificationSettings -> Text
$sel:active:UpdateNotificationSettings' :: UpdateNotificationSettings -> Maybe Bool
$sel:notification:UpdateNotificationSettings' :: UpdateNotificationSettings -> Maybe NotificationSpecification
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Notification" Text -> NotificationSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NotificationSpecification -> Pair)
-> Maybe NotificationSpecification -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationSpecification
notification,
(Text
"Active" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
active,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HITTypeId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hITTypeId)
]
)
instance Core.ToPath UpdateNotificationSettings where
toPath :: UpdateNotificationSettings -> ByteString
toPath = ByteString -> UpdateNotificationSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateNotificationSettings where
toQuery :: UpdateNotificationSettings -> QueryString
toQuery = QueryString -> UpdateNotificationSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateNotificationSettingsResponse = UpdateNotificationSettingsResponse'
{
UpdateNotificationSettingsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool
(UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool)
-> (UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool)
-> Eq UpdateNotificationSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool
$c/= :: UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool
== :: UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool
$c== :: UpdateNotificationSettingsResponse
-> UpdateNotificationSettingsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateNotificationSettingsResponse]
ReadPrec UpdateNotificationSettingsResponse
Int -> ReadS UpdateNotificationSettingsResponse
ReadS [UpdateNotificationSettingsResponse]
(Int -> ReadS UpdateNotificationSettingsResponse)
-> ReadS [UpdateNotificationSettingsResponse]
-> ReadPrec UpdateNotificationSettingsResponse
-> ReadPrec [UpdateNotificationSettingsResponse]
-> Read UpdateNotificationSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNotificationSettingsResponse]
$creadListPrec :: ReadPrec [UpdateNotificationSettingsResponse]
readPrec :: ReadPrec UpdateNotificationSettingsResponse
$creadPrec :: ReadPrec UpdateNotificationSettingsResponse
readList :: ReadS [UpdateNotificationSettingsResponse]
$creadList :: ReadS [UpdateNotificationSettingsResponse]
readsPrec :: Int -> ReadS UpdateNotificationSettingsResponse
$creadsPrec :: Int -> ReadS UpdateNotificationSettingsResponse
Prelude.Read, Int -> UpdateNotificationSettingsResponse -> ShowS
[UpdateNotificationSettingsResponse] -> ShowS
UpdateNotificationSettingsResponse -> String
(Int -> UpdateNotificationSettingsResponse -> ShowS)
-> (UpdateNotificationSettingsResponse -> String)
-> ([UpdateNotificationSettingsResponse] -> ShowS)
-> Show UpdateNotificationSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNotificationSettingsResponse] -> ShowS
$cshowList :: [UpdateNotificationSettingsResponse] -> ShowS
show :: UpdateNotificationSettingsResponse -> String
$cshow :: UpdateNotificationSettingsResponse -> String
showsPrec :: Int -> UpdateNotificationSettingsResponse -> ShowS
$cshowsPrec :: Int -> UpdateNotificationSettingsResponse -> ShowS
Prelude.Show, (forall x.
UpdateNotificationSettingsResponse
-> Rep UpdateNotificationSettingsResponse x)
-> (forall x.
Rep UpdateNotificationSettingsResponse x
-> UpdateNotificationSettingsResponse)
-> Generic UpdateNotificationSettingsResponse
forall x.
Rep UpdateNotificationSettingsResponse x
-> UpdateNotificationSettingsResponse
forall x.
UpdateNotificationSettingsResponse
-> Rep UpdateNotificationSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNotificationSettingsResponse x
-> UpdateNotificationSettingsResponse
$cfrom :: forall x.
UpdateNotificationSettingsResponse
-> Rep UpdateNotificationSettingsResponse x
Prelude.Generic)
newUpdateNotificationSettingsResponse ::
Prelude.Int ->
UpdateNotificationSettingsResponse
newUpdateNotificationSettingsResponse :: Int -> UpdateNotificationSettingsResponse
newUpdateNotificationSettingsResponse Int
pHttpStatus_ =
UpdateNotificationSettingsResponse' :: Int -> UpdateNotificationSettingsResponse
UpdateNotificationSettingsResponse'
{ $sel:httpStatus:UpdateNotificationSettingsResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateNotificationSettingsResponse_httpStatus :: Lens.Lens' UpdateNotificationSettingsResponse Prelude.Int
updateNotificationSettingsResponse_httpStatus :: (Int -> f Int)
-> UpdateNotificationSettingsResponse
-> f UpdateNotificationSettingsResponse
updateNotificationSettingsResponse_httpStatus = (UpdateNotificationSettingsResponse -> Int)
-> (UpdateNotificationSettingsResponse
-> Int -> UpdateNotificationSettingsResponse)
-> Lens
UpdateNotificationSettingsResponse
UpdateNotificationSettingsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNotificationSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateNotificationSettingsResponse' :: UpdateNotificationSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateNotificationSettingsResponse
s@UpdateNotificationSettingsResponse' {} Int
a -> UpdateNotificationSettingsResponse
s {$sel:httpStatus:UpdateNotificationSettingsResponse' :: Int
httpStatus = Int
a} :: UpdateNotificationSettingsResponse)
instance
Prelude.NFData
UpdateNotificationSettingsResponse