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