{-# 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.DescribeReturnShippingLabel
(
DescribeReturnShippingLabel (..),
newDescribeReturnShippingLabel,
describeReturnShippingLabel_jobId,
DescribeReturnShippingLabelResponse (..),
newDescribeReturnShippingLabelResponse,
describeReturnShippingLabelResponse_status,
describeReturnShippingLabelResponse_expirationDate,
describeReturnShippingLabelResponse_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 DescribeReturnShippingLabel = DescribeReturnShippingLabel'
{
DescribeReturnShippingLabel -> Text
jobId :: Prelude.Text
}
deriving (DescribeReturnShippingLabel -> DescribeReturnShippingLabel -> Bool
(DescribeReturnShippingLabel
-> DescribeReturnShippingLabel -> Bool)
-> (DescribeReturnShippingLabel
-> DescribeReturnShippingLabel -> Bool)
-> Eq DescribeReturnShippingLabel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReturnShippingLabel -> DescribeReturnShippingLabel -> Bool
$c/= :: DescribeReturnShippingLabel -> DescribeReturnShippingLabel -> Bool
== :: DescribeReturnShippingLabel -> DescribeReturnShippingLabel -> Bool
$c== :: DescribeReturnShippingLabel -> DescribeReturnShippingLabel -> Bool
Prelude.Eq, ReadPrec [DescribeReturnShippingLabel]
ReadPrec DescribeReturnShippingLabel
Int -> ReadS DescribeReturnShippingLabel
ReadS [DescribeReturnShippingLabel]
(Int -> ReadS DescribeReturnShippingLabel)
-> ReadS [DescribeReturnShippingLabel]
-> ReadPrec DescribeReturnShippingLabel
-> ReadPrec [DescribeReturnShippingLabel]
-> Read DescribeReturnShippingLabel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReturnShippingLabel]
$creadListPrec :: ReadPrec [DescribeReturnShippingLabel]
readPrec :: ReadPrec DescribeReturnShippingLabel
$creadPrec :: ReadPrec DescribeReturnShippingLabel
readList :: ReadS [DescribeReturnShippingLabel]
$creadList :: ReadS [DescribeReturnShippingLabel]
readsPrec :: Int -> ReadS DescribeReturnShippingLabel
$creadsPrec :: Int -> ReadS DescribeReturnShippingLabel
Prelude.Read, Int -> DescribeReturnShippingLabel -> ShowS
[DescribeReturnShippingLabel] -> ShowS
DescribeReturnShippingLabel -> String
(Int -> DescribeReturnShippingLabel -> ShowS)
-> (DescribeReturnShippingLabel -> String)
-> ([DescribeReturnShippingLabel] -> ShowS)
-> Show DescribeReturnShippingLabel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReturnShippingLabel] -> ShowS
$cshowList :: [DescribeReturnShippingLabel] -> ShowS
show :: DescribeReturnShippingLabel -> String
$cshow :: DescribeReturnShippingLabel -> String
showsPrec :: Int -> DescribeReturnShippingLabel -> ShowS
$cshowsPrec :: Int -> DescribeReturnShippingLabel -> ShowS
Prelude.Show, (forall x.
DescribeReturnShippingLabel -> Rep DescribeReturnShippingLabel x)
-> (forall x.
Rep DescribeReturnShippingLabel x -> DescribeReturnShippingLabel)
-> Generic DescribeReturnShippingLabel
forall x.
Rep DescribeReturnShippingLabel x -> DescribeReturnShippingLabel
forall x.
DescribeReturnShippingLabel -> Rep DescribeReturnShippingLabel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReturnShippingLabel x -> DescribeReturnShippingLabel
$cfrom :: forall x.
DescribeReturnShippingLabel -> Rep DescribeReturnShippingLabel x
Prelude.Generic)
newDescribeReturnShippingLabel ::
Prelude.Text ->
DescribeReturnShippingLabel
newDescribeReturnShippingLabel :: Text -> DescribeReturnShippingLabel
newDescribeReturnShippingLabel Text
pJobId_ =
DescribeReturnShippingLabel' :: Text -> DescribeReturnShippingLabel
DescribeReturnShippingLabel' {$sel:jobId:DescribeReturnShippingLabel' :: Text
jobId = Text
pJobId_}
describeReturnShippingLabel_jobId :: Lens.Lens' DescribeReturnShippingLabel Prelude.Text
describeReturnShippingLabel_jobId :: (Text -> f Text)
-> DescribeReturnShippingLabel -> f DescribeReturnShippingLabel
describeReturnShippingLabel_jobId = (DescribeReturnShippingLabel -> Text)
-> (DescribeReturnShippingLabel
-> Text -> DescribeReturnShippingLabel)
-> Lens
DescribeReturnShippingLabel DescribeReturnShippingLabel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReturnShippingLabel' {Text
jobId :: Text
$sel:jobId:DescribeReturnShippingLabel' :: DescribeReturnShippingLabel -> Text
jobId} -> Text
jobId) (\s :: DescribeReturnShippingLabel
s@DescribeReturnShippingLabel' {} Text
a -> DescribeReturnShippingLabel
s {$sel:jobId:DescribeReturnShippingLabel' :: Text
jobId = Text
a} :: DescribeReturnShippingLabel)
instance Core.AWSRequest DescribeReturnShippingLabel where
type
AWSResponse DescribeReturnShippingLabel =
DescribeReturnShippingLabelResponse
request :: DescribeReturnShippingLabel -> Request DescribeReturnShippingLabel
request = Service
-> DescribeReturnShippingLabel
-> Request DescribeReturnShippingLabel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeReturnShippingLabel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReturnShippingLabel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeReturnShippingLabel))
-> Logger
-> Service
-> Proxy DescribeReturnShippingLabel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReturnShippingLabel)))
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 ShippingLabelStatus
-> Maybe POSIX -> Int -> DescribeReturnShippingLabelResponse
DescribeReturnShippingLabelResponse'
(Maybe ShippingLabelStatus
-> Maybe POSIX -> Int -> DescribeReturnShippingLabelResponse)
-> Either String (Maybe ShippingLabelStatus)
-> Either
String (Maybe POSIX -> Int -> DescribeReturnShippingLabelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ShippingLabelStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either
String (Maybe POSIX -> Int -> DescribeReturnShippingLabelResponse)
-> Either String (Maybe POSIX)
-> Either String (Int -> DescribeReturnShippingLabelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ExpirationDate")
Either String (Int -> DescribeReturnShippingLabelResponse)
-> Either String Int
-> Either String DescribeReturnShippingLabelResponse
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 DescribeReturnShippingLabel
instance Prelude.NFData DescribeReturnShippingLabel
instance Core.ToHeaders DescribeReturnShippingLabel where
toHeaders :: DescribeReturnShippingLabel -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeReturnShippingLabel -> 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.DescribeReturnShippingLabel" ::
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 DescribeReturnShippingLabel where
toJSON :: DescribeReturnShippingLabel -> Value
toJSON DescribeReturnShippingLabel' {Text
jobId :: Text
$sel:jobId:DescribeReturnShippingLabel' :: DescribeReturnShippingLabel -> 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 DescribeReturnShippingLabel where
toPath :: DescribeReturnShippingLabel -> ByteString
toPath = ByteString -> DescribeReturnShippingLabel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeReturnShippingLabel where
toQuery :: DescribeReturnShippingLabel -> QueryString
toQuery = QueryString -> DescribeReturnShippingLabel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeReturnShippingLabelResponse = DescribeReturnShippingLabelResponse'
{
DescribeReturnShippingLabelResponse -> Maybe ShippingLabelStatus
status :: Prelude.Maybe ShippingLabelStatus,
DescribeReturnShippingLabelResponse -> Maybe POSIX
expirationDate :: Prelude.Maybe Core.POSIX,
DescribeReturnShippingLabelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool
(DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool)
-> (DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool)
-> Eq DescribeReturnShippingLabelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool
$c/= :: DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool
== :: DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool
$c== :: DescribeReturnShippingLabelResponse
-> DescribeReturnShippingLabelResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReturnShippingLabelResponse]
ReadPrec DescribeReturnShippingLabelResponse
Int -> ReadS DescribeReturnShippingLabelResponse
ReadS [DescribeReturnShippingLabelResponse]
(Int -> ReadS DescribeReturnShippingLabelResponse)
-> ReadS [DescribeReturnShippingLabelResponse]
-> ReadPrec DescribeReturnShippingLabelResponse
-> ReadPrec [DescribeReturnShippingLabelResponse]
-> Read DescribeReturnShippingLabelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReturnShippingLabelResponse]
$creadListPrec :: ReadPrec [DescribeReturnShippingLabelResponse]
readPrec :: ReadPrec DescribeReturnShippingLabelResponse
$creadPrec :: ReadPrec DescribeReturnShippingLabelResponse
readList :: ReadS [DescribeReturnShippingLabelResponse]
$creadList :: ReadS [DescribeReturnShippingLabelResponse]
readsPrec :: Int -> ReadS DescribeReturnShippingLabelResponse
$creadsPrec :: Int -> ReadS DescribeReturnShippingLabelResponse
Prelude.Read, Int -> DescribeReturnShippingLabelResponse -> ShowS
[DescribeReturnShippingLabelResponse] -> ShowS
DescribeReturnShippingLabelResponse -> String
(Int -> DescribeReturnShippingLabelResponse -> ShowS)
-> (DescribeReturnShippingLabelResponse -> String)
-> ([DescribeReturnShippingLabelResponse] -> ShowS)
-> Show DescribeReturnShippingLabelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReturnShippingLabelResponse] -> ShowS
$cshowList :: [DescribeReturnShippingLabelResponse] -> ShowS
show :: DescribeReturnShippingLabelResponse -> String
$cshow :: DescribeReturnShippingLabelResponse -> String
showsPrec :: Int -> DescribeReturnShippingLabelResponse -> ShowS
$cshowsPrec :: Int -> DescribeReturnShippingLabelResponse -> ShowS
Prelude.Show, (forall x.
DescribeReturnShippingLabelResponse
-> Rep DescribeReturnShippingLabelResponse x)
-> (forall x.
Rep DescribeReturnShippingLabelResponse x
-> DescribeReturnShippingLabelResponse)
-> Generic DescribeReturnShippingLabelResponse
forall x.
Rep DescribeReturnShippingLabelResponse x
-> DescribeReturnShippingLabelResponse
forall x.
DescribeReturnShippingLabelResponse
-> Rep DescribeReturnShippingLabelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReturnShippingLabelResponse x
-> DescribeReturnShippingLabelResponse
$cfrom :: forall x.
DescribeReturnShippingLabelResponse
-> Rep DescribeReturnShippingLabelResponse x
Prelude.Generic)
newDescribeReturnShippingLabelResponse ::
Prelude.Int ->
DescribeReturnShippingLabelResponse
newDescribeReturnShippingLabelResponse :: Int -> DescribeReturnShippingLabelResponse
newDescribeReturnShippingLabelResponse Int
pHttpStatus_ =
DescribeReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
-> Maybe POSIX -> Int -> DescribeReturnShippingLabelResponse
DescribeReturnShippingLabelResponse'
{ $sel:status:DescribeReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
status =
Maybe ShippingLabelStatus
forall a. Maybe a
Prelude.Nothing,
$sel:expirationDate:DescribeReturnShippingLabelResponse' :: Maybe POSIX
expirationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeReturnShippingLabelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeReturnShippingLabelResponse_status :: Lens.Lens' DescribeReturnShippingLabelResponse (Prelude.Maybe ShippingLabelStatus)
describeReturnShippingLabelResponse_status :: (Maybe ShippingLabelStatus -> f (Maybe ShippingLabelStatus))
-> DescribeReturnShippingLabelResponse
-> f DescribeReturnShippingLabelResponse
describeReturnShippingLabelResponse_status = (DescribeReturnShippingLabelResponse -> Maybe ShippingLabelStatus)
-> (DescribeReturnShippingLabelResponse
-> Maybe ShippingLabelStatus
-> DescribeReturnShippingLabelResponse)
-> Lens
DescribeReturnShippingLabelResponse
DescribeReturnShippingLabelResponse
(Maybe ShippingLabelStatus)
(Maybe ShippingLabelStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReturnShippingLabelResponse' {Maybe ShippingLabelStatus
status :: Maybe ShippingLabelStatus
$sel:status:DescribeReturnShippingLabelResponse' :: DescribeReturnShippingLabelResponse -> Maybe ShippingLabelStatus
status} -> Maybe ShippingLabelStatus
status) (\s :: DescribeReturnShippingLabelResponse
s@DescribeReturnShippingLabelResponse' {} Maybe ShippingLabelStatus
a -> DescribeReturnShippingLabelResponse
s {$sel:status:DescribeReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
status = Maybe ShippingLabelStatus
a} :: DescribeReturnShippingLabelResponse)
describeReturnShippingLabelResponse_expirationDate :: Lens.Lens' DescribeReturnShippingLabelResponse (Prelude.Maybe Prelude.UTCTime)
describeReturnShippingLabelResponse_expirationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeReturnShippingLabelResponse
-> f DescribeReturnShippingLabelResponse
describeReturnShippingLabelResponse_expirationDate = (DescribeReturnShippingLabelResponse -> Maybe POSIX)
-> (DescribeReturnShippingLabelResponse
-> Maybe POSIX -> DescribeReturnShippingLabelResponse)
-> Lens
DescribeReturnShippingLabelResponse
DescribeReturnShippingLabelResponse
(Maybe POSIX)
(Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReturnShippingLabelResponse' {Maybe POSIX
expirationDate :: Maybe POSIX
$sel:expirationDate:DescribeReturnShippingLabelResponse' :: DescribeReturnShippingLabelResponse -> Maybe POSIX
expirationDate} -> Maybe POSIX
expirationDate) (\s :: DescribeReturnShippingLabelResponse
s@DescribeReturnShippingLabelResponse' {} Maybe POSIX
a -> DescribeReturnShippingLabelResponse
s {$sel:expirationDate:DescribeReturnShippingLabelResponse' :: Maybe POSIX
expirationDate = Maybe POSIX
a} :: DescribeReturnShippingLabelResponse) ((Maybe POSIX -> f (Maybe POSIX))
-> DescribeReturnShippingLabelResponse
-> f DescribeReturnShippingLabelResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeReturnShippingLabelResponse
-> f DescribeReturnShippingLabelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
describeReturnShippingLabelResponse_httpStatus :: Lens.Lens' DescribeReturnShippingLabelResponse Prelude.Int
describeReturnShippingLabelResponse_httpStatus :: (Int -> f Int)
-> DescribeReturnShippingLabelResponse
-> f DescribeReturnShippingLabelResponse
describeReturnShippingLabelResponse_httpStatus = (DescribeReturnShippingLabelResponse -> Int)
-> (DescribeReturnShippingLabelResponse
-> Int -> DescribeReturnShippingLabelResponse)
-> Lens
DescribeReturnShippingLabelResponse
DescribeReturnShippingLabelResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReturnShippingLabelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeReturnShippingLabelResponse' :: DescribeReturnShippingLabelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeReturnShippingLabelResponse
s@DescribeReturnShippingLabelResponse' {} Int
a -> DescribeReturnShippingLabelResponse
s {$sel:httpStatus:DescribeReturnShippingLabelResponse' :: Int
httpStatus = Int
a} :: DescribeReturnShippingLabelResponse)
instance
Prelude.NFData
DescribeReturnShippingLabelResponse