{-# 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.CreateWorkerBlock
(
CreateWorkerBlock (..),
newCreateWorkerBlock,
createWorkerBlock_workerId,
createWorkerBlock_reason,
CreateWorkerBlockResponse (..),
newCreateWorkerBlockResponse,
createWorkerBlockResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MechanicalTurk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateWorkerBlock = CreateWorkerBlock'
{
CreateWorkerBlock -> Text
workerId :: Prelude.Text,
CreateWorkerBlock -> Text
reason :: Prelude.Text
}
deriving (CreateWorkerBlock -> CreateWorkerBlock -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkerBlock -> CreateWorkerBlock -> Bool
$c/= :: CreateWorkerBlock -> CreateWorkerBlock -> Bool
== :: CreateWorkerBlock -> CreateWorkerBlock -> Bool
$c== :: CreateWorkerBlock -> CreateWorkerBlock -> Bool
Prelude.Eq, ReadPrec [CreateWorkerBlock]
ReadPrec CreateWorkerBlock
Int -> ReadS CreateWorkerBlock
ReadS [CreateWorkerBlock]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateWorkerBlock]
$creadListPrec :: ReadPrec [CreateWorkerBlock]
readPrec :: ReadPrec CreateWorkerBlock
$creadPrec :: ReadPrec CreateWorkerBlock
readList :: ReadS [CreateWorkerBlock]
$creadList :: ReadS [CreateWorkerBlock]
readsPrec :: Int -> ReadS CreateWorkerBlock
$creadsPrec :: Int -> ReadS CreateWorkerBlock
Prelude.Read, Int -> CreateWorkerBlock -> ShowS
[CreateWorkerBlock] -> ShowS
CreateWorkerBlock -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkerBlock] -> ShowS
$cshowList :: [CreateWorkerBlock] -> ShowS
show :: CreateWorkerBlock -> String
$cshow :: CreateWorkerBlock -> String
showsPrec :: Int -> CreateWorkerBlock -> ShowS
$cshowsPrec :: Int -> CreateWorkerBlock -> ShowS
Prelude.Show, forall x. Rep CreateWorkerBlock x -> CreateWorkerBlock
forall x. CreateWorkerBlock -> Rep CreateWorkerBlock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkerBlock x -> CreateWorkerBlock
$cfrom :: forall x. CreateWorkerBlock -> Rep CreateWorkerBlock x
Prelude.Generic)
newCreateWorkerBlock ::
Prelude.Text ->
Prelude.Text ->
CreateWorkerBlock
newCreateWorkerBlock :: Text -> Text -> CreateWorkerBlock
newCreateWorkerBlock Text
pWorkerId_ Text
pReason_ =
CreateWorkerBlock'
{ $sel:workerId:CreateWorkerBlock' :: Text
workerId = Text
pWorkerId_,
$sel:reason:CreateWorkerBlock' :: Text
reason = Text
pReason_
}
createWorkerBlock_workerId :: Lens.Lens' CreateWorkerBlock Prelude.Text
createWorkerBlock_workerId :: Lens' CreateWorkerBlock Text
createWorkerBlock_workerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkerBlock' {Text
workerId :: Text
$sel:workerId:CreateWorkerBlock' :: CreateWorkerBlock -> Text
workerId} -> Text
workerId) (\s :: CreateWorkerBlock
s@CreateWorkerBlock' {} Text
a -> CreateWorkerBlock
s {$sel:workerId:CreateWorkerBlock' :: Text
workerId = Text
a} :: CreateWorkerBlock)
createWorkerBlock_reason :: Lens.Lens' CreateWorkerBlock Prelude.Text
createWorkerBlock_reason :: Lens' CreateWorkerBlock Text
createWorkerBlock_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkerBlock' {Text
reason :: Text
$sel:reason:CreateWorkerBlock' :: CreateWorkerBlock -> Text
reason} -> Text
reason) (\s :: CreateWorkerBlock
s@CreateWorkerBlock' {} Text
a -> CreateWorkerBlock
s {$sel:reason:CreateWorkerBlock' :: Text
reason = Text
a} :: CreateWorkerBlock)
instance Core.AWSRequest CreateWorkerBlock where
type
AWSResponse CreateWorkerBlock =
CreateWorkerBlockResponse
request :: (Service -> Service)
-> CreateWorkerBlock -> Request CreateWorkerBlock
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 CreateWorkerBlock
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateWorkerBlock)))
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 -> CreateWorkerBlockResponse
CreateWorkerBlockResponse'
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 CreateWorkerBlock where
hashWithSalt :: Int -> CreateWorkerBlock -> Int
hashWithSalt Int
_salt CreateWorkerBlock' {Text
reason :: Text
workerId :: Text
$sel:reason:CreateWorkerBlock' :: CreateWorkerBlock -> Text
$sel:workerId:CreateWorkerBlock' :: CreateWorkerBlock -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workerId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
reason
instance Prelude.NFData CreateWorkerBlock where
rnf :: CreateWorkerBlock -> ()
rnf CreateWorkerBlock' {Text
reason :: Text
workerId :: Text
$sel:reason:CreateWorkerBlock' :: CreateWorkerBlock -> Text
$sel:workerId:CreateWorkerBlock' :: CreateWorkerBlock -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
workerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
reason
instance Data.ToHeaders CreateWorkerBlock where
toHeaders :: CreateWorkerBlock -> 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
"MTurkRequesterServiceV20170117.CreateWorkerBlock" ::
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 CreateWorkerBlock where
toJSON :: CreateWorkerBlock -> Value
toJSON CreateWorkerBlock' {Text
reason :: Text
workerId :: Text
$sel:reason:CreateWorkerBlock' :: CreateWorkerBlock -> Text
$sel:workerId:CreateWorkerBlock' :: CreateWorkerBlock -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"WorkerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workerId),
forall a. a -> Maybe a
Prelude.Just (Key
"Reason" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
reason)
]
)
instance Data.ToPath CreateWorkerBlock where
toPath :: CreateWorkerBlock -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateWorkerBlock where
toQuery :: CreateWorkerBlock -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateWorkerBlockResponse = CreateWorkerBlockResponse'
{
CreateWorkerBlockResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateWorkerBlockResponse -> CreateWorkerBlockResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkerBlockResponse -> CreateWorkerBlockResponse -> Bool
$c/= :: CreateWorkerBlockResponse -> CreateWorkerBlockResponse -> Bool
== :: CreateWorkerBlockResponse -> CreateWorkerBlockResponse -> Bool
$c== :: CreateWorkerBlockResponse -> CreateWorkerBlockResponse -> Bool
Prelude.Eq, ReadPrec [CreateWorkerBlockResponse]
ReadPrec CreateWorkerBlockResponse
Int -> ReadS CreateWorkerBlockResponse
ReadS [CreateWorkerBlockResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateWorkerBlockResponse]
$creadListPrec :: ReadPrec [CreateWorkerBlockResponse]
readPrec :: ReadPrec CreateWorkerBlockResponse
$creadPrec :: ReadPrec CreateWorkerBlockResponse
readList :: ReadS [CreateWorkerBlockResponse]
$creadList :: ReadS [CreateWorkerBlockResponse]
readsPrec :: Int -> ReadS CreateWorkerBlockResponse
$creadsPrec :: Int -> ReadS CreateWorkerBlockResponse
Prelude.Read, Int -> CreateWorkerBlockResponse -> ShowS
[CreateWorkerBlockResponse] -> ShowS
CreateWorkerBlockResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkerBlockResponse] -> ShowS
$cshowList :: [CreateWorkerBlockResponse] -> ShowS
show :: CreateWorkerBlockResponse -> String
$cshow :: CreateWorkerBlockResponse -> String
showsPrec :: Int -> CreateWorkerBlockResponse -> ShowS
$cshowsPrec :: Int -> CreateWorkerBlockResponse -> ShowS
Prelude.Show, forall x.
Rep CreateWorkerBlockResponse x -> CreateWorkerBlockResponse
forall x.
CreateWorkerBlockResponse -> Rep CreateWorkerBlockResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateWorkerBlockResponse x -> CreateWorkerBlockResponse
$cfrom :: forall x.
CreateWorkerBlockResponse -> Rep CreateWorkerBlockResponse x
Prelude.Generic)
newCreateWorkerBlockResponse ::
Prelude.Int ->
CreateWorkerBlockResponse
newCreateWorkerBlockResponse :: Int -> CreateWorkerBlockResponse
newCreateWorkerBlockResponse Int
pHttpStatus_ =
CreateWorkerBlockResponse'
{ $sel:httpStatus:CreateWorkerBlockResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
createWorkerBlockResponse_httpStatus :: Lens.Lens' CreateWorkerBlockResponse Prelude.Int
createWorkerBlockResponse_httpStatus :: Lens' CreateWorkerBlockResponse Int
createWorkerBlockResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkerBlockResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateWorkerBlockResponse' :: CreateWorkerBlockResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateWorkerBlockResponse
s@CreateWorkerBlockResponse' {} Int
a -> CreateWorkerBlockResponse
s {$sel:httpStatus:CreateWorkerBlockResponse' :: Int
httpStatus = Int
a} :: CreateWorkerBlockResponse)
instance Prelude.NFData CreateWorkerBlockResponse where
rnf :: CreateWorkerBlockResponse -> ()
rnf CreateWorkerBlockResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateWorkerBlockResponse' :: CreateWorkerBlockResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus