{-# 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.DataPipeline.PollForTask
(
PollForTask (..),
newPollForTask,
pollForTask_hostname,
pollForTask_instanceIdentity,
pollForTask_workerGroup,
PollForTaskResponse (..),
newPollForTaskResponse,
pollForTaskResponse_taskObject,
pollForTaskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DataPipeline.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data PollForTask = PollForTask'
{
PollForTask -> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
PollForTask -> Maybe InstanceIdentity
instanceIdentity :: Prelude.Maybe InstanceIdentity,
PollForTask -> Text
workerGroup :: Prelude.Text
}
deriving (PollForTask -> PollForTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForTask -> PollForTask -> Bool
$c/= :: PollForTask -> PollForTask -> Bool
== :: PollForTask -> PollForTask -> Bool
$c== :: PollForTask -> PollForTask -> Bool
Prelude.Eq, ReadPrec [PollForTask]
ReadPrec PollForTask
Int -> ReadS PollForTask
ReadS [PollForTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PollForTask]
$creadListPrec :: ReadPrec [PollForTask]
readPrec :: ReadPrec PollForTask
$creadPrec :: ReadPrec PollForTask
readList :: ReadS [PollForTask]
$creadList :: ReadS [PollForTask]
readsPrec :: Int -> ReadS PollForTask
$creadsPrec :: Int -> ReadS PollForTask
Prelude.Read, Int -> PollForTask -> ShowS
[PollForTask] -> ShowS
PollForTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForTask] -> ShowS
$cshowList :: [PollForTask] -> ShowS
show :: PollForTask -> String
$cshow :: PollForTask -> String
showsPrec :: Int -> PollForTask -> ShowS
$cshowsPrec :: Int -> PollForTask -> ShowS
Prelude.Show, forall x. Rep PollForTask x -> PollForTask
forall x. PollForTask -> Rep PollForTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollForTask x -> PollForTask
$cfrom :: forall x. PollForTask -> Rep PollForTask x
Prelude.Generic)
newPollForTask ::
Prelude.Text ->
PollForTask
newPollForTask :: Text -> PollForTask
newPollForTask Text
pWorkerGroup_ =
PollForTask'
{ $sel:hostname:PollForTask' :: Maybe Text
hostname = forall a. Maybe a
Prelude.Nothing,
$sel:instanceIdentity:PollForTask' :: Maybe InstanceIdentity
instanceIdentity = forall a. Maybe a
Prelude.Nothing,
$sel:workerGroup:PollForTask' :: Text
workerGroup = Text
pWorkerGroup_
}
pollForTask_hostname :: Lens.Lens' PollForTask (Prelude.Maybe Prelude.Text)
pollForTask_hostname :: Lens' PollForTask (Maybe Text)
pollForTask_hostname = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForTask' {Maybe Text
hostname :: Maybe Text
$sel:hostname:PollForTask' :: PollForTask -> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: PollForTask
s@PollForTask' {} Maybe Text
a -> PollForTask
s {$sel:hostname:PollForTask' :: Maybe Text
hostname = Maybe Text
a} :: PollForTask)
pollForTask_instanceIdentity :: Lens.Lens' PollForTask (Prelude.Maybe InstanceIdentity)
pollForTask_instanceIdentity :: Lens' PollForTask (Maybe InstanceIdentity)
pollForTask_instanceIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForTask' {Maybe InstanceIdentity
instanceIdentity :: Maybe InstanceIdentity
$sel:instanceIdentity:PollForTask' :: PollForTask -> Maybe InstanceIdentity
instanceIdentity} -> Maybe InstanceIdentity
instanceIdentity) (\s :: PollForTask
s@PollForTask' {} Maybe InstanceIdentity
a -> PollForTask
s {$sel:instanceIdentity:PollForTask' :: Maybe InstanceIdentity
instanceIdentity = Maybe InstanceIdentity
a} :: PollForTask)
pollForTask_workerGroup :: Lens.Lens' PollForTask Prelude.Text
pollForTask_workerGroup :: Lens' PollForTask Text
pollForTask_workerGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForTask' {Text
workerGroup :: Text
$sel:workerGroup:PollForTask' :: PollForTask -> Text
workerGroup} -> Text
workerGroup) (\s :: PollForTask
s@PollForTask' {} Text
a -> PollForTask
s {$sel:workerGroup:PollForTask' :: Text
workerGroup = Text
a} :: PollForTask)
instance Core.AWSRequest PollForTask where
type AWSResponse PollForTask = PollForTaskResponse
request :: (Service -> Service) -> PollForTask -> Request PollForTask
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 PollForTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PollForTask)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe TaskObject -> Int -> PollForTaskResponse
PollForTaskResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"taskObject")
forall (f :: * -> *) a b. Applicative f => 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 PollForTask where
hashWithSalt :: Int -> PollForTask -> Int
hashWithSalt Int
_salt PollForTask' {Maybe Text
Maybe InstanceIdentity
Text
workerGroup :: Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:workerGroup:PollForTask' :: PollForTask -> Text
$sel:instanceIdentity:PollForTask' :: PollForTask -> Maybe InstanceIdentity
$sel:hostname:PollForTask' :: PollForTask -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostname
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceIdentity
instanceIdentity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workerGroup
instance Prelude.NFData PollForTask where
rnf :: PollForTask -> ()
rnf PollForTask' {Maybe Text
Maybe InstanceIdentity
Text
workerGroup :: Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:workerGroup:PollForTask' :: PollForTask -> Text
$sel:instanceIdentity:PollForTask' :: PollForTask -> Maybe InstanceIdentity
$sel:hostname:PollForTask' :: PollForTask -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostname
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceIdentity
instanceIdentity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workerGroup
instance Data.ToHeaders PollForTask where
toHeaders :: PollForTask -> 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
"DataPipeline.PollForTask" :: 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 PollForTask where
toJSON :: PollForTask -> Value
toJSON PollForTask' {Maybe Text
Maybe InstanceIdentity
Text
workerGroup :: Text
instanceIdentity :: Maybe InstanceIdentity
hostname :: Maybe Text
$sel:workerGroup:PollForTask' :: PollForTask -> Text
$sel:instanceIdentity:PollForTask' :: PollForTask -> Maybe InstanceIdentity
$sel:hostname:PollForTask' :: PollForTask -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"hostname" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
hostname,
(Key
"instanceIdentity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InstanceIdentity
instanceIdentity,
forall a. a -> Maybe a
Prelude.Just (Key
"workerGroup" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workerGroup)
]
)
instance Data.ToPath PollForTask where
toPath :: PollForTask -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery PollForTask where
toQuery :: PollForTask -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data PollForTaskResponse = PollForTaskResponse'
{
PollForTaskResponse -> Maybe TaskObject
taskObject :: Prelude.Maybe TaskObject,
PollForTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PollForTaskResponse -> PollForTaskResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PollForTaskResponse -> PollForTaskResponse -> Bool
$c/= :: PollForTaskResponse -> PollForTaskResponse -> Bool
== :: PollForTaskResponse -> PollForTaskResponse -> Bool
$c== :: PollForTaskResponse -> PollForTaskResponse -> Bool
Prelude.Eq, ReadPrec [PollForTaskResponse]
ReadPrec PollForTaskResponse
Int -> ReadS PollForTaskResponse
ReadS [PollForTaskResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PollForTaskResponse]
$creadListPrec :: ReadPrec [PollForTaskResponse]
readPrec :: ReadPrec PollForTaskResponse
$creadPrec :: ReadPrec PollForTaskResponse
readList :: ReadS [PollForTaskResponse]
$creadList :: ReadS [PollForTaskResponse]
readsPrec :: Int -> ReadS PollForTaskResponse
$creadsPrec :: Int -> ReadS PollForTaskResponse
Prelude.Read, Int -> PollForTaskResponse -> ShowS
[PollForTaskResponse] -> ShowS
PollForTaskResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PollForTaskResponse] -> ShowS
$cshowList :: [PollForTaskResponse] -> ShowS
show :: PollForTaskResponse -> String
$cshow :: PollForTaskResponse -> String
showsPrec :: Int -> PollForTaskResponse -> ShowS
$cshowsPrec :: Int -> PollForTaskResponse -> ShowS
Prelude.Show, forall x. Rep PollForTaskResponse x -> PollForTaskResponse
forall x. PollForTaskResponse -> Rep PollForTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PollForTaskResponse x -> PollForTaskResponse
$cfrom :: forall x. PollForTaskResponse -> Rep PollForTaskResponse x
Prelude.Generic)
newPollForTaskResponse ::
Prelude.Int ->
PollForTaskResponse
newPollForTaskResponse :: Int -> PollForTaskResponse
newPollForTaskResponse Int
pHttpStatus_ =
PollForTaskResponse'
{ $sel:taskObject:PollForTaskResponse' :: Maybe TaskObject
taskObject = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PollForTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
pollForTaskResponse_taskObject :: Lens.Lens' PollForTaskResponse (Prelude.Maybe TaskObject)
pollForTaskResponse_taskObject :: Lens' PollForTaskResponse (Maybe TaskObject)
pollForTaskResponse_taskObject = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForTaskResponse' {Maybe TaskObject
taskObject :: Maybe TaskObject
$sel:taskObject:PollForTaskResponse' :: PollForTaskResponse -> Maybe TaskObject
taskObject} -> Maybe TaskObject
taskObject) (\s :: PollForTaskResponse
s@PollForTaskResponse' {} Maybe TaskObject
a -> PollForTaskResponse
s {$sel:taskObject:PollForTaskResponse' :: Maybe TaskObject
taskObject = Maybe TaskObject
a} :: PollForTaskResponse)
pollForTaskResponse_httpStatus :: Lens.Lens' PollForTaskResponse Prelude.Int
pollForTaskResponse_httpStatus :: Lens' PollForTaskResponse Int
pollForTaskResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PollForTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:PollForTaskResponse' :: PollForTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PollForTaskResponse
s@PollForTaskResponse' {} Int
a -> PollForTaskResponse
s {$sel:httpStatus:PollForTaskResponse' :: Int
httpStatus = Int
a} :: PollForTaskResponse)
instance Prelude.NFData PollForTaskResponse where
rnf :: PollForTaskResponse -> ()
rnf PollForTaskResponse' {Int
Maybe TaskObject
httpStatus :: Int
taskObject :: Maybe TaskObject
$sel:httpStatus:PollForTaskResponse' :: PollForTaskResponse -> Int
$sel:taskObject:PollForTaskResponse' :: PollForTaskResponse -> Maybe TaskObject
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskObject
taskObject
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus