{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:jobId:GetJobUnlockCode' :: Text
jobId = Text
pJobId_}
getJobUnlockCode_jobId :: Lens.Lens' GetJobUnlockCode Prelude.Text
getJobUnlockCode_jobId :: Lens' GetJobUnlockCode Text
getJobUnlockCode_jobId = 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 :: (Service -> Service)
-> GetJobUnlockCode -> Request GetJobUnlockCode
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetJobUnlockCode
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJobUnlockCode)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> GetJobUnlockCodeResponse
GetJobUnlockCodeResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UnlockCode")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetJobUnlockCode where
hashWithSalt :: Int -> GetJobUnlockCode -> Int
hashWithSalt Int
_salt GetJobUnlockCode' {Text
jobId :: Text
$sel:jobId:GetJobUnlockCode' :: GetJobUnlockCode -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId
instance Prelude.NFData GetJobUnlockCode where
rnf :: GetJobUnlockCode -> ()
rnf GetJobUnlockCode' {Text
jobId :: Text
$sel:jobId:GetJobUnlockCode' :: GetJobUnlockCode -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
jobId
instance Data.ToHeaders GetJobUnlockCode where
toHeaders :: GetJobUnlockCode -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSIESnowballJobManagementService.GetJobUnlockCode" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetJobUnlockCode where
toJSON :: GetJobUnlockCode -> Value
toJSON GetJobUnlockCode' {Text
jobId :: Text
$sel:jobId:GetJobUnlockCode' :: GetJobUnlockCode -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"JobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobId)]
)
instance Data.ToPath GetJobUnlockCode where
toPath :: GetJobUnlockCode -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetJobUnlockCode where
toQuery :: GetJobUnlockCode -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:unlockCode:GetJobUnlockCodeResponse' :: Maybe Text
unlockCode =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetJobUnlockCodeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getJobUnlockCodeResponse_unlockCode :: Lens.Lens' GetJobUnlockCodeResponse (Prelude.Maybe Prelude.Text)
getJobUnlockCodeResponse_unlockCode :: Lens' GetJobUnlockCodeResponse (Maybe Text)
getJobUnlockCodeResponse_unlockCode = 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 :: Lens' GetJobUnlockCodeResponse Int
getJobUnlockCodeResponse_httpStatus = 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 where
rnf :: GetJobUnlockCodeResponse -> ()
rnf GetJobUnlockCodeResponse' {Int
Maybe Text
httpStatus :: Int
unlockCode :: Maybe Text
$sel:httpStatus:GetJobUnlockCodeResponse' :: GetJobUnlockCodeResponse -> Int
$sel:unlockCode:GetJobUnlockCodeResponse' :: GetJobUnlockCodeResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
unlockCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus