{-# 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.CreateReturnShippingLabel
(
CreateReturnShippingLabel (..),
newCreateReturnShippingLabel,
createReturnShippingLabel_shippingOption,
createReturnShippingLabel_jobId,
CreateReturnShippingLabelResponse (..),
newCreateReturnShippingLabelResponse,
createReturnShippingLabelResponse_status,
createReturnShippingLabelResponse_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 CreateReturnShippingLabel = CreateReturnShippingLabel'
{
CreateReturnShippingLabel -> Maybe ShippingOption
shippingOption :: Prelude.Maybe ShippingOption,
CreateReturnShippingLabel -> Text
jobId :: Prelude.Text
}
deriving (CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool
(CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool)
-> (CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool)
-> Eq CreateReturnShippingLabel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool
$c/= :: CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool
== :: CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool
$c== :: CreateReturnShippingLabel -> CreateReturnShippingLabel -> Bool
Prelude.Eq, ReadPrec [CreateReturnShippingLabel]
ReadPrec CreateReturnShippingLabel
Int -> ReadS CreateReturnShippingLabel
ReadS [CreateReturnShippingLabel]
(Int -> ReadS CreateReturnShippingLabel)
-> ReadS [CreateReturnShippingLabel]
-> ReadPrec CreateReturnShippingLabel
-> ReadPrec [CreateReturnShippingLabel]
-> Read CreateReturnShippingLabel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReturnShippingLabel]
$creadListPrec :: ReadPrec [CreateReturnShippingLabel]
readPrec :: ReadPrec CreateReturnShippingLabel
$creadPrec :: ReadPrec CreateReturnShippingLabel
readList :: ReadS [CreateReturnShippingLabel]
$creadList :: ReadS [CreateReturnShippingLabel]
readsPrec :: Int -> ReadS CreateReturnShippingLabel
$creadsPrec :: Int -> ReadS CreateReturnShippingLabel
Prelude.Read, Int -> CreateReturnShippingLabel -> ShowS
[CreateReturnShippingLabel] -> ShowS
CreateReturnShippingLabel -> String
(Int -> CreateReturnShippingLabel -> ShowS)
-> (CreateReturnShippingLabel -> String)
-> ([CreateReturnShippingLabel] -> ShowS)
-> Show CreateReturnShippingLabel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReturnShippingLabel] -> ShowS
$cshowList :: [CreateReturnShippingLabel] -> ShowS
show :: CreateReturnShippingLabel -> String
$cshow :: CreateReturnShippingLabel -> String
showsPrec :: Int -> CreateReturnShippingLabel -> ShowS
$cshowsPrec :: Int -> CreateReturnShippingLabel -> ShowS
Prelude.Show, (forall x.
CreateReturnShippingLabel -> Rep CreateReturnShippingLabel x)
-> (forall x.
Rep CreateReturnShippingLabel x -> CreateReturnShippingLabel)
-> Generic CreateReturnShippingLabel
forall x.
Rep CreateReturnShippingLabel x -> CreateReturnShippingLabel
forall x.
CreateReturnShippingLabel -> Rep CreateReturnShippingLabel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReturnShippingLabel x -> CreateReturnShippingLabel
$cfrom :: forall x.
CreateReturnShippingLabel -> Rep CreateReturnShippingLabel x
Prelude.Generic)
newCreateReturnShippingLabel ::
Prelude.Text ->
CreateReturnShippingLabel
newCreateReturnShippingLabel :: Text -> CreateReturnShippingLabel
newCreateReturnShippingLabel Text
pJobId_ =
CreateReturnShippingLabel' :: Maybe ShippingOption -> Text -> CreateReturnShippingLabel
CreateReturnShippingLabel'
{ $sel:shippingOption:CreateReturnShippingLabel' :: Maybe ShippingOption
shippingOption =
Maybe ShippingOption
forall a. Maybe a
Prelude.Nothing,
$sel:jobId:CreateReturnShippingLabel' :: Text
jobId = Text
pJobId_
}
createReturnShippingLabel_shippingOption :: Lens.Lens' CreateReturnShippingLabel (Prelude.Maybe ShippingOption)
createReturnShippingLabel_shippingOption :: (Maybe ShippingOption -> f (Maybe ShippingOption))
-> CreateReturnShippingLabel -> f CreateReturnShippingLabel
createReturnShippingLabel_shippingOption = (CreateReturnShippingLabel -> Maybe ShippingOption)
-> (CreateReturnShippingLabel
-> Maybe ShippingOption -> CreateReturnShippingLabel)
-> Lens
CreateReturnShippingLabel
CreateReturnShippingLabel
(Maybe ShippingOption)
(Maybe ShippingOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReturnShippingLabel' {Maybe ShippingOption
shippingOption :: Maybe ShippingOption
$sel:shippingOption:CreateReturnShippingLabel' :: CreateReturnShippingLabel -> Maybe ShippingOption
shippingOption} -> Maybe ShippingOption
shippingOption) (\s :: CreateReturnShippingLabel
s@CreateReturnShippingLabel' {} Maybe ShippingOption
a -> CreateReturnShippingLabel
s {$sel:shippingOption:CreateReturnShippingLabel' :: Maybe ShippingOption
shippingOption = Maybe ShippingOption
a} :: CreateReturnShippingLabel)
createReturnShippingLabel_jobId :: Lens.Lens' CreateReturnShippingLabel Prelude.Text
createReturnShippingLabel_jobId :: (Text -> f Text)
-> CreateReturnShippingLabel -> f CreateReturnShippingLabel
createReturnShippingLabel_jobId = (CreateReturnShippingLabel -> Text)
-> (CreateReturnShippingLabel -> Text -> CreateReturnShippingLabel)
-> Lens
CreateReturnShippingLabel CreateReturnShippingLabel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReturnShippingLabel' {Text
jobId :: Text
$sel:jobId:CreateReturnShippingLabel' :: CreateReturnShippingLabel -> Text
jobId} -> Text
jobId) (\s :: CreateReturnShippingLabel
s@CreateReturnShippingLabel' {} Text
a -> CreateReturnShippingLabel
s {$sel:jobId:CreateReturnShippingLabel' :: Text
jobId = Text
a} :: CreateReturnShippingLabel)
instance Core.AWSRequest CreateReturnShippingLabel where
type
AWSResponse CreateReturnShippingLabel =
CreateReturnShippingLabelResponse
request :: CreateReturnShippingLabel -> Request CreateReturnShippingLabel
request = Service
-> CreateReturnShippingLabel -> Request CreateReturnShippingLabel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateReturnShippingLabel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReturnShippingLabel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateReturnShippingLabel))
-> Logger
-> Service
-> Proxy CreateReturnShippingLabel
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateReturnShippingLabel)))
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
-> Int -> CreateReturnShippingLabelResponse
CreateReturnShippingLabelResponse'
(Maybe ShippingLabelStatus
-> Int -> CreateReturnShippingLabelResponse)
-> Either String (Maybe ShippingLabelStatus)
-> Either String (Int -> CreateReturnShippingLabelResponse)
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 (Int -> CreateReturnShippingLabelResponse)
-> Either String Int
-> Either String CreateReturnShippingLabelResponse
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 CreateReturnShippingLabel
instance Prelude.NFData CreateReturnShippingLabel
instance Core.ToHeaders CreateReturnShippingLabel where
toHeaders :: CreateReturnShippingLabel -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateReturnShippingLabel -> 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.CreateReturnShippingLabel" ::
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 CreateReturnShippingLabel where
toJSON :: CreateReturnShippingLabel -> Value
toJSON CreateReturnShippingLabel' {Maybe ShippingOption
Text
jobId :: Text
shippingOption :: Maybe ShippingOption
$sel:jobId:CreateReturnShippingLabel' :: CreateReturnShippingLabel -> Text
$sel:shippingOption:CreateReturnShippingLabel' :: CreateReturnShippingLabel -> Maybe ShippingOption
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ShippingOption" Text -> ShippingOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ShippingOption -> Pair) -> Maybe ShippingOption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ShippingOption
shippingOption,
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 CreateReturnShippingLabel where
toPath :: CreateReturnShippingLabel -> ByteString
toPath = ByteString -> CreateReturnShippingLabel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateReturnShippingLabel where
toQuery :: CreateReturnShippingLabel -> QueryString
toQuery = QueryString -> CreateReturnShippingLabel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateReturnShippingLabelResponse = CreateReturnShippingLabelResponse'
{
CreateReturnShippingLabelResponse -> Maybe ShippingLabelStatus
status :: Prelude.Maybe ShippingLabelStatus,
CreateReturnShippingLabelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool
(CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool)
-> (CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool)
-> Eq CreateReturnShippingLabelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool
$c/= :: CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool
== :: CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool
$c== :: CreateReturnShippingLabelResponse
-> CreateReturnShippingLabelResponse -> Bool
Prelude.Eq, ReadPrec [CreateReturnShippingLabelResponse]
ReadPrec CreateReturnShippingLabelResponse
Int -> ReadS CreateReturnShippingLabelResponse
ReadS [CreateReturnShippingLabelResponse]
(Int -> ReadS CreateReturnShippingLabelResponse)
-> ReadS [CreateReturnShippingLabelResponse]
-> ReadPrec CreateReturnShippingLabelResponse
-> ReadPrec [CreateReturnShippingLabelResponse]
-> Read CreateReturnShippingLabelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateReturnShippingLabelResponse]
$creadListPrec :: ReadPrec [CreateReturnShippingLabelResponse]
readPrec :: ReadPrec CreateReturnShippingLabelResponse
$creadPrec :: ReadPrec CreateReturnShippingLabelResponse
readList :: ReadS [CreateReturnShippingLabelResponse]
$creadList :: ReadS [CreateReturnShippingLabelResponse]
readsPrec :: Int -> ReadS CreateReturnShippingLabelResponse
$creadsPrec :: Int -> ReadS CreateReturnShippingLabelResponse
Prelude.Read, Int -> CreateReturnShippingLabelResponse -> ShowS
[CreateReturnShippingLabelResponse] -> ShowS
CreateReturnShippingLabelResponse -> String
(Int -> CreateReturnShippingLabelResponse -> ShowS)
-> (CreateReturnShippingLabelResponse -> String)
-> ([CreateReturnShippingLabelResponse] -> ShowS)
-> Show CreateReturnShippingLabelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateReturnShippingLabelResponse] -> ShowS
$cshowList :: [CreateReturnShippingLabelResponse] -> ShowS
show :: CreateReturnShippingLabelResponse -> String
$cshow :: CreateReturnShippingLabelResponse -> String
showsPrec :: Int -> CreateReturnShippingLabelResponse -> ShowS
$cshowsPrec :: Int -> CreateReturnShippingLabelResponse -> ShowS
Prelude.Show, (forall x.
CreateReturnShippingLabelResponse
-> Rep CreateReturnShippingLabelResponse x)
-> (forall x.
Rep CreateReturnShippingLabelResponse x
-> CreateReturnShippingLabelResponse)
-> Generic CreateReturnShippingLabelResponse
forall x.
Rep CreateReturnShippingLabelResponse x
-> CreateReturnShippingLabelResponse
forall x.
CreateReturnShippingLabelResponse
-> Rep CreateReturnShippingLabelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateReturnShippingLabelResponse x
-> CreateReturnShippingLabelResponse
$cfrom :: forall x.
CreateReturnShippingLabelResponse
-> Rep CreateReturnShippingLabelResponse x
Prelude.Generic)
newCreateReturnShippingLabelResponse ::
Prelude.Int ->
CreateReturnShippingLabelResponse
newCreateReturnShippingLabelResponse :: Int -> CreateReturnShippingLabelResponse
newCreateReturnShippingLabelResponse Int
pHttpStatus_ =
CreateReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
-> Int -> CreateReturnShippingLabelResponse
CreateReturnShippingLabelResponse'
{ $sel:status:CreateReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
status =
Maybe ShippingLabelStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateReturnShippingLabelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createReturnShippingLabelResponse_status :: Lens.Lens' CreateReturnShippingLabelResponse (Prelude.Maybe ShippingLabelStatus)
createReturnShippingLabelResponse_status :: (Maybe ShippingLabelStatus -> f (Maybe ShippingLabelStatus))
-> CreateReturnShippingLabelResponse
-> f CreateReturnShippingLabelResponse
createReturnShippingLabelResponse_status = (CreateReturnShippingLabelResponse -> Maybe ShippingLabelStatus)
-> (CreateReturnShippingLabelResponse
-> Maybe ShippingLabelStatus -> CreateReturnShippingLabelResponse)
-> Lens
CreateReturnShippingLabelResponse
CreateReturnShippingLabelResponse
(Maybe ShippingLabelStatus)
(Maybe ShippingLabelStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReturnShippingLabelResponse' {Maybe ShippingLabelStatus
status :: Maybe ShippingLabelStatus
$sel:status:CreateReturnShippingLabelResponse' :: CreateReturnShippingLabelResponse -> Maybe ShippingLabelStatus
status} -> Maybe ShippingLabelStatus
status) (\s :: CreateReturnShippingLabelResponse
s@CreateReturnShippingLabelResponse' {} Maybe ShippingLabelStatus
a -> CreateReturnShippingLabelResponse
s {$sel:status:CreateReturnShippingLabelResponse' :: Maybe ShippingLabelStatus
status = Maybe ShippingLabelStatus
a} :: CreateReturnShippingLabelResponse)
createReturnShippingLabelResponse_httpStatus :: Lens.Lens' CreateReturnShippingLabelResponse Prelude.Int
createReturnShippingLabelResponse_httpStatus :: (Int -> f Int)
-> CreateReturnShippingLabelResponse
-> f CreateReturnShippingLabelResponse
createReturnShippingLabelResponse_httpStatus = (CreateReturnShippingLabelResponse -> Int)
-> (CreateReturnShippingLabelResponse
-> Int -> CreateReturnShippingLabelResponse)
-> Lens
CreateReturnShippingLabelResponse
CreateReturnShippingLabelResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateReturnShippingLabelResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateReturnShippingLabelResponse' :: CreateReturnShippingLabelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateReturnShippingLabelResponse
s@CreateReturnShippingLabelResponse' {} Int
a -> CreateReturnShippingLabelResponse
s {$sel:httpStatus:CreateReturnShippingLabelResponse' :: Int
httpStatus = Int
a} :: CreateReturnShippingLabelResponse)
instance
Prelude.NFData
CreateReturnShippingLabelResponse