{-# 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.ReportTaskProgress
(
ReportTaskProgress (..),
newReportTaskProgress,
reportTaskProgress_fields,
reportTaskProgress_taskId,
ReportTaskProgressResponse (..),
newReportTaskProgressResponse,
reportTaskProgressResponse_httpStatus,
reportTaskProgressResponse_canceled,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DataPipeline.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ReportTaskProgress = ReportTaskProgress'
{
ReportTaskProgress -> Maybe [Field]
fields :: Prelude.Maybe [Field],
ReportTaskProgress -> Text
taskId :: Prelude.Text
}
deriving (ReportTaskProgress -> ReportTaskProgress -> Bool
(ReportTaskProgress -> ReportTaskProgress -> Bool)
-> (ReportTaskProgress -> ReportTaskProgress -> Bool)
-> Eq ReportTaskProgress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportTaskProgress -> ReportTaskProgress -> Bool
$c/= :: ReportTaskProgress -> ReportTaskProgress -> Bool
== :: ReportTaskProgress -> ReportTaskProgress -> Bool
$c== :: ReportTaskProgress -> ReportTaskProgress -> Bool
Prelude.Eq, ReadPrec [ReportTaskProgress]
ReadPrec ReportTaskProgress
Int -> ReadS ReportTaskProgress
ReadS [ReportTaskProgress]
(Int -> ReadS ReportTaskProgress)
-> ReadS [ReportTaskProgress]
-> ReadPrec ReportTaskProgress
-> ReadPrec [ReportTaskProgress]
-> Read ReportTaskProgress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportTaskProgress]
$creadListPrec :: ReadPrec [ReportTaskProgress]
readPrec :: ReadPrec ReportTaskProgress
$creadPrec :: ReadPrec ReportTaskProgress
readList :: ReadS [ReportTaskProgress]
$creadList :: ReadS [ReportTaskProgress]
readsPrec :: Int -> ReadS ReportTaskProgress
$creadsPrec :: Int -> ReadS ReportTaskProgress
Prelude.Read, Int -> ReportTaskProgress -> ShowS
[ReportTaskProgress] -> ShowS
ReportTaskProgress -> String
(Int -> ReportTaskProgress -> ShowS)
-> (ReportTaskProgress -> String)
-> ([ReportTaskProgress] -> ShowS)
-> Show ReportTaskProgress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportTaskProgress] -> ShowS
$cshowList :: [ReportTaskProgress] -> ShowS
show :: ReportTaskProgress -> String
$cshow :: ReportTaskProgress -> String
showsPrec :: Int -> ReportTaskProgress -> ShowS
$cshowsPrec :: Int -> ReportTaskProgress -> ShowS
Prelude.Show, (forall x. ReportTaskProgress -> Rep ReportTaskProgress x)
-> (forall x. Rep ReportTaskProgress x -> ReportTaskProgress)
-> Generic ReportTaskProgress
forall x. Rep ReportTaskProgress x -> ReportTaskProgress
forall x. ReportTaskProgress -> Rep ReportTaskProgress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportTaskProgress x -> ReportTaskProgress
$cfrom :: forall x. ReportTaskProgress -> Rep ReportTaskProgress x
Prelude.Generic)
newReportTaskProgress ::
Prelude.Text ->
ReportTaskProgress
newReportTaskProgress :: Text -> ReportTaskProgress
newReportTaskProgress Text
pTaskId_ =
ReportTaskProgress' :: Maybe [Field] -> Text -> ReportTaskProgress
ReportTaskProgress'
{ $sel:fields:ReportTaskProgress' :: Maybe [Field]
fields = Maybe [Field]
forall a. Maybe a
Prelude.Nothing,
$sel:taskId:ReportTaskProgress' :: Text
taskId = Text
pTaskId_
}
reportTaskProgress_fields :: Lens.Lens' ReportTaskProgress (Prelude.Maybe [Field])
reportTaskProgress_fields :: (Maybe [Field] -> f (Maybe [Field]))
-> ReportTaskProgress -> f ReportTaskProgress
reportTaskProgress_fields = (ReportTaskProgress -> Maybe [Field])
-> (ReportTaskProgress -> Maybe [Field] -> ReportTaskProgress)
-> Lens
ReportTaskProgress
ReportTaskProgress
(Maybe [Field])
(Maybe [Field])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportTaskProgress' {Maybe [Field]
fields :: Maybe [Field]
$sel:fields:ReportTaskProgress' :: ReportTaskProgress -> Maybe [Field]
fields} -> Maybe [Field]
fields) (\s :: ReportTaskProgress
s@ReportTaskProgress' {} Maybe [Field]
a -> ReportTaskProgress
s {$sel:fields:ReportTaskProgress' :: Maybe [Field]
fields = Maybe [Field]
a} :: ReportTaskProgress) ((Maybe [Field] -> f (Maybe [Field]))
-> ReportTaskProgress -> f ReportTaskProgress)
-> ((Maybe [Field] -> f (Maybe [Field]))
-> Maybe [Field] -> f (Maybe [Field]))
-> (Maybe [Field] -> f (Maybe [Field]))
-> ReportTaskProgress
-> f ReportTaskProgress
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Field] [Field] [Field] [Field]
-> Iso
(Maybe [Field]) (Maybe [Field]) (Maybe [Field]) (Maybe [Field])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Field] [Field] [Field] [Field]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
reportTaskProgress_taskId :: Lens.Lens' ReportTaskProgress Prelude.Text
reportTaskProgress_taskId :: (Text -> f Text) -> ReportTaskProgress -> f ReportTaskProgress
reportTaskProgress_taskId = (ReportTaskProgress -> Text)
-> (ReportTaskProgress -> Text -> ReportTaskProgress)
-> Lens ReportTaskProgress ReportTaskProgress Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportTaskProgress' {Text
taskId :: Text
$sel:taskId:ReportTaskProgress' :: ReportTaskProgress -> Text
taskId} -> Text
taskId) (\s :: ReportTaskProgress
s@ReportTaskProgress' {} Text
a -> ReportTaskProgress
s {$sel:taskId:ReportTaskProgress' :: Text
taskId = Text
a} :: ReportTaskProgress)
instance Core.AWSRequest ReportTaskProgress where
type
AWSResponse ReportTaskProgress =
ReportTaskProgressResponse
request :: ReportTaskProgress -> Request ReportTaskProgress
request = Service -> ReportTaskProgress -> Request ReportTaskProgress
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ReportTaskProgress
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ReportTaskProgress)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ReportTaskProgress))
-> Logger
-> Service
-> Proxy ReportTaskProgress
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ReportTaskProgress)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Bool -> ReportTaskProgressResponse
ReportTaskProgressResponse'
(Int -> Bool -> ReportTaskProgressResponse)
-> Either String Int
-> Either String (Bool -> ReportTaskProgressResponse)
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))
Either String (Bool -> ReportTaskProgressResponse)
-> Either String Bool -> Either String ReportTaskProgressResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Bool
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"canceled")
)
instance Prelude.Hashable ReportTaskProgress
instance Prelude.NFData ReportTaskProgress
instance Core.ToHeaders ReportTaskProgress where
toHeaders :: ReportTaskProgress -> ResponseHeaders
toHeaders =
ResponseHeaders -> ReportTaskProgress -> 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
"DataPipeline.ReportTaskProgress" ::
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 ReportTaskProgress where
toJSON :: ReportTaskProgress -> Value
toJSON ReportTaskProgress' {Maybe [Field]
Text
taskId :: Text
fields :: Maybe [Field]
$sel:taskId:ReportTaskProgress' :: ReportTaskProgress -> Text
$sel:fields:ReportTaskProgress' :: ReportTaskProgress -> Maybe [Field]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"fields" Text -> [Field] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Field] -> Pair) -> Maybe [Field] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Field]
fields,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"taskId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
taskId)
]
)
instance Core.ToPath ReportTaskProgress where
toPath :: ReportTaskProgress -> ByteString
toPath = ByteString -> ReportTaskProgress -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ReportTaskProgress where
toQuery :: ReportTaskProgress -> QueryString
toQuery = QueryString -> ReportTaskProgress -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ReportTaskProgressResponse = ReportTaskProgressResponse'
{
ReportTaskProgressResponse -> Int
httpStatus :: Prelude.Int,
ReportTaskProgressResponse -> Bool
canceled :: Prelude.Bool
}
deriving (ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool
(ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool)
-> (ReportTaskProgressResponse
-> ReportTaskProgressResponse -> Bool)
-> Eq ReportTaskProgressResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool
$c/= :: ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool
== :: ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool
$c== :: ReportTaskProgressResponse -> ReportTaskProgressResponse -> Bool
Prelude.Eq, ReadPrec [ReportTaskProgressResponse]
ReadPrec ReportTaskProgressResponse
Int -> ReadS ReportTaskProgressResponse
ReadS [ReportTaskProgressResponse]
(Int -> ReadS ReportTaskProgressResponse)
-> ReadS [ReportTaskProgressResponse]
-> ReadPrec ReportTaskProgressResponse
-> ReadPrec [ReportTaskProgressResponse]
-> Read ReportTaskProgressResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportTaskProgressResponse]
$creadListPrec :: ReadPrec [ReportTaskProgressResponse]
readPrec :: ReadPrec ReportTaskProgressResponse
$creadPrec :: ReadPrec ReportTaskProgressResponse
readList :: ReadS [ReportTaskProgressResponse]
$creadList :: ReadS [ReportTaskProgressResponse]
readsPrec :: Int -> ReadS ReportTaskProgressResponse
$creadsPrec :: Int -> ReadS ReportTaskProgressResponse
Prelude.Read, Int -> ReportTaskProgressResponse -> ShowS
[ReportTaskProgressResponse] -> ShowS
ReportTaskProgressResponse -> String
(Int -> ReportTaskProgressResponse -> ShowS)
-> (ReportTaskProgressResponse -> String)
-> ([ReportTaskProgressResponse] -> ShowS)
-> Show ReportTaskProgressResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportTaskProgressResponse] -> ShowS
$cshowList :: [ReportTaskProgressResponse] -> ShowS
show :: ReportTaskProgressResponse -> String
$cshow :: ReportTaskProgressResponse -> String
showsPrec :: Int -> ReportTaskProgressResponse -> ShowS
$cshowsPrec :: Int -> ReportTaskProgressResponse -> ShowS
Prelude.Show, (forall x.
ReportTaskProgressResponse -> Rep ReportTaskProgressResponse x)
-> (forall x.
Rep ReportTaskProgressResponse x -> ReportTaskProgressResponse)
-> Generic ReportTaskProgressResponse
forall x.
Rep ReportTaskProgressResponse x -> ReportTaskProgressResponse
forall x.
ReportTaskProgressResponse -> Rep ReportTaskProgressResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ReportTaskProgressResponse x -> ReportTaskProgressResponse
$cfrom :: forall x.
ReportTaskProgressResponse -> Rep ReportTaskProgressResponse x
Prelude.Generic)
newReportTaskProgressResponse ::
Prelude.Int ->
Prelude.Bool ->
ReportTaskProgressResponse
newReportTaskProgressResponse :: Int -> Bool -> ReportTaskProgressResponse
newReportTaskProgressResponse Int
pHttpStatus_ Bool
pCanceled_ =
ReportTaskProgressResponse' :: Int -> Bool -> ReportTaskProgressResponse
ReportTaskProgressResponse'
{ $sel:httpStatus:ReportTaskProgressResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:canceled:ReportTaskProgressResponse' :: Bool
canceled = Bool
pCanceled_
}
reportTaskProgressResponse_httpStatus :: Lens.Lens' ReportTaskProgressResponse Prelude.Int
reportTaskProgressResponse_httpStatus :: (Int -> f Int)
-> ReportTaskProgressResponse -> f ReportTaskProgressResponse
reportTaskProgressResponse_httpStatus = (ReportTaskProgressResponse -> Int)
-> (ReportTaskProgressResponse
-> Int -> ReportTaskProgressResponse)
-> Lens
ReportTaskProgressResponse ReportTaskProgressResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportTaskProgressResponse' {Int
httpStatus :: Int
$sel:httpStatus:ReportTaskProgressResponse' :: ReportTaskProgressResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ReportTaskProgressResponse
s@ReportTaskProgressResponse' {} Int
a -> ReportTaskProgressResponse
s {$sel:httpStatus:ReportTaskProgressResponse' :: Int
httpStatus = Int
a} :: ReportTaskProgressResponse)
reportTaskProgressResponse_canceled :: Lens.Lens' ReportTaskProgressResponse Prelude.Bool
reportTaskProgressResponse_canceled :: (Bool -> f Bool)
-> ReportTaskProgressResponse -> f ReportTaskProgressResponse
reportTaskProgressResponse_canceled = (ReportTaskProgressResponse -> Bool)
-> (ReportTaskProgressResponse
-> Bool -> ReportTaskProgressResponse)
-> Lens
ReportTaskProgressResponse ReportTaskProgressResponse Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportTaskProgressResponse' {Bool
canceled :: Bool
$sel:canceled:ReportTaskProgressResponse' :: ReportTaskProgressResponse -> Bool
canceled} -> Bool
canceled) (\s :: ReportTaskProgressResponse
s@ReportTaskProgressResponse' {} Bool
a -> ReportTaskProgressResponse
s {$sel:canceled:ReportTaskProgressResponse' :: Bool
canceled = Bool
a} :: ReportTaskProgressResponse)
instance Prelude.NFData ReportTaskProgressResponse