{-# 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.StorageGateway.RetrieveTapeArchive
(
RetrieveTapeArchive (..),
newRetrieveTapeArchive,
retrieveTapeArchive_tapeARN,
retrieveTapeArchive_gatewayARN,
RetrieveTapeArchiveResponse (..),
newRetrieveTapeArchiveResponse,
retrieveTapeArchiveResponse_tapeARN,
retrieveTapeArchiveResponse_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.StorageGateway.Types
data RetrieveTapeArchive = RetrieveTapeArchive'
{
RetrieveTapeArchive -> Text
tapeARN :: Prelude.Text,
RetrieveTapeArchive -> Text
gatewayARN :: Prelude.Text
}
deriving (RetrieveTapeArchive -> RetrieveTapeArchive -> Bool
(RetrieveTapeArchive -> RetrieveTapeArchive -> Bool)
-> (RetrieveTapeArchive -> RetrieveTapeArchive -> Bool)
-> Eq RetrieveTapeArchive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetrieveTapeArchive -> RetrieveTapeArchive -> Bool
$c/= :: RetrieveTapeArchive -> RetrieveTapeArchive -> Bool
== :: RetrieveTapeArchive -> RetrieveTapeArchive -> Bool
$c== :: RetrieveTapeArchive -> RetrieveTapeArchive -> Bool
Prelude.Eq, ReadPrec [RetrieveTapeArchive]
ReadPrec RetrieveTapeArchive
Int -> ReadS RetrieveTapeArchive
ReadS [RetrieveTapeArchive]
(Int -> ReadS RetrieveTapeArchive)
-> ReadS [RetrieveTapeArchive]
-> ReadPrec RetrieveTapeArchive
-> ReadPrec [RetrieveTapeArchive]
-> Read RetrieveTapeArchive
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetrieveTapeArchive]
$creadListPrec :: ReadPrec [RetrieveTapeArchive]
readPrec :: ReadPrec RetrieveTapeArchive
$creadPrec :: ReadPrec RetrieveTapeArchive
readList :: ReadS [RetrieveTapeArchive]
$creadList :: ReadS [RetrieveTapeArchive]
readsPrec :: Int -> ReadS RetrieveTapeArchive
$creadsPrec :: Int -> ReadS RetrieveTapeArchive
Prelude.Read, Int -> RetrieveTapeArchive -> ShowS
[RetrieveTapeArchive] -> ShowS
RetrieveTapeArchive -> String
(Int -> RetrieveTapeArchive -> ShowS)
-> (RetrieveTapeArchive -> String)
-> ([RetrieveTapeArchive] -> ShowS)
-> Show RetrieveTapeArchive
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetrieveTapeArchive] -> ShowS
$cshowList :: [RetrieveTapeArchive] -> ShowS
show :: RetrieveTapeArchive -> String
$cshow :: RetrieveTapeArchive -> String
showsPrec :: Int -> RetrieveTapeArchive -> ShowS
$cshowsPrec :: Int -> RetrieveTapeArchive -> ShowS
Prelude.Show, (forall x. RetrieveTapeArchive -> Rep RetrieveTapeArchive x)
-> (forall x. Rep RetrieveTapeArchive x -> RetrieveTapeArchive)
-> Generic RetrieveTapeArchive
forall x. Rep RetrieveTapeArchive x -> RetrieveTapeArchive
forall x. RetrieveTapeArchive -> Rep RetrieveTapeArchive x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RetrieveTapeArchive x -> RetrieveTapeArchive
$cfrom :: forall x. RetrieveTapeArchive -> Rep RetrieveTapeArchive x
Prelude.Generic)
newRetrieveTapeArchive ::
Prelude.Text ->
Prelude.Text ->
RetrieveTapeArchive
newRetrieveTapeArchive :: Text -> Text -> RetrieveTapeArchive
newRetrieveTapeArchive Text
pTapeARN_ Text
pGatewayARN_ =
RetrieveTapeArchive' :: Text -> Text -> RetrieveTapeArchive
RetrieveTapeArchive'
{ $sel:tapeARN:RetrieveTapeArchive' :: Text
tapeARN = Text
pTapeARN_,
$sel:gatewayARN:RetrieveTapeArchive' :: Text
gatewayARN = Text
pGatewayARN_
}
retrieveTapeArchive_tapeARN :: Lens.Lens' RetrieveTapeArchive Prelude.Text
retrieveTapeArchive_tapeARN :: (Text -> f Text) -> RetrieveTapeArchive -> f RetrieveTapeArchive
retrieveTapeArchive_tapeARN = (RetrieveTapeArchive -> Text)
-> (RetrieveTapeArchive -> Text -> RetrieveTapeArchive)
-> Lens RetrieveTapeArchive RetrieveTapeArchive Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetrieveTapeArchive' {Text
tapeARN :: Text
$sel:tapeARN:RetrieveTapeArchive' :: RetrieveTapeArchive -> Text
tapeARN} -> Text
tapeARN) (\s :: RetrieveTapeArchive
s@RetrieveTapeArchive' {} Text
a -> RetrieveTapeArchive
s {$sel:tapeARN:RetrieveTapeArchive' :: Text
tapeARN = Text
a} :: RetrieveTapeArchive)
retrieveTapeArchive_gatewayARN :: Lens.Lens' RetrieveTapeArchive Prelude.Text
retrieveTapeArchive_gatewayARN :: (Text -> f Text) -> RetrieveTapeArchive -> f RetrieveTapeArchive
retrieveTapeArchive_gatewayARN = (RetrieveTapeArchive -> Text)
-> (RetrieveTapeArchive -> Text -> RetrieveTapeArchive)
-> Lens RetrieveTapeArchive RetrieveTapeArchive Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetrieveTapeArchive' {Text
gatewayARN :: Text
$sel:gatewayARN:RetrieveTapeArchive' :: RetrieveTapeArchive -> Text
gatewayARN} -> Text
gatewayARN) (\s :: RetrieveTapeArchive
s@RetrieveTapeArchive' {} Text
a -> RetrieveTapeArchive
s {$sel:gatewayARN:RetrieveTapeArchive' :: Text
gatewayARN = Text
a} :: RetrieveTapeArchive)
instance Core.AWSRequest RetrieveTapeArchive where
type
AWSResponse RetrieveTapeArchive =
RetrieveTapeArchiveResponse
request :: RetrieveTapeArchive -> Request RetrieveTapeArchive
request = Service -> RetrieveTapeArchive -> Request RetrieveTapeArchive
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RetrieveTapeArchive
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RetrieveTapeArchive)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RetrieveTapeArchive))
-> Logger
-> Service
-> Proxy RetrieveTapeArchive
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RetrieveTapeArchive)))
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 -> RetrieveTapeArchiveResponse
RetrieveTapeArchiveResponse'
(Maybe Text -> Int -> RetrieveTapeArchiveResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RetrieveTapeArchiveResponse)
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
"TapeARN")
Either String (Int -> RetrieveTapeArchiveResponse)
-> Either String Int -> Either String RetrieveTapeArchiveResponse
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 RetrieveTapeArchive
instance Prelude.NFData RetrieveTapeArchive
instance Core.ToHeaders RetrieveTapeArchive where
toHeaders :: RetrieveTapeArchive -> ResponseHeaders
toHeaders =
ResponseHeaders -> RetrieveTapeArchive -> 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
"StorageGateway_20130630.RetrieveTapeArchive" ::
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 RetrieveTapeArchive where
toJSON :: RetrieveTapeArchive -> Value
toJSON RetrieveTapeArchive' {Text
gatewayARN :: Text
tapeARN :: Text
$sel:gatewayARN:RetrieveTapeArchive' :: RetrieveTapeArchive -> Text
$sel:tapeARN:RetrieveTapeArchive' :: RetrieveTapeArchive -> 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
"TapeARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tapeARN),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN)
]
)
instance Core.ToPath RetrieveTapeArchive where
toPath :: RetrieveTapeArchive -> ByteString
toPath = ByteString -> RetrieveTapeArchive -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RetrieveTapeArchive where
toQuery :: RetrieveTapeArchive -> QueryString
toQuery = QueryString -> RetrieveTapeArchive -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RetrieveTapeArchiveResponse = RetrieveTapeArchiveResponse'
{
RetrieveTapeArchiveResponse -> Maybe Text
tapeARN :: Prelude.Maybe Prelude.Text,
RetrieveTapeArchiveResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RetrieveTapeArchiveResponse -> RetrieveTapeArchiveResponse -> Bool
(RetrieveTapeArchiveResponse
-> RetrieveTapeArchiveResponse -> Bool)
-> (RetrieveTapeArchiveResponse
-> RetrieveTapeArchiveResponse -> Bool)
-> Eq RetrieveTapeArchiveResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetrieveTapeArchiveResponse -> RetrieveTapeArchiveResponse -> Bool
$c/= :: RetrieveTapeArchiveResponse -> RetrieveTapeArchiveResponse -> Bool
== :: RetrieveTapeArchiveResponse -> RetrieveTapeArchiveResponse -> Bool
$c== :: RetrieveTapeArchiveResponse -> RetrieveTapeArchiveResponse -> Bool
Prelude.Eq, ReadPrec [RetrieveTapeArchiveResponse]
ReadPrec RetrieveTapeArchiveResponse
Int -> ReadS RetrieveTapeArchiveResponse
ReadS [RetrieveTapeArchiveResponse]
(Int -> ReadS RetrieveTapeArchiveResponse)
-> ReadS [RetrieveTapeArchiveResponse]
-> ReadPrec RetrieveTapeArchiveResponse
-> ReadPrec [RetrieveTapeArchiveResponse]
-> Read RetrieveTapeArchiveResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RetrieveTapeArchiveResponse]
$creadListPrec :: ReadPrec [RetrieveTapeArchiveResponse]
readPrec :: ReadPrec RetrieveTapeArchiveResponse
$creadPrec :: ReadPrec RetrieveTapeArchiveResponse
readList :: ReadS [RetrieveTapeArchiveResponse]
$creadList :: ReadS [RetrieveTapeArchiveResponse]
readsPrec :: Int -> ReadS RetrieveTapeArchiveResponse
$creadsPrec :: Int -> ReadS RetrieveTapeArchiveResponse
Prelude.Read, Int -> RetrieveTapeArchiveResponse -> ShowS
[RetrieveTapeArchiveResponse] -> ShowS
RetrieveTapeArchiveResponse -> String
(Int -> RetrieveTapeArchiveResponse -> ShowS)
-> (RetrieveTapeArchiveResponse -> String)
-> ([RetrieveTapeArchiveResponse] -> ShowS)
-> Show RetrieveTapeArchiveResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetrieveTapeArchiveResponse] -> ShowS
$cshowList :: [RetrieveTapeArchiveResponse] -> ShowS
show :: RetrieveTapeArchiveResponse -> String
$cshow :: RetrieveTapeArchiveResponse -> String
showsPrec :: Int -> RetrieveTapeArchiveResponse -> ShowS
$cshowsPrec :: Int -> RetrieveTapeArchiveResponse -> ShowS
Prelude.Show, (forall x.
RetrieveTapeArchiveResponse -> Rep RetrieveTapeArchiveResponse x)
-> (forall x.
Rep RetrieveTapeArchiveResponse x -> RetrieveTapeArchiveResponse)
-> Generic RetrieveTapeArchiveResponse
forall x.
Rep RetrieveTapeArchiveResponse x -> RetrieveTapeArchiveResponse
forall x.
RetrieveTapeArchiveResponse -> Rep RetrieveTapeArchiveResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RetrieveTapeArchiveResponse x -> RetrieveTapeArchiveResponse
$cfrom :: forall x.
RetrieveTapeArchiveResponse -> Rep RetrieveTapeArchiveResponse x
Prelude.Generic)
newRetrieveTapeArchiveResponse ::
Prelude.Int ->
RetrieveTapeArchiveResponse
newRetrieveTapeArchiveResponse :: Int -> RetrieveTapeArchiveResponse
newRetrieveTapeArchiveResponse Int
pHttpStatus_ =
RetrieveTapeArchiveResponse' :: Maybe Text -> Int -> RetrieveTapeArchiveResponse
RetrieveTapeArchiveResponse'
{ $sel:tapeARN:RetrieveTapeArchiveResponse' :: Maybe Text
tapeARN =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RetrieveTapeArchiveResponse' :: Int
httpStatus = Int
pHttpStatus_
}
retrieveTapeArchiveResponse_tapeARN :: Lens.Lens' RetrieveTapeArchiveResponse (Prelude.Maybe Prelude.Text)
retrieveTapeArchiveResponse_tapeARN :: (Maybe Text -> f (Maybe Text))
-> RetrieveTapeArchiveResponse -> f RetrieveTapeArchiveResponse
retrieveTapeArchiveResponse_tapeARN = (RetrieveTapeArchiveResponse -> Maybe Text)
-> (RetrieveTapeArchiveResponse
-> Maybe Text -> RetrieveTapeArchiveResponse)
-> Lens
RetrieveTapeArchiveResponse
RetrieveTapeArchiveResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetrieveTapeArchiveResponse' {Maybe Text
tapeARN :: Maybe Text
$sel:tapeARN:RetrieveTapeArchiveResponse' :: RetrieveTapeArchiveResponse -> Maybe Text
tapeARN} -> Maybe Text
tapeARN) (\s :: RetrieveTapeArchiveResponse
s@RetrieveTapeArchiveResponse' {} Maybe Text
a -> RetrieveTapeArchiveResponse
s {$sel:tapeARN:RetrieveTapeArchiveResponse' :: Maybe Text
tapeARN = Maybe Text
a} :: RetrieveTapeArchiveResponse)
retrieveTapeArchiveResponse_httpStatus :: Lens.Lens' RetrieveTapeArchiveResponse Prelude.Int
retrieveTapeArchiveResponse_httpStatus :: (Int -> f Int)
-> RetrieveTapeArchiveResponse -> f RetrieveTapeArchiveResponse
retrieveTapeArchiveResponse_httpStatus = (RetrieveTapeArchiveResponse -> Int)
-> (RetrieveTapeArchiveResponse
-> Int -> RetrieveTapeArchiveResponse)
-> Lens
RetrieveTapeArchiveResponse RetrieveTapeArchiveResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RetrieveTapeArchiveResponse' {Int
httpStatus :: Int
$sel:httpStatus:RetrieveTapeArchiveResponse' :: RetrieveTapeArchiveResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RetrieveTapeArchiveResponse
s@RetrieveTapeArchiveResponse' {} Int
a -> RetrieveTapeArchiveResponse
s {$sel:httpStatus:RetrieveTapeArchiveResponse' :: Int
httpStatus = Int
a} :: RetrieveTapeArchiveResponse)
instance Prelude.NFData RetrieveTapeArchiveResponse