{-# 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.Outposts.GetOrder
(
GetOrder (..),
newGetOrder,
getOrder_orderId,
GetOrderResponse (..),
newGetOrderResponse,
getOrderResponse_order,
getOrderResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Outposts.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetOrder = GetOrder'
{
GetOrder -> Text
orderId :: Prelude.Text
}
deriving (GetOrder -> GetOrder -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOrder -> GetOrder -> Bool
$c/= :: GetOrder -> GetOrder -> Bool
== :: GetOrder -> GetOrder -> Bool
$c== :: GetOrder -> GetOrder -> Bool
Prelude.Eq, ReadPrec [GetOrder]
ReadPrec GetOrder
Int -> ReadS GetOrder
ReadS [GetOrder]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOrder]
$creadListPrec :: ReadPrec [GetOrder]
readPrec :: ReadPrec GetOrder
$creadPrec :: ReadPrec GetOrder
readList :: ReadS [GetOrder]
$creadList :: ReadS [GetOrder]
readsPrec :: Int -> ReadS GetOrder
$creadsPrec :: Int -> ReadS GetOrder
Prelude.Read, Int -> GetOrder -> ShowS
[GetOrder] -> ShowS
GetOrder -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOrder] -> ShowS
$cshowList :: [GetOrder] -> ShowS
show :: GetOrder -> String
$cshow :: GetOrder -> String
showsPrec :: Int -> GetOrder -> ShowS
$cshowsPrec :: Int -> GetOrder -> ShowS
Prelude.Show, forall x. Rep GetOrder x -> GetOrder
forall x. GetOrder -> Rep GetOrder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOrder x -> GetOrder
$cfrom :: forall x. GetOrder -> Rep GetOrder x
Prelude.Generic)
newGetOrder ::
Prelude.Text ->
GetOrder
newGetOrder :: Text -> GetOrder
newGetOrder Text
pOrderId_ =
GetOrder' {$sel:orderId:GetOrder' :: Text
orderId = Text
pOrderId_}
getOrder_orderId :: Lens.Lens' GetOrder Prelude.Text
getOrder_orderId :: Lens' GetOrder Text
getOrder_orderId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOrder' {Text
orderId :: Text
$sel:orderId:GetOrder' :: GetOrder -> Text
orderId} -> Text
orderId) (\s :: GetOrder
s@GetOrder' {} Text
a -> GetOrder
s {$sel:orderId:GetOrder' :: Text
orderId = Text
a} :: GetOrder)
instance Core.AWSRequest GetOrder where
type AWSResponse GetOrder = GetOrderResponse
request :: (Service -> Service) -> GetOrder -> Request GetOrder
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetOrder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOrder)))
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 Order -> Int -> GetOrderResponse
GetOrderResponse'
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
"Order")
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 GetOrder where
hashWithSalt :: Int -> GetOrder -> Int
hashWithSalt Int
_salt GetOrder' {Text
orderId :: Text
$sel:orderId:GetOrder' :: GetOrder -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
orderId
instance Prelude.NFData GetOrder where
rnf :: GetOrder -> ()
rnf GetOrder' {Text
orderId :: Text
$sel:orderId:GetOrder' :: GetOrder -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
orderId
instance Data.ToHeaders GetOrder where
toHeaders :: GetOrder -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetOrder where
toPath :: GetOrder -> ByteString
toPath GetOrder' {Text
orderId :: Text
$sel:orderId:GetOrder' :: GetOrder -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/orders/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
orderId]
instance Data.ToQuery GetOrder where
toQuery :: GetOrder -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetOrderResponse = GetOrderResponse'
{ GetOrderResponse -> Maybe Order
order :: Prelude.Maybe Order,
GetOrderResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetOrderResponse -> GetOrderResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOrderResponse -> GetOrderResponse -> Bool
$c/= :: GetOrderResponse -> GetOrderResponse -> Bool
== :: GetOrderResponse -> GetOrderResponse -> Bool
$c== :: GetOrderResponse -> GetOrderResponse -> Bool
Prelude.Eq, ReadPrec [GetOrderResponse]
ReadPrec GetOrderResponse
Int -> ReadS GetOrderResponse
ReadS [GetOrderResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOrderResponse]
$creadListPrec :: ReadPrec [GetOrderResponse]
readPrec :: ReadPrec GetOrderResponse
$creadPrec :: ReadPrec GetOrderResponse
readList :: ReadS [GetOrderResponse]
$creadList :: ReadS [GetOrderResponse]
readsPrec :: Int -> ReadS GetOrderResponse
$creadsPrec :: Int -> ReadS GetOrderResponse
Prelude.Read, Int -> GetOrderResponse -> ShowS
[GetOrderResponse] -> ShowS
GetOrderResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOrderResponse] -> ShowS
$cshowList :: [GetOrderResponse] -> ShowS
show :: GetOrderResponse -> String
$cshow :: GetOrderResponse -> String
showsPrec :: Int -> GetOrderResponse -> ShowS
$cshowsPrec :: Int -> GetOrderResponse -> ShowS
Prelude.Show, forall x. Rep GetOrderResponse x -> GetOrderResponse
forall x. GetOrderResponse -> Rep GetOrderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOrderResponse x -> GetOrderResponse
$cfrom :: forall x. GetOrderResponse -> Rep GetOrderResponse x
Prelude.Generic)
newGetOrderResponse ::
Prelude.Int ->
GetOrderResponse
newGetOrderResponse :: Int -> GetOrderResponse
newGetOrderResponse Int
pHttpStatus_ =
GetOrderResponse'
{ $sel:order:GetOrderResponse' :: Maybe Order
order = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetOrderResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getOrderResponse_order :: Lens.Lens' GetOrderResponse (Prelude.Maybe Order)
getOrderResponse_order :: Lens' GetOrderResponse (Maybe Order)
getOrderResponse_order = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOrderResponse' {Maybe Order
order :: Maybe Order
$sel:order:GetOrderResponse' :: GetOrderResponse -> Maybe Order
order} -> Maybe Order
order) (\s :: GetOrderResponse
s@GetOrderResponse' {} Maybe Order
a -> GetOrderResponse
s {$sel:order:GetOrderResponse' :: Maybe Order
order = Maybe Order
a} :: GetOrderResponse)
getOrderResponse_httpStatus :: Lens.Lens' GetOrderResponse Prelude.Int
getOrderResponse_httpStatus :: Lens' GetOrderResponse Int
getOrderResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOrderResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetOrderResponse' :: GetOrderResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetOrderResponse
s@GetOrderResponse' {} Int
a -> GetOrderResponse
s {$sel:httpStatus:GetOrderResponse' :: Int
httpStatus = Int
a} :: GetOrderResponse)
instance Prelude.NFData GetOrderResponse where
rnf :: GetOrderResponse -> ()
rnf GetOrderResponse' {Int
Maybe Order
httpStatus :: Int
order :: Maybe Order
$sel:httpStatus:GetOrderResponse' :: GetOrderResponse -> Int
$sel:order:GetOrderResponse' :: GetOrderResponse -> Maybe Order
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Order
order
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus