{-# 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.GetCatalogItem
(
GetCatalogItem (..),
newGetCatalogItem,
getCatalogItem_catalogItemId,
GetCatalogItemResponse (..),
newGetCatalogItemResponse,
getCatalogItemResponse_catalogItem,
getCatalogItemResponse_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 GetCatalogItem = GetCatalogItem'
{
GetCatalogItem -> Text
catalogItemId :: Prelude.Text
}
deriving (GetCatalogItem -> GetCatalogItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCatalogItem -> GetCatalogItem -> Bool
$c/= :: GetCatalogItem -> GetCatalogItem -> Bool
== :: GetCatalogItem -> GetCatalogItem -> Bool
$c== :: GetCatalogItem -> GetCatalogItem -> Bool
Prelude.Eq, ReadPrec [GetCatalogItem]
ReadPrec GetCatalogItem
Int -> ReadS GetCatalogItem
ReadS [GetCatalogItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCatalogItem]
$creadListPrec :: ReadPrec [GetCatalogItem]
readPrec :: ReadPrec GetCatalogItem
$creadPrec :: ReadPrec GetCatalogItem
readList :: ReadS [GetCatalogItem]
$creadList :: ReadS [GetCatalogItem]
readsPrec :: Int -> ReadS GetCatalogItem
$creadsPrec :: Int -> ReadS GetCatalogItem
Prelude.Read, Int -> GetCatalogItem -> ShowS
[GetCatalogItem] -> ShowS
GetCatalogItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCatalogItem] -> ShowS
$cshowList :: [GetCatalogItem] -> ShowS
show :: GetCatalogItem -> String
$cshow :: GetCatalogItem -> String
showsPrec :: Int -> GetCatalogItem -> ShowS
$cshowsPrec :: Int -> GetCatalogItem -> ShowS
Prelude.Show, forall x. Rep GetCatalogItem x -> GetCatalogItem
forall x. GetCatalogItem -> Rep GetCatalogItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCatalogItem x -> GetCatalogItem
$cfrom :: forall x. GetCatalogItem -> Rep GetCatalogItem x
Prelude.Generic)
newGetCatalogItem ::
Prelude.Text ->
GetCatalogItem
newGetCatalogItem :: Text -> GetCatalogItem
newGetCatalogItem Text
pCatalogItemId_ =
GetCatalogItem' {$sel:catalogItemId:GetCatalogItem' :: Text
catalogItemId = Text
pCatalogItemId_}
getCatalogItem_catalogItemId :: Lens.Lens' GetCatalogItem Prelude.Text
getCatalogItem_catalogItemId :: Lens' GetCatalogItem Text
getCatalogItem_catalogItemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCatalogItem' {Text
catalogItemId :: Text
$sel:catalogItemId:GetCatalogItem' :: GetCatalogItem -> Text
catalogItemId} -> Text
catalogItemId) (\s :: GetCatalogItem
s@GetCatalogItem' {} Text
a -> GetCatalogItem
s {$sel:catalogItemId:GetCatalogItem' :: Text
catalogItemId = Text
a} :: GetCatalogItem)
instance Core.AWSRequest GetCatalogItem where
type
AWSResponse GetCatalogItem =
GetCatalogItemResponse
request :: (Service -> Service) -> GetCatalogItem -> Request GetCatalogItem
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 GetCatalogItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCatalogItem)))
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 CatalogItem -> Int -> GetCatalogItemResponse
GetCatalogItemResponse'
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
"CatalogItem")
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 GetCatalogItem where
hashWithSalt :: Int -> GetCatalogItem -> Int
hashWithSalt Int
_salt GetCatalogItem' {Text
catalogItemId :: Text
$sel:catalogItemId:GetCatalogItem' :: GetCatalogItem -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
catalogItemId
instance Prelude.NFData GetCatalogItem where
rnf :: GetCatalogItem -> ()
rnf GetCatalogItem' {Text
catalogItemId :: Text
$sel:catalogItemId:GetCatalogItem' :: GetCatalogItem -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
catalogItemId
instance Data.ToHeaders GetCatalogItem where
toHeaders :: GetCatalogItem -> 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 GetCatalogItem where
toPath :: GetCatalogItem -> ByteString
toPath GetCatalogItem' {Text
catalogItemId :: Text
$sel:catalogItemId:GetCatalogItem' :: GetCatalogItem -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/catalog/item/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
catalogItemId]
instance Data.ToQuery GetCatalogItem where
toQuery :: GetCatalogItem -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetCatalogItemResponse = GetCatalogItemResponse'
{
GetCatalogItemResponse -> Maybe CatalogItem
catalogItem :: Prelude.Maybe CatalogItem,
GetCatalogItemResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCatalogItemResponse -> GetCatalogItemResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCatalogItemResponse -> GetCatalogItemResponse -> Bool
$c/= :: GetCatalogItemResponse -> GetCatalogItemResponse -> Bool
== :: GetCatalogItemResponse -> GetCatalogItemResponse -> Bool
$c== :: GetCatalogItemResponse -> GetCatalogItemResponse -> Bool
Prelude.Eq, ReadPrec [GetCatalogItemResponse]
ReadPrec GetCatalogItemResponse
Int -> ReadS GetCatalogItemResponse
ReadS [GetCatalogItemResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCatalogItemResponse]
$creadListPrec :: ReadPrec [GetCatalogItemResponse]
readPrec :: ReadPrec GetCatalogItemResponse
$creadPrec :: ReadPrec GetCatalogItemResponse
readList :: ReadS [GetCatalogItemResponse]
$creadList :: ReadS [GetCatalogItemResponse]
readsPrec :: Int -> ReadS GetCatalogItemResponse
$creadsPrec :: Int -> ReadS GetCatalogItemResponse
Prelude.Read, Int -> GetCatalogItemResponse -> ShowS
[GetCatalogItemResponse] -> ShowS
GetCatalogItemResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCatalogItemResponse] -> ShowS
$cshowList :: [GetCatalogItemResponse] -> ShowS
show :: GetCatalogItemResponse -> String
$cshow :: GetCatalogItemResponse -> String
showsPrec :: Int -> GetCatalogItemResponse -> ShowS
$cshowsPrec :: Int -> GetCatalogItemResponse -> ShowS
Prelude.Show, forall x. Rep GetCatalogItemResponse x -> GetCatalogItemResponse
forall x. GetCatalogItemResponse -> Rep GetCatalogItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCatalogItemResponse x -> GetCatalogItemResponse
$cfrom :: forall x. GetCatalogItemResponse -> Rep GetCatalogItemResponse x
Prelude.Generic)
newGetCatalogItemResponse ::
Prelude.Int ->
GetCatalogItemResponse
newGetCatalogItemResponse :: Int -> GetCatalogItemResponse
newGetCatalogItemResponse Int
pHttpStatus_ =
GetCatalogItemResponse'
{ $sel:catalogItem:GetCatalogItemResponse' :: Maybe CatalogItem
catalogItem =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCatalogItemResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCatalogItemResponse_catalogItem :: Lens.Lens' GetCatalogItemResponse (Prelude.Maybe CatalogItem)
getCatalogItemResponse_catalogItem :: Lens' GetCatalogItemResponse (Maybe CatalogItem)
getCatalogItemResponse_catalogItem = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCatalogItemResponse' {Maybe CatalogItem
catalogItem :: Maybe CatalogItem
$sel:catalogItem:GetCatalogItemResponse' :: GetCatalogItemResponse -> Maybe CatalogItem
catalogItem} -> Maybe CatalogItem
catalogItem) (\s :: GetCatalogItemResponse
s@GetCatalogItemResponse' {} Maybe CatalogItem
a -> GetCatalogItemResponse
s {$sel:catalogItem:GetCatalogItemResponse' :: Maybe CatalogItem
catalogItem = Maybe CatalogItem
a} :: GetCatalogItemResponse)
getCatalogItemResponse_httpStatus :: Lens.Lens' GetCatalogItemResponse Prelude.Int
getCatalogItemResponse_httpStatus :: Lens' GetCatalogItemResponse Int
getCatalogItemResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCatalogItemResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCatalogItemResponse' :: GetCatalogItemResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCatalogItemResponse
s@GetCatalogItemResponse' {} Int
a -> GetCatalogItemResponse
s {$sel:httpStatus:GetCatalogItemResponse' :: Int
httpStatus = Int
a} :: GetCatalogItemResponse)
instance Prelude.NFData GetCatalogItemResponse where
rnf :: GetCatalogItemResponse -> ()
rnf GetCatalogItemResponse' {Int
Maybe CatalogItem
httpStatus :: Int
catalogItem :: Maybe CatalogItem
$sel:httpStatus:GetCatalogItemResponse' :: GetCatalogItemResponse -> Int
$sel:catalogItem:GetCatalogItemResponse' :: GetCatalogItemResponse -> Maybe CatalogItem
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CatalogItem
catalogItem
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus