{-# 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.OpenSearch.DeletePackage
(
DeletePackage (..),
newDeletePackage,
deletePackage_packageID,
DeletePackageResponse (..),
newDeletePackageResponse,
deletePackageResponse_packageDetails,
deletePackageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DeletePackage = DeletePackage'
{
DeletePackage -> Text
packageID :: Prelude.Text
}
deriving (DeletePackage -> DeletePackage -> Bool
(DeletePackage -> DeletePackage -> Bool)
-> (DeletePackage -> DeletePackage -> Bool) -> Eq DeletePackage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePackage -> DeletePackage -> Bool
$c/= :: DeletePackage -> DeletePackage -> Bool
== :: DeletePackage -> DeletePackage -> Bool
$c== :: DeletePackage -> DeletePackage -> Bool
Prelude.Eq, ReadPrec [DeletePackage]
ReadPrec DeletePackage
Int -> ReadS DeletePackage
ReadS [DeletePackage]
(Int -> ReadS DeletePackage)
-> ReadS [DeletePackage]
-> ReadPrec DeletePackage
-> ReadPrec [DeletePackage]
-> Read DeletePackage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePackage]
$creadListPrec :: ReadPrec [DeletePackage]
readPrec :: ReadPrec DeletePackage
$creadPrec :: ReadPrec DeletePackage
readList :: ReadS [DeletePackage]
$creadList :: ReadS [DeletePackage]
readsPrec :: Int -> ReadS DeletePackage
$creadsPrec :: Int -> ReadS DeletePackage
Prelude.Read, Int -> DeletePackage -> ShowS
[DeletePackage] -> ShowS
DeletePackage -> String
(Int -> DeletePackage -> ShowS)
-> (DeletePackage -> String)
-> ([DeletePackage] -> ShowS)
-> Show DeletePackage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePackage] -> ShowS
$cshowList :: [DeletePackage] -> ShowS
show :: DeletePackage -> String
$cshow :: DeletePackage -> String
showsPrec :: Int -> DeletePackage -> ShowS
$cshowsPrec :: Int -> DeletePackage -> ShowS
Prelude.Show, (forall x. DeletePackage -> Rep DeletePackage x)
-> (forall x. Rep DeletePackage x -> DeletePackage)
-> Generic DeletePackage
forall x. Rep DeletePackage x -> DeletePackage
forall x. DeletePackage -> Rep DeletePackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePackage x -> DeletePackage
$cfrom :: forall x. DeletePackage -> Rep DeletePackage x
Prelude.Generic)
newDeletePackage ::
Prelude.Text ->
DeletePackage
newDeletePackage :: Text -> DeletePackage
newDeletePackage Text
pPackageID_ =
DeletePackage' :: Text -> DeletePackage
DeletePackage' {$sel:packageID:DeletePackage' :: Text
packageID = Text
pPackageID_}
deletePackage_packageID :: Lens.Lens' DeletePackage Prelude.Text
deletePackage_packageID :: (Text -> f Text) -> DeletePackage -> f DeletePackage
deletePackage_packageID = (DeletePackage -> Text)
-> (DeletePackage -> Text -> DeletePackage)
-> Lens DeletePackage DeletePackage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePackage' {Text
packageID :: Text
$sel:packageID:DeletePackage' :: DeletePackage -> Text
packageID} -> Text
packageID) (\s :: DeletePackage
s@DeletePackage' {} Text
a -> DeletePackage
s {$sel:packageID:DeletePackage' :: Text
packageID = Text
a} :: DeletePackage)
instance Core.AWSRequest DeletePackage where
type
AWSResponse DeletePackage =
DeletePackageResponse
request :: DeletePackage -> Request DeletePackage
request = Service -> DeletePackage -> Request DeletePackage
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeletePackage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePackage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeletePackage))
-> Logger
-> Service
-> Proxy DeletePackage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePackage)))
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 PackageDetails -> Int -> DeletePackageResponse
DeletePackageResponse'
(Maybe PackageDetails -> Int -> DeletePackageResponse)
-> Either String (Maybe PackageDetails)
-> Either String (Int -> DeletePackageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PackageDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PackageDetails")
Either String (Int -> DeletePackageResponse)
-> Either String Int -> Either String DeletePackageResponse
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 DeletePackage
instance Prelude.NFData DeletePackage
instance Core.ToHeaders DeletePackage where
toHeaders :: DeletePackage -> ResponseHeaders
toHeaders = ResponseHeaders -> DeletePackage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DeletePackage where
toPath :: DeletePackage -> ByteString
toPath DeletePackage' {Text
packageID :: Text
$sel:packageID:DeletePackage' :: DeletePackage -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/2021-01-01/packages/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
packageID]
instance Core.ToQuery DeletePackage where
toQuery :: DeletePackage -> QueryString
toQuery = QueryString -> DeletePackage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeletePackageResponse = DeletePackageResponse'
{
DeletePackageResponse -> Maybe PackageDetails
packageDetails :: Prelude.Maybe PackageDetails,
DeletePackageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeletePackageResponse -> DeletePackageResponse -> Bool
(DeletePackageResponse -> DeletePackageResponse -> Bool)
-> (DeletePackageResponse -> DeletePackageResponse -> Bool)
-> Eq DeletePackageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePackageResponse -> DeletePackageResponse -> Bool
$c/= :: DeletePackageResponse -> DeletePackageResponse -> Bool
== :: DeletePackageResponse -> DeletePackageResponse -> Bool
$c== :: DeletePackageResponse -> DeletePackageResponse -> Bool
Prelude.Eq, ReadPrec [DeletePackageResponse]
ReadPrec DeletePackageResponse
Int -> ReadS DeletePackageResponse
ReadS [DeletePackageResponse]
(Int -> ReadS DeletePackageResponse)
-> ReadS [DeletePackageResponse]
-> ReadPrec DeletePackageResponse
-> ReadPrec [DeletePackageResponse]
-> Read DeletePackageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePackageResponse]
$creadListPrec :: ReadPrec [DeletePackageResponse]
readPrec :: ReadPrec DeletePackageResponse
$creadPrec :: ReadPrec DeletePackageResponse
readList :: ReadS [DeletePackageResponse]
$creadList :: ReadS [DeletePackageResponse]
readsPrec :: Int -> ReadS DeletePackageResponse
$creadsPrec :: Int -> ReadS DeletePackageResponse
Prelude.Read, Int -> DeletePackageResponse -> ShowS
[DeletePackageResponse] -> ShowS
DeletePackageResponse -> String
(Int -> DeletePackageResponse -> ShowS)
-> (DeletePackageResponse -> String)
-> ([DeletePackageResponse] -> ShowS)
-> Show DeletePackageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePackageResponse] -> ShowS
$cshowList :: [DeletePackageResponse] -> ShowS
show :: DeletePackageResponse -> String
$cshow :: DeletePackageResponse -> String
showsPrec :: Int -> DeletePackageResponse -> ShowS
$cshowsPrec :: Int -> DeletePackageResponse -> ShowS
Prelude.Show, (forall x. DeletePackageResponse -> Rep DeletePackageResponse x)
-> (forall x. Rep DeletePackageResponse x -> DeletePackageResponse)
-> Generic DeletePackageResponse
forall x. Rep DeletePackageResponse x -> DeletePackageResponse
forall x. DeletePackageResponse -> Rep DeletePackageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePackageResponse x -> DeletePackageResponse
$cfrom :: forall x. DeletePackageResponse -> Rep DeletePackageResponse x
Prelude.Generic)
newDeletePackageResponse ::
Prelude.Int ->
DeletePackageResponse
newDeletePackageResponse :: Int -> DeletePackageResponse
newDeletePackageResponse Int
pHttpStatus_ =
DeletePackageResponse' :: Maybe PackageDetails -> Int -> DeletePackageResponse
DeletePackageResponse'
{ $sel:packageDetails:DeletePackageResponse' :: Maybe PackageDetails
packageDetails =
Maybe PackageDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeletePackageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deletePackageResponse_packageDetails :: Lens.Lens' DeletePackageResponse (Prelude.Maybe PackageDetails)
deletePackageResponse_packageDetails :: (Maybe PackageDetails -> f (Maybe PackageDetails))
-> DeletePackageResponse -> f DeletePackageResponse
deletePackageResponse_packageDetails = (DeletePackageResponse -> Maybe PackageDetails)
-> (DeletePackageResponse
-> Maybe PackageDetails -> DeletePackageResponse)
-> Lens
DeletePackageResponse
DeletePackageResponse
(Maybe PackageDetails)
(Maybe PackageDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePackageResponse' {Maybe PackageDetails
packageDetails :: Maybe PackageDetails
$sel:packageDetails:DeletePackageResponse' :: DeletePackageResponse -> Maybe PackageDetails
packageDetails} -> Maybe PackageDetails
packageDetails) (\s :: DeletePackageResponse
s@DeletePackageResponse' {} Maybe PackageDetails
a -> DeletePackageResponse
s {$sel:packageDetails:DeletePackageResponse' :: Maybe PackageDetails
packageDetails = Maybe PackageDetails
a} :: DeletePackageResponse)
deletePackageResponse_httpStatus :: Lens.Lens' DeletePackageResponse Prelude.Int
deletePackageResponse_httpStatus :: (Int -> f Int) -> DeletePackageResponse -> f DeletePackageResponse
deletePackageResponse_httpStatus = (DeletePackageResponse -> Int)
-> (DeletePackageResponse -> Int -> DeletePackageResponse)
-> Lens DeletePackageResponse DeletePackageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePackageResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePackageResponse' :: DeletePackageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeletePackageResponse
s@DeletePackageResponse' {} Int
a -> DeletePackageResponse
s {$sel:httpStatus:DeletePackageResponse' :: Int
httpStatus = Int
a} :: DeletePackageResponse)
instance Prelude.NFData DeletePackageResponse