{-# 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.GetJobManifest
(
GetJobManifest (..),
newGetJobManifest,
getJobManifest_jobId,
GetJobManifestResponse (..),
newGetJobManifestResponse,
getJobManifestResponse_manifestURI,
getJobManifestResponse_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 GetJobManifest = GetJobManifest'
{
GetJobManifest -> Text
jobId :: Prelude.Text
}
deriving (GetJobManifest -> GetJobManifest -> Bool
(GetJobManifest -> GetJobManifest -> Bool)
-> (GetJobManifest -> GetJobManifest -> Bool) -> Eq GetJobManifest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobManifest -> GetJobManifest -> Bool
$c/= :: GetJobManifest -> GetJobManifest -> Bool
== :: GetJobManifest -> GetJobManifest -> Bool
$c== :: GetJobManifest -> GetJobManifest -> Bool
Prelude.Eq, ReadPrec [GetJobManifest]
ReadPrec GetJobManifest
Int -> ReadS GetJobManifest
ReadS [GetJobManifest]
(Int -> ReadS GetJobManifest)
-> ReadS [GetJobManifest]
-> ReadPrec GetJobManifest
-> ReadPrec [GetJobManifest]
-> Read GetJobManifest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobManifest]
$creadListPrec :: ReadPrec [GetJobManifest]
readPrec :: ReadPrec GetJobManifest
$creadPrec :: ReadPrec GetJobManifest
readList :: ReadS [GetJobManifest]
$creadList :: ReadS [GetJobManifest]
readsPrec :: Int -> ReadS GetJobManifest
$creadsPrec :: Int -> ReadS GetJobManifest
Prelude.Read, Int -> GetJobManifest -> ShowS
[GetJobManifest] -> ShowS
GetJobManifest -> String
(Int -> GetJobManifest -> ShowS)
-> (GetJobManifest -> String)
-> ([GetJobManifest] -> ShowS)
-> Show GetJobManifest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobManifest] -> ShowS
$cshowList :: [GetJobManifest] -> ShowS
show :: GetJobManifest -> String
$cshow :: GetJobManifest -> String
showsPrec :: Int -> GetJobManifest -> ShowS
$cshowsPrec :: Int -> GetJobManifest -> ShowS
Prelude.Show, (forall x. GetJobManifest -> Rep GetJobManifest x)
-> (forall x. Rep GetJobManifest x -> GetJobManifest)
-> Generic GetJobManifest
forall x. Rep GetJobManifest x -> GetJobManifest
forall x. GetJobManifest -> Rep GetJobManifest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobManifest x -> GetJobManifest
$cfrom :: forall x. GetJobManifest -> Rep GetJobManifest x
Prelude.Generic)
newGetJobManifest ::
Prelude.Text ->
GetJobManifest
newGetJobManifest :: Text -> GetJobManifest
newGetJobManifest Text
pJobId_ =
GetJobManifest' :: Text -> GetJobManifest
GetJobManifest' {$sel:jobId:GetJobManifest' :: Text
jobId = Text
pJobId_}
getJobManifest_jobId :: Lens.Lens' GetJobManifest Prelude.Text
getJobManifest_jobId :: (Text -> f Text) -> GetJobManifest -> f GetJobManifest
getJobManifest_jobId = (GetJobManifest -> Text)
-> (GetJobManifest -> Text -> GetJobManifest)
-> Lens GetJobManifest GetJobManifest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobManifest' {Text
jobId :: Text
$sel:jobId:GetJobManifest' :: GetJobManifest -> Text
jobId} -> Text
jobId) (\s :: GetJobManifest
s@GetJobManifest' {} Text
a -> GetJobManifest
s {$sel:jobId:GetJobManifest' :: Text
jobId = Text
a} :: GetJobManifest)
instance Core.AWSRequest GetJobManifest where
type
AWSResponse GetJobManifest =
GetJobManifestResponse
request :: GetJobManifest -> Request GetJobManifest
request = Service -> GetJobManifest -> Request GetJobManifest
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetJobManifest
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobManifest)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetJobManifest))
-> Logger
-> Service
-> Proxy GetJobManifest
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobManifest)))
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 Text -> Int -> GetJobManifestResponse
GetJobManifestResponse'
(Maybe Text -> Int -> GetJobManifestResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetJobManifestResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ManifestURI")
Either String (Int -> GetJobManifestResponse)
-> Either String Int -> Either String GetJobManifestResponse
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 GetJobManifest
instance Prelude.NFData GetJobManifest
instance Core.ToHeaders GetJobManifest where
toHeaders :: GetJobManifest -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetJobManifest -> 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.GetJobManifest" ::
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 GetJobManifest where
toJSON :: GetJobManifest -> Value
toJSON GetJobManifest' {Text
jobId :: Text
$sel:jobId:GetJobManifest' :: GetJobManifest -> 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 GetJobManifest where
toPath :: GetJobManifest -> ByteString
toPath = ByteString -> GetJobManifest -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetJobManifest where
toQuery :: GetJobManifest -> QueryString
toQuery = QueryString -> GetJobManifest -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetJobManifestResponse = GetJobManifestResponse'
{
GetJobManifestResponse -> Maybe Text
manifestURI :: Prelude.Maybe Prelude.Text,
GetJobManifestResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetJobManifestResponse -> GetJobManifestResponse -> Bool
(GetJobManifestResponse -> GetJobManifestResponse -> Bool)
-> (GetJobManifestResponse -> GetJobManifestResponse -> Bool)
-> Eq GetJobManifestResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJobManifestResponse -> GetJobManifestResponse -> Bool
$c/= :: GetJobManifestResponse -> GetJobManifestResponse -> Bool
== :: GetJobManifestResponse -> GetJobManifestResponse -> Bool
$c== :: GetJobManifestResponse -> GetJobManifestResponse -> Bool
Prelude.Eq, ReadPrec [GetJobManifestResponse]
ReadPrec GetJobManifestResponse
Int -> ReadS GetJobManifestResponse
ReadS [GetJobManifestResponse]
(Int -> ReadS GetJobManifestResponse)
-> ReadS [GetJobManifestResponse]
-> ReadPrec GetJobManifestResponse
-> ReadPrec [GetJobManifestResponse]
-> Read GetJobManifestResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJobManifestResponse]
$creadListPrec :: ReadPrec [GetJobManifestResponse]
readPrec :: ReadPrec GetJobManifestResponse
$creadPrec :: ReadPrec GetJobManifestResponse
readList :: ReadS [GetJobManifestResponse]
$creadList :: ReadS [GetJobManifestResponse]
readsPrec :: Int -> ReadS GetJobManifestResponse
$creadsPrec :: Int -> ReadS GetJobManifestResponse
Prelude.Read, Int -> GetJobManifestResponse -> ShowS
[GetJobManifestResponse] -> ShowS
GetJobManifestResponse -> String
(Int -> GetJobManifestResponse -> ShowS)
-> (GetJobManifestResponse -> String)
-> ([GetJobManifestResponse] -> ShowS)
-> Show GetJobManifestResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJobManifestResponse] -> ShowS
$cshowList :: [GetJobManifestResponse] -> ShowS
show :: GetJobManifestResponse -> String
$cshow :: GetJobManifestResponse -> String
showsPrec :: Int -> GetJobManifestResponse -> ShowS
$cshowsPrec :: Int -> GetJobManifestResponse -> ShowS
Prelude.Show, (forall x. GetJobManifestResponse -> Rep GetJobManifestResponse x)
-> (forall x.
Rep GetJobManifestResponse x -> GetJobManifestResponse)
-> Generic GetJobManifestResponse
forall x. Rep GetJobManifestResponse x -> GetJobManifestResponse
forall x. GetJobManifestResponse -> Rep GetJobManifestResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJobManifestResponse x -> GetJobManifestResponse
$cfrom :: forall x. GetJobManifestResponse -> Rep GetJobManifestResponse x
Prelude.Generic)
newGetJobManifestResponse ::
Prelude.Int ->
GetJobManifestResponse
newGetJobManifestResponse :: Int -> GetJobManifestResponse
newGetJobManifestResponse Int
pHttpStatus_ =
GetJobManifestResponse' :: Maybe Text -> Int -> GetJobManifestResponse
GetJobManifestResponse'
{ $sel:manifestURI:GetJobManifestResponse' :: Maybe Text
manifestURI =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetJobManifestResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getJobManifestResponse_manifestURI :: Lens.Lens' GetJobManifestResponse (Prelude.Maybe Prelude.Text)
getJobManifestResponse_manifestURI :: (Maybe Text -> f (Maybe Text))
-> GetJobManifestResponse -> f GetJobManifestResponse
getJobManifestResponse_manifestURI = (GetJobManifestResponse -> Maybe Text)
-> (GetJobManifestResponse -> Maybe Text -> GetJobManifestResponse)
-> Lens
GetJobManifestResponse
GetJobManifestResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobManifestResponse' {Maybe Text
manifestURI :: Maybe Text
$sel:manifestURI:GetJobManifestResponse' :: GetJobManifestResponse -> Maybe Text
manifestURI} -> Maybe Text
manifestURI) (\s :: GetJobManifestResponse
s@GetJobManifestResponse' {} Maybe Text
a -> GetJobManifestResponse
s {$sel:manifestURI:GetJobManifestResponse' :: Maybe Text
manifestURI = Maybe Text
a} :: GetJobManifestResponse)
getJobManifestResponse_httpStatus :: Lens.Lens' GetJobManifestResponse Prelude.Int
getJobManifestResponse_httpStatus :: (Int -> f Int)
-> GetJobManifestResponse -> f GetJobManifestResponse
getJobManifestResponse_httpStatus = (GetJobManifestResponse -> Int)
-> (GetJobManifestResponse -> Int -> GetJobManifestResponse)
-> Lens GetJobManifestResponse GetJobManifestResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJobManifestResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetJobManifestResponse' :: GetJobManifestResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetJobManifestResponse
s@GetJobManifestResponse' {} Int
a -> GetJobManifestResponse
s {$sel:httpStatus:GetJobManifestResponse' :: Int
httpStatus = Int
a} :: GetJobManifestResponse)
instance Prelude.NFData GetJobManifestResponse