{-# 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.Snowball.DescribeJob
(
DescribeJob (..),
newDescribeJob,
describeJob_jobId,
DescribeJobResponse (..),
newDescribeJobResponse,
describeJobResponse_jobMetadata,
describeJobResponse_subJobMetadata,
describeJobResponse_httpStatus,
)
where
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
import Amazonka.Snowball.Types
data DescribeJob = DescribeJob'
{
DescribeJob -> Text
jobId :: Prelude.Text
}
deriving (DescribeJob -> DescribeJob -> Bool
(DescribeJob -> DescribeJob -> Bool)
-> (DescribeJob -> DescribeJob -> Bool) -> Eq DescribeJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJob -> DescribeJob -> Bool
$c/= :: DescribeJob -> DescribeJob -> Bool
== :: DescribeJob -> DescribeJob -> Bool
$c== :: DescribeJob -> DescribeJob -> Bool
Prelude.Eq, ReadPrec [DescribeJob]
ReadPrec DescribeJob
Int -> ReadS DescribeJob
ReadS [DescribeJob]
(Int -> ReadS DescribeJob)
-> ReadS [DescribeJob]
-> ReadPrec DescribeJob
-> ReadPrec [DescribeJob]
-> Read DescribeJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJob]
$creadListPrec :: ReadPrec [DescribeJob]
readPrec :: ReadPrec DescribeJob
$creadPrec :: ReadPrec DescribeJob
readList :: ReadS [DescribeJob]
$creadList :: ReadS [DescribeJob]
readsPrec :: Int -> ReadS DescribeJob
$creadsPrec :: Int -> ReadS DescribeJob
Prelude.Read, Int -> DescribeJob -> ShowS
[DescribeJob] -> ShowS
DescribeJob -> String
(Int -> DescribeJob -> ShowS)
-> (DescribeJob -> String)
-> ([DescribeJob] -> ShowS)
-> Show DescribeJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJob] -> ShowS
$cshowList :: [DescribeJob] -> ShowS
show :: DescribeJob -> String
$cshow :: DescribeJob -> String
showsPrec :: Int -> DescribeJob -> ShowS
$cshowsPrec :: Int -> DescribeJob -> ShowS
Prelude.Show, (forall x. DescribeJob -> Rep DescribeJob x)
-> (forall x. Rep DescribeJob x -> DescribeJob)
-> Generic DescribeJob
forall x. Rep DescribeJob x -> DescribeJob
forall x. DescribeJob -> Rep DescribeJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJob x -> DescribeJob
$cfrom :: forall x. DescribeJob -> Rep DescribeJob x
Prelude.Generic)
newDescribeJob ::
Prelude.Text ->
DescribeJob
newDescribeJob :: Text -> DescribeJob
newDescribeJob Text
pJobId_ =
DescribeJob' :: Text -> DescribeJob
DescribeJob' {$sel:jobId:DescribeJob' :: Text
jobId = Text
pJobId_}
describeJob_jobId :: Lens.Lens' DescribeJob Prelude.Text
describeJob_jobId :: (Text -> f Text) -> DescribeJob -> f DescribeJob
describeJob_jobId = (DescribeJob -> Text)
-> (DescribeJob -> Text -> DescribeJob)
-> Lens DescribeJob DescribeJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJob' {Text
jobId :: Text
$sel:jobId:DescribeJob' :: DescribeJob -> Text
jobId} -> Text
jobId) (\s :: DescribeJob
s@DescribeJob' {} Text
a -> DescribeJob
s {$sel:jobId:DescribeJob' :: Text
jobId = Text
a} :: DescribeJob)
instance Core.AWSRequest DescribeJob where
type AWSResponse DescribeJob = DescribeJobResponse
request :: DescribeJob -> Request DescribeJob
request = Service -> DescribeJob -> Request DescribeJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeJob))
-> Logger
-> Service
-> Proxy DescribeJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeJob)))
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 JobMetadata
-> Maybe [JobMetadata] -> Int -> DescribeJobResponse
DescribeJobResponse'
(Maybe JobMetadata
-> Maybe [JobMetadata] -> Int -> DescribeJobResponse)
-> Either String (Maybe JobMetadata)
-> Either
String (Maybe [JobMetadata] -> Int -> DescribeJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe JobMetadata)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobMetadata")
Either String (Maybe [JobMetadata] -> Int -> DescribeJobResponse)
-> Either String (Maybe [JobMetadata])
-> Either String (Int -> DescribeJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [JobMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SubJobMetadata" Either String (Maybe (Maybe [JobMetadata]))
-> Maybe [JobMetadata] -> Either String (Maybe [JobMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [JobMetadata]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> DescribeJobResponse)
-> Either String Int -> Either String DescribeJobResponse
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 DescribeJob
instance Prelude.NFData DescribeJob
instance Core.ToHeaders DescribeJob where
toHeaders :: DescribeJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeJob -> 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
"AWSIESnowballJobManagementService.DescribeJob" ::
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 DescribeJob where
toJSON :: DescribeJob -> Value
toJSON DescribeJob' {Text
jobId :: Text
$sel:jobId:DescribeJob' :: DescribeJob -> 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
"JobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)]
)
instance Core.ToPath DescribeJob where
toPath :: DescribeJob -> ByteString
toPath = ByteString -> DescribeJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeJob where
toQuery :: DescribeJob -> QueryString
toQuery = QueryString -> DescribeJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeJobResponse = DescribeJobResponse'
{
DescribeJobResponse -> Maybe JobMetadata
jobMetadata :: Prelude.Maybe JobMetadata,
DescribeJobResponse -> Maybe [JobMetadata]
subJobMetadata :: Prelude.Maybe [JobMetadata],
DescribeJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeJobResponse -> DescribeJobResponse -> Bool
(DescribeJobResponse -> DescribeJobResponse -> Bool)
-> (DescribeJobResponse -> DescribeJobResponse -> Bool)
-> Eq DescribeJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJobResponse -> DescribeJobResponse -> Bool
$c/= :: DescribeJobResponse -> DescribeJobResponse -> Bool
== :: DescribeJobResponse -> DescribeJobResponse -> Bool
$c== :: DescribeJobResponse -> DescribeJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeJobResponse]
ReadPrec DescribeJobResponse
Int -> ReadS DescribeJobResponse
ReadS [DescribeJobResponse]
(Int -> ReadS DescribeJobResponse)
-> ReadS [DescribeJobResponse]
-> ReadPrec DescribeJobResponse
-> ReadPrec [DescribeJobResponse]
-> Read DescribeJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJobResponse]
$creadListPrec :: ReadPrec [DescribeJobResponse]
readPrec :: ReadPrec DescribeJobResponse
$creadPrec :: ReadPrec DescribeJobResponse
readList :: ReadS [DescribeJobResponse]
$creadList :: ReadS [DescribeJobResponse]
readsPrec :: Int -> ReadS DescribeJobResponse
$creadsPrec :: Int -> ReadS DescribeJobResponse
Prelude.Read, Int -> DescribeJobResponse -> ShowS
[DescribeJobResponse] -> ShowS
DescribeJobResponse -> String
(Int -> DescribeJobResponse -> ShowS)
-> (DescribeJobResponse -> String)
-> ([DescribeJobResponse] -> ShowS)
-> Show DescribeJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJobResponse] -> ShowS
$cshowList :: [DescribeJobResponse] -> ShowS
show :: DescribeJobResponse -> String
$cshow :: DescribeJobResponse -> String
showsPrec :: Int -> DescribeJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeJobResponse -> ShowS
Prelude.Show, (forall x. DescribeJobResponse -> Rep DescribeJobResponse x)
-> (forall x. Rep DescribeJobResponse x -> DescribeJobResponse)
-> Generic DescribeJobResponse
forall x. Rep DescribeJobResponse x -> DescribeJobResponse
forall x. DescribeJobResponse -> Rep DescribeJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJobResponse x -> DescribeJobResponse
$cfrom :: forall x. DescribeJobResponse -> Rep DescribeJobResponse x
Prelude.Generic)
newDescribeJobResponse ::
Prelude.Int ->
DescribeJobResponse
newDescribeJobResponse :: Int -> DescribeJobResponse
newDescribeJobResponse Int
pHttpStatus_ =
DescribeJobResponse' :: Maybe JobMetadata
-> Maybe [JobMetadata] -> Int -> DescribeJobResponse
DescribeJobResponse'
{ $sel:jobMetadata:DescribeJobResponse' :: Maybe JobMetadata
jobMetadata = Maybe JobMetadata
forall a. Maybe a
Prelude.Nothing,
$sel:subJobMetadata:DescribeJobResponse' :: Maybe [JobMetadata]
subJobMetadata = Maybe [JobMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeJobResponse_jobMetadata :: Lens.Lens' DescribeJobResponse (Prelude.Maybe JobMetadata)
describeJobResponse_jobMetadata :: (Maybe JobMetadata -> f (Maybe JobMetadata))
-> DescribeJobResponse -> f DescribeJobResponse
describeJobResponse_jobMetadata = (DescribeJobResponse -> Maybe JobMetadata)
-> (DescribeJobResponse
-> Maybe JobMetadata -> DescribeJobResponse)
-> Lens
DescribeJobResponse
DescribeJobResponse
(Maybe JobMetadata)
(Maybe JobMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobResponse' {Maybe JobMetadata
jobMetadata :: Maybe JobMetadata
$sel:jobMetadata:DescribeJobResponse' :: DescribeJobResponse -> Maybe JobMetadata
jobMetadata} -> Maybe JobMetadata
jobMetadata) (\s :: DescribeJobResponse
s@DescribeJobResponse' {} Maybe JobMetadata
a -> DescribeJobResponse
s {$sel:jobMetadata:DescribeJobResponse' :: Maybe JobMetadata
jobMetadata = Maybe JobMetadata
a} :: DescribeJobResponse)
describeJobResponse_subJobMetadata :: Lens.Lens' DescribeJobResponse (Prelude.Maybe [JobMetadata])
describeJobResponse_subJobMetadata :: (Maybe [JobMetadata] -> f (Maybe [JobMetadata]))
-> DescribeJobResponse -> f DescribeJobResponse
describeJobResponse_subJobMetadata = (DescribeJobResponse -> Maybe [JobMetadata])
-> (DescribeJobResponse
-> Maybe [JobMetadata] -> DescribeJobResponse)
-> Lens
DescribeJobResponse
DescribeJobResponse
(Maybe [JobMetadata])
(Maybe [JobMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobResponse' {Maybe [JobMetadata]
subJobMetadata :: Maybe [JobMetadata]
$sel:subJobMetadata:DescribeJobResponse' :: DescribeJobResponse -> Maybe [JobMetadata]
subJobMetadata} -> Maybe [JobMetadata]
subJobMetadata) (\s :: DescribeJobResponse
s@DescribeJobResponse' {} Maybe [JobMetadata]
a -> DescribeJobResponse
s {$sel:subJobMetadata:DescribeJobResponse' :: Maybe [JobMetadata]
subJobMetadata = Maybe [JobMetadata]
a} :: DescribeJobResponse) ((Maybe [JobMetadata] -> f (Maybe [JobMetadata]))
-> DescribeJobResponse -> f DescribeJobResponse)
-> ((Maybe [JobMetadata] -> f (Maybe [JobMetadata]))
-> Maybe [JobMetadata] -> f (Maybe [JobMetadata]))
-> (Maybe [JobMetadata] -> f (Maybe [JobMetadata]))
-> DescribeJobResponse
-> f DescribeJobResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [JobMetadata] [JobMetadata] [JobMetadata] [JobMetadata]
-> Iso
(Maybe [JobMetadata])
(Maybe [JobMetadata])
(Maybe [JobMetadata])
(Maybe [JobMetadata])
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 [JobMetadata] [JobMetadata] [JobMetadata] [JobMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeJobResponse_httpStatus :: Lens.Lens' DescribeJobResponse Prelude.Int
describeJobResponse_httpStatus :: (Int -> f Int) -> DescribeJobResponse -> f DescribeJobResponse
describeJobResponse_httpStatus = (DescribeJobResponse -> Int)
-> (DescribeJobResponse -> Int -> DescribeJobResponse)
-> Lens DescribeJobResponse DescribeJobResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeJobResponse' :: DescribeJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeJobResponse
s@DescribeJobResponse' {} Int
a -> DescribeJobResponse
s {$sel:httpStatus:DescribeJobResponse' :: Int
httpStatus = Int
a} :: DescribeJobResponse)
instance Prelude.NFData DescribeJobResponse