{-# 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.ServiceCatalog.DeleteProduct
(
DeleteProduct (..),
newDeleteProduct,
deleteProduct_acceptLanguage,
deleteProduct_id,
DeleteProductResponse (..),
newDeleteProductResponse,
deleteProductResponse_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.ServiceCatalog.Types
data DeleteProduct = DeleteProduct'
{
DeleteProduct -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
DeleteProduct -> Text
id :: Prelude.Text
}
deriving (DeleteProduct -> DeleteProduct -> Bool
(DeleteProduct -> DeleteProduct -> Bool)
-> (DeleteProduct -> DeleteProduct -> Bool) -> Eq DeleteProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProduct -> DeleteProduct -> Bool
$c/= :: DeleteProduct -> DeleteProduct -> Bool
== :: DeleteProduct -> DeleteProduct -> Bool
$c== :: DeleteProduct -> DeleteProduct -> Bool
Prelude.Eq, ReadPrec [DeleteProduct]
ReadPrec DeleteProduct
Int -> ReadS DeleteProduct
ReadS [DeleteProduct]
(Int -> ReadS DeleteProduct)
-> ReadS [DeleteProduct]
-> ReadPrec DeleteProduct
-> ReadPrec [DeleteProduct]
-> Read DeleteProduct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProduct]
$creadListPrec :: ReadPrec [DeleteProduct]
readPrec :: ReadPrec DeleteProduct
$creadPrec :: ReadPrec DeleteProduct
readList :: ReadS [DeleteProduct]
$creadList :: ReadS [DeleteProduct]
readsPrec :: Int -> ReadS DeleteProduct
$creadsPrec :: Int -> ReadS DeleteProduct
Prelude.Read, Int -> DeleteProduct -> ShowS
[DeleteProduct] -> ShowS
DeleteProduct -> String
(Int -> DeleteProduct -> ShowS)
-> (DeleteProduct -> String)
-> ([DeleteProduct] -> ShowS)
-> Show DeleteProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProduct] -> ShowS
$cshowList :: [DeleteProduct] -> ShowS
show :: DeleteProduct -> String
$cshow :: DeleteProduct -> String
showsPrec :: Int -> DeleteProduct -> ShowS
$cshowsPrec :: Int -> DeleteProduct -> ShowS
Prelude.Show, (forall x. DeleteProduct -> Rep DeleteProduct x)
-> (forall x. Rep DeleteProduct x -> DeleteProduct)
-> Generic DeleteProduct
forall x. Rep DeleteProduct x -> DeleteProduct
forall x. DeleteProduct -> Rep DeleteProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteProduct x -> DeleteProduct
$cfrom :: forall x. DeleteProduct -> Rep DeleteProduct x
Prelude.Generic)
newDeleteProduct ::
Prelude.Text ->
DeleteProduct
newDeleteProduct :: Text -> DeleteProduct
newDeleteProduct Text
pId_ =
DeleteProduct' :: Maybe Text -> Text -> DeleteProduct
DeleteProduct'
{ $sel:acceptLanguage:DeleteProduct' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:DeleteProduct' :: Text
id = Text
pId_
}
deleteProduct_acceptLanguage :: Lens.Lens' DeleteProduct (Prelude.Maybe Prelude.Text)
deleteProduct_acceptLanguage :: (Maybe Text -> f (Maybe Text)) -> DeleteProduct -> f DeleteProduct
deleteProduct_acceptLanguage = (DeleteProduct -> Maybe Text)
-> (DeleteProduct -> Maybe Text -> DeleteProduct)
-> Lens DeleteProduct DeleteProduct (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProduct' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DeleteProduct' :: DeleteProduct -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DeleteProduct
s@DeleteProduct' {} Maybe Text
a -> DeleteProduct
s {$sel:acceptLanguage:DeleteProduct' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DeleteProduct)
deleteProduct_id :: Lens.Lens' DeleteProduct Prelude.Text
deleteProduct_id :: (Text -> f Text) -> DeleteProduct -> f DeleteProduct
deleteProduct_id = (DeleteProduct -> Text)
-> (DeleteProduct -> Text -> DeleteProduct)
-> Lens DeleteProduct DeleteProduct Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProduct' {Text
id :: Text
$sel:id:DeleteProduct' :: DeleteProduct -> Text
id} -> Text
id) (\s :: DeleteProduct
s@DeleteProduct' {} Text
a -> DeleteProduct
s {$sel:id:DeleteProduct' :: Text
id = Text
a} :: DeleteProduct)
instance Core.AWSRequest DeleteProduct where
type
AWSResponse DeleteProduct =
DeleteProductResponse
request :: DeleteProduct -> Request DeleteProduct
request = Service -> DeleteProduct -> Request DeleteProduct
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteProduct)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteProduct))
-> Logger
-> Service
-> Proxy DeleteProduct
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteProduct)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> DeleteProductResponse
DeleteProductResponse'
(Int -> DeleteProductResponse)
-> Either String Int -> Either String DeleteProductResponse
forall (f :: * -> *) a b. Functor 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 DeleteProduct
instance Prelude.NFData DeleteProduct
instance Core.ToHeaders DeleteProduct where
toHeaders :: DeleteProduct -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteProduct -> 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
"AWS242ServiceCatalogService.DeleteProduct" ::
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 DeleteProduct where
toJSON :: DeleteProduct -> Value
toJSON DeleteProduct' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteProduct' :: DeleteProduct -> Text
$sel:acceptLanguage:DeleteProduct' :: DeleteProduct -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AcceptLanguage" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)
instance Core.ToPath DeleteProduct where
toPath :: DeleteProduct -> ByteString
toPath = ByteString -> DeleteProduct -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteProduct where
toQuery :: DeleteProduct -> QueryString
toQuery = QueryString -> DeleteProduct -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteProductResponse = DeleteProductResponse'
{
DeleteProductResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteProductResponse -> DeleteProductResponse -> Bool
(DeleteProductResponse -> DeleteProductResponse -> Bool)
-> (DeleteProductResponse -> DeleteProductResponse -> Bool)
-> Eq DeleteProductResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProductResponse -> DeleteProductResponse -> Bool
$c/= :: DeleteProductResponse -> DeleteProductResponse -> Bool
== :: DeleteProductResponse -> DeleteProductResponse -> Bool
$c== :: DeleteProductResponse -> DeleteProductResponse -> Bool
Prelude.Eq, ReadPrec [DeleteProductResponse]
ReadPrec DeleteProductResponse
Int -> ReadS DeleteProductResponse
ReadS [DeleteProductResponse]
(Int -> ReadS DeleteProductResponse)
-> ReadS [DeleteProductResponse]
-> ReadPrec DeleteProductResponse
-> ReadPrec [DeleteProductResponse]
-> Read DeleteProductResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProductResponse]
$creadListPrec :: ReadPrec [DeleteProductResponse]
readPrec :: ReadPrec DeleteProductResponse
$creadPrec :: ReadPrec DeleteProductResponse
readList :: ReadS [DeleteProductResponse]
$creadList :: ReadS [DeleteProductResponse]
readsPrec :: Int -> ReadS DeleteProductResponse
$creadsPrec :: Int -> ReadS DeleteProductResponse
Prelude.Read, Int -> DeleteProductResponse -> ShowS
[DeleteProductResponse] -> ShowS
DeleteProductResponse -> String
(Int -> DeleteProductResponse -> ShowS)
-> (DeleteProductResponse -> String)
-> ([DeleteProductResponse] -> ShowS)
-> Show DeleteProductResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProductResponse] -> ShowS
$cshowList :: [DeleteProductResponse] -> ShowS
show :: DeleteProductResponse -> String
$cshow :: DeleteProductResponse -> String
showsPrec :: Int -> DeleteProductResponse -> ShowS
$cshowsPrec :: Int -> DeleteProductResponse -> ShowS
Prelude.Show, (forall x. DeleteProductResponse -> Rep DeleteProductResponse x)
-> (forall x. Rep DeleteProductResponse x -> DeleteProductResponse)
-> Generic DeleteProductResponse
forall x. Rep DeleteProductResponse x -> DeleteProductResponse
forall x. DeleteProductResponse -> Rep DeleteProductResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteProductResponse x -> DeleteProductResponse
$cfrom :: forall x. DeleteProductResponse -> Rep DeleteProductResponse x
Prelude.Generic)
newDeleteProductResponse ::
Prelude.Int ->
DeleteProductResponse
newDeleteProductResponse :: Int -> DeleteProductResponse
newDeleteProductResponse Int
pHttpStatus_ =
DeleteProductResponse' :: Int -> DeleteProductResponse
DeleteProductResponse' {$sel:httpStatus:DeleteProductResponse' :: Int
httpStatus = Int
pHttpStatus_}
deleteProductResponse_httpStatus :: Lens.Lens' DeleteProductResponse Prelude.Int
deleteProductResponse_httpStatus :: (Int -> f Int) -> DeleteProductResponse -> f DeleteProductResponse
deleteProductResponse_httpStatus = (DeleteProductResponse -> Int)
-> (DeleteProductResponse -> Int -> DeleteProductResponse)
-> Lens DeleteProductResponse DeleteProductResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProductResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteProductResponse' :: DeleteProductResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteProductResponse
s@DeleteProductResponse' {} Int
a -> DeleteProductResponse
s {$sel:httpStatus:DeleteProductResponse' :: Int
httpStatus = Int
a} :: DeleteProductResponse)
instance Prelude.NFData DeleteProductResponse