{-# 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.Batch.DescribeJobs
(
DescribeJobs (..),
newDescribeJobs,
describeJobs_jobs,
DescribeJobsResponse (..),
newDescribeJobsResponse,
describeJobsResponse_jobs,
describeJobsResponse_httpStatus,
)
where
import Amazonka.Batch.Types
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
data DescribeJobs = DescribeJobs'
{
DescribeJobs -> [Text]
jobs :: [Prelude.Text]
}
deriving (DescribeJobs -> DescribeJobs -> Bool
(DescribeJobs -> DescribeJobs -> Bool)
-> (DescribeJobs -> DescribeJobs -> Bool) -> Eq DescribeJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobs -> DescribeJobs -> Bool
$c/= :: DescribeJobs -> DescribeJobs -> Bool
== :: DescribeJobs -> DescribeJobs -> Bool
$c== :: DescribeJobs -> DescribeJobs -> Bool
Prelude.Eq, ReadPrec [DescribeJobs]
ReadPrec DescribeJobs
Int -> ReadS DescribeJobs
ReadS [DescribeJobs]
(Int -> ReadS DescribeJobs)
-> ReadS [DescribeJobs]
-> ReadPrec DescribeJobs
-> ReadPrec [DescribeJobs]
-> Read DescribeJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobs]
$creadListPrec :: ReadPrec [DescribeJobs]
readPrec :: ReadPrec DescribeJobs
$creadPrec :: ReadPrec DescribeJobs
readList :: ReadS [DescribeJobs]
$creadList :: ReadS [DescribeJobs]
readsPrec :: Int -> ReadS DescribeJobs
$creadsPrec :: Int -> ReadS DescribeJobs
Prelude.Read, Int -> DescribeJobs -> ShowS
[DescribeJobs] -> ShowS
DescribeJobs -> String
(Int -> DescribeJobs -> ShowS)
-> (DescribeJobs -> String)
-> ([DescribeJobs] -> ShowS)
-> Show DescribeJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobs] -> ShowS
$cshowList :: [DescribeJobs] -> ShowS
show :: DescribeJobs -> String
$cshow :: DescribeJobs -> String
showsPrec :: Int -> DescribeJobs -> ShowS
$cshowsPrec :: Int -> DescribeJobs -> ShowS
Prelude.Show, (forall x. DescribeJobs -> Rep DescribeJobs x)
-> (forall x. Rep DescribeJobs x -> DescribeJobs)
-> Generic DescribeJobs
forall x. Rep DescribeJobs x -> DescribeJobs
forall x. DescribeJobs -> Rep DescribeJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJobs x -> DescribeJobs
$cfrom :: forall x. DescribeJobs -> Rep DescribeJobs x
Prelude.Generic)
newDescribeJobs ::
DescribeJobs
newDescribeJobs :: DescribeJobs
newDescribeJobs =
DescribeJobs' :: [Text] -> DescribeJobs
DescribeJobs' {$sel:jobs:DescribeJobs' :: [Text]
jobs = [Text]
forall a. Monoid a => a
Prelude.mempty}
describeJobs_jobs :: Lens.Lens' DescribeJobs [Prelude.Text]
describeJobs_jobs :: ([Text] -> f [Text]) -> DescribeJobs -> f DescribeJobs
describeJobs_jobs = (DescribeJobs -> [Text])
-> (DescribeJobs -> [Text] -> DescribeJobs)
-> Lens DescribeJobs DescribeJobs [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobs' {[Text]
jobs :: [Text]
$sel:jobs:DescribeJobs' :: DescribeJobs -> [Text]
jobs} -> [Text]
jobs) (\s :: DescribeJobs
s@DescribeJobs' {} [Text]
a -> DescribeJobs
s {$sel:jobs:DescribeJobs' :: [Text]
jobs = [Text]
a} :: DescribeJobs) (([Text] -> f [Text]) -> DescribeJobs -> f DescribeJobs)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DescribeJobs
-> f DescribeJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest DescribeJobs where
type AWSResponse DescribeJobs = DescribeJobsResponse
request :: DescribeJobs -> Request DescribeJobs
request = Service -> DescribeJobs -> Request DescribeJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJobs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeJobs))
-> Logger
-> Service
-> Proxy DescribeJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJobs)))
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 ->
Maybe [JobDetail] -> Int -> DescribeJobsResponse
DescribeJobsResponse'
(Maybe [JobDetail] -> Int -> DescribeJobsResponse)
-> Either String (Maybe [JobDetail])
-> Either String (Int -> DescribeJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [JobDetail]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"jobs" Either String (Maybe (Maybe [JobDetail]))
-> Maybe [JobDetail] -> Either String (Maybe [JobDetail])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [JobDetail]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeJobsResponse)
-> Either String Int -> Either String DescribeJobsResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeJobs
instance Prelude.NFData DescribeJobs
instance Core.ToHeaders DescribeJobs where
toHeaders :: DescribeJobs -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeJobs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 DescribeJobs where
toJSON :: DescribeJobs -> Value
toJSON DescribeJobs' {[Text]
jobs :: [Text]
$sel:jobs:DescribeJobs' :: DescribeJobs -> [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"jobs" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
jobs)]
)
instance Core.ToPath DescribeJobs where
toPath :: DescribeJobs -> ByteString
toPath = ByteString -> DescribeJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/describejobs"
instance Core.ToQuery DescribeJobs where
toQuery :: DescribeJobs -> QueryString
toQuery = QueryString -> DescribeJobs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeJobsResponse = DescribeJobsResponse'
{
DescribeJobsResponse -> Maybe [JobDetail]
jobs :: Prelude.Maybe [JobDetail],
DescribeJobsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeJobsResponse -> DescribeJobsResponse -> Bool
(DescribeJobsResponse -> DescribeJobsResponse -> Bool)
-> (DescribeJobsResponse -> DescribeJobsResponse -> Bool)
-> Eq DescribeJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobsResponse -> DescribeJobsResponse -> Bool
$c/= :: DescribeJobsResponse -> DescribeJobsResponse -> Bool
== :: DescribeJobsResponse -> DescribeJobsResponse -> Bool
$c== :: DescribeJobsResponse -> DescribeJobsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeJobsResponse]
ReadPrec DescribeJobsResponse
Int -> ReadS DescribeJobsResponse
ReadS [DescribeJobsResponse]
(Int -> ReadS DescribeJobsResponse)
-> ReadS [DescribeJobsResponse]
-> ReadPrec DescribeJobsResponse
-> ReadPrec [DescribeJobsResponse]
-> Read DescribeJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobsResponse]
$creadListPrec :: ReadPrec [DescribeJobsResponse]
readPrec :: ReadPrec DescribeJobsResponse
$creadPrec :: ReadPrec DescribeJobsResponse
readList :: ReadS [DescribeJobsResponse]
$creadList :: ReadS [DescribeJobsResponse]
readsPrec :: Int -> ReadS DescribeJobsResponse
$creadsPrec :: Int -> ReadS DescribeJobsResponse
Prelude.Read, Int -> DescribeJobsResponse -> ShowS
[DescribeJobsResponse] -> ShowS
DescribeJobsResponse -> String
(Int -> DescribeJobsResponse -> ShowS)
-> (DescribeJobsResponse -> String)
-> ([DescribeJobsResponse] -> ShowS)
-> Show DescribeJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobsResponse] -> ShowS
$cshowList :: [DescribeJobsResponse] -> ShowS
show :: DescribeJobsResponse -> String
$cshow :: DescribeJobsResponse -> String
showsPrec :: Int -> DescribeJobsResponse -> ShowS
$cshowsPrec :: Int -> DescribeJobsResponse -> ShowS
Prelude.Show, (forall x. DescribeJobsResponse -> Rep DescribeJobsResponse x)
-> (forall x. Rep DescribeJobsResponse x -> DescribeJobsResponse)
-> Generic DescribeJobsResponse
forall x. Rep DescribeJobsResponse x -> DescribeJobsResponse
forall x. DescribeJobsResponse -> Rep DescribeJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJobsResponse x -> DescribeJobsResponse
$cfrom :: forall x. DescribeJobsResponse -> Rep DescribeJobsResponse x
Prelude.Generic)
newDescribeJobsResponse ::
Prelude.Int ->
DescribeJobsResponse
newDescribeJobsResponse :: Int -> DescribeJobsResponse
newDescribeJobsResponse Int
pHttpStatus_ =
DescribeJobsResponse' :: Maybe [JobDetail] -> Int -> DescribeJobsResponse
DescribeJobsResponse'
{ $sel:jobs:DescribeJobsResponse' :: Maybe [JobDetail]
jobs = Maybe [JobDetail]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeJobsResponse_jobs :: Lens.Lens' DescribeJobsResponse (Prelude.Maybe [JobDetail])
describeJobsResponse_jobs :: (Maybe [JobDetail] -> f (Maybe [JobDetail]))
-> DescribeJobsResponse -> f DescribeJobsResponse
describeJobsResponse_jobs = (DescribeJobsResponse -> Maybe [JobDetail])
-> (DescribeJobsResponse
-> Maybe [JobDetail] -> DescribeJobsResponse)
-> Lens
DescribeJobsResponse
DescribeJobsResponse
(Maybe [JobDetail])
(Maybe [JobDetail])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobsResponse' {Maybe [JobDetail]
jobs :: Maybe [JobDetail]
$sel:jobs:DescribeJobsResponse' :: DescribeJobsResponse -> Maybe [JobDetail]
jobs} -> Maybe [JobDetail]
jobs) (\s :: DescribeJobsResponse
s@DescribeJobsResponse' {} Maybe [JobDetail]
a -> DescribeJobsResponse
s {$sel:jobs:DescribeJobsResponse' :: Maybe [JobDetail]
jobs = Maybe [JobDetail]
a} :: DescribeJobsResponse) ((Maybe [JobDetail] -> f (Maybe [JobDetail]))
-> DescribeJobsResponse -> f DescribeJobsResponse)
-> ((Maybe [JobDetail] -> f (Maybe [JobDetail]))
-> Maybe [JobDetail] -> f (Maybe [JobDetail]))
-> (Maybe [JobDetail] -> f (Maybe [JobDetail]))
-> DescribeJobsResponse
-> f DescribeJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JobDetail] [JobDetail] [JobDetail] [JobDetail]
-> Iso
(Maybe [JobDetail])
(Maybe [JobDetail])
(Maybe [JobDetail])
(Maybe [JobDetail])
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 [JobDetail] [JobDetail] [JobDetail] [JobDetail]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeJobsResponse_httpStatus :: Lens.Lens' DescribeJobsResponse Prelude.Int
describeJobsResponse_httpStatus :: (Int -> f Int) -> DescribeJobsResponse -> f DescribeJobsResponse
describeJobsResponse_httpStatus = (DescribeJobsResponse -> Int)
-> (DescribeJobsResponse -> Int -> DescribeJobsResponse)
-> Lens DescribeJobsResponse DescribeJobsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeJobsResponse' :: DescribeJobsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeJobsResponse
s@DescribeJobsResponse' {} Int
a -> DescribeJobsResponse
s {$sel:httpStatus:DescribeJobsResponse' :: Int
httpStatus = Int
a} :: DescribeJobsResponse)
instance Prelude.NFData DescribeJobsResponse