{-# 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.WorkMail.DeleteResource
(
DeleteResource (..),
newDeleteResource,
deleteResource_organizationId,
deleteResource_resourceId,
DeleteResourceResponse (..),
newDeleteResourceResponse,
deleteResourceResponse_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.WorkMail.Types
data DeleteResource = DeleteResource'
{
DeleteResource -> Text
organizationId :: Prelude.Text,
DeleteResource -> Text
resourceId :: Prelude.Text
}
deriving (DeleteResource -> DeleteResource -> Bool
(DeleteResource -> DeleteResource -> Bool)
-> (DeleteResource -> DeleteResource -> Bool) -> Eq DeleteResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResource -> DeleteResource -> Bool
$c/= :: DeleteResource -> DeleteResource -> Bool
== :: DeleteResource -> DeleteResource -> Bool
$c== :: DeleteResource -> DeleteResource -> Bool
Prelude.Eq, ReadPrec [DeleteResource]
ReadPrec DeleteResource
Int -> ReadS DeleteResource
ReadS [DeleteResource]
(Int -> ReadS DeleteResource)
-> ReadS [DeleteResource]
-> ReadPrec DeleteResource
-> ReadPrec [DeleteResource]
-> Read DeleteResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResource]
$creadListPrec :: ReadPrec [DeleteResource]
readPrec :: ReadPrec DeleteResource
$creadPrec :: ReadPrec DeleteResource
readList :: ReadS [DeleteResource]
$creadList :: ReadS [DeleteResource]
readsPrec :: Int -> ReadS DeleteResource
$creadsPrec :: Int -> ReadS DeleteResource
Prelude.Read, Int -> DeleteResource -> ShowS
[DeleteResource] -> ShowS
DeleteResource -> String
(Int -> DeleteResource -> ShowS)
-> (DeleteResource -> String)
-> ([DeleteResource] -> ShowS)
-> Show DeleteResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResource] -> ShowS
$cshowList :: [DeleteResource] -> ShowS
show :: DeleteResource -> String
$cshow :: DeleteResource -> String
showsPrec :: Int -> DeleteResource -> ShowS
$cshowsPrec :: Int -> DeleteResource -> ShowS
Prelude.Show, (forall x. DeleteResource -> Rep DeleteResource x)
-> (forall x. Rep DeleteResource x -> DeleteResource)
-> Generic DeleteResource
forall x. Rep DeleteResource x -> DeleteResource
forall x. DeleteResource -> Rep DeleteResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResource x -> DeleteResource
$cfrom :: forall x. DeleteResource -> Rep DeleteResource x
Prelude.Generic)
newDeleteResource ::
Prelude.Text ->
Prelude.Text ->
DeleteResource
newDeleteResource :: Text -> Text -> DeleteResource
newDeleteResource Text
pOrganizationId_ Text
pResourceId_ =
DeleteResource' :: Text -> Text -> DeleteResource
DeleteResource'
{ $sel:organizationId:DeleteResource' :: Text
organizationId = Text
pOrganizationId_,
$sel:resourceId:DeleteResource' :: Text
resourceId = Text
pResourceId_
}
deleteResource_organizationId :: Lens.Lens' DeleteResource Prelude.Text
deleteResource_organizationId :: (Text -> f Text) -> DeleteResource -> f DeleteResource
deleteResource_organizationId = (DeleteResource -> Text)
-> (DeleteResource -> Text -> DeleteResource)
-> Lens DeleteResource DeleteResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Text
organizationId :: Text
$sel:organizationId:DeleteResource' :: DeleteResource -> Text
organizationId} -> Text
organizationId) (\s :: DeleteResource
s@DeleteResource' {} Text
a -> DeleteResource
s {$sel:organizationId:DeleteResource' :: Text
organizationId = Text
a} :: DeleteResource)
deleteResource_resourceId :: Lens.Lens' DeleteResource Prelude.Text
deleteResource_resourceId :: (Text -> f Text) -> DeleteResource -> f DeleteResource
deleteResource_resourceId = (DeleteResource -> Text)
-> (DeleteResource -> Text -> DeleteResource)
-> Lens DeleteResource DeleteResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Text
resourceId :: Text
$sel:resourceId:DeleteResource' :: DeleteResource -> Text
resourceId} -> Text
resourceId) (\s :: DeleteResource
s@DeleteResource' {} Text
a -> DeleteResource
s {$sel:resourceId:DeleteResource' :: Text
resourceId = Text
a} :: DeleteResource)
instance Core.AWSRequest DeleteResource where
type
AWSResponse DeleteResource =
DeleteResourceResponse
request :: DeleteResource -> Request DeleteResource
request = Service -> DeleteResource -> Request DeleteResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResource)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteResource))
-> Logger
-> Service
-> Proxy DeleteResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResource)))
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 -> DeleteResourceResponse
DeleteResourceResponse'
(Int -> DeleteResourceResponse)
-> Either String Int -> Either String DeleteResourceResponse
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 DeleteResource
instance Prelude.NFData DeleteResource
instance Core.ToHeaders DeleteResource where
toHeaders :: DeleteResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteResource -> 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
"WorkMailService.DeleteResource" ::
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 DeleteResource where
toJSON :: DeleteResource -> Value
toJSON DeleteResource' {Text
resourceId :: Text
organizationId :: Text
$sel:resourceId:DeleteResource' :: DeleteResource -> Text
$sel:organizationId:DeleteResource' :: DeleteResource -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId)
]
)
instance Core.ToPath DeleteResource where
toPath :: DeleteResource -> ByteString
toPath = ByteString -> DeleteResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteResource where
toQuery :: DeleteResource -> QueryString
toQuery = QueryString -> DeleteResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteResourceResponse = DeleteResourceResponse'
{
DeleteResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteResourceResponse -> DeleteResourceResponse -> Bool
(DeleteResourceResponse -> DeleteResourceResponse -> Bool)
-> (DeleteResourceResponse -> DeleteResourceResponse -> Bool)
-> Eq DeleteResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
$c/= :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
== :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
$c== :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteResourceResponse]
ReadPrec DeleteResourceResponse
Int -> ReadS DeleteResourceResponse
ReadS [DeleteResourceResponse]
(Int -> ReadS DeleteResourceResponse)
-> ReadS [DeleteResourceResponse]
-> ReadPrec DeleteResourceResponse
-> ReadPrec [DeleteResourceResponse]
-> Read DeleteResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceResponse]
$creadListPrec :: ReadPrec [DeleteResourceResponse]
readPrec :: ReadPrec DeleteResourceResponse
$creadPrec :: ReadPrec DeleteResourceResponse
readList :: ReadS [DeleteResourceResponse]
$creadList :: ReadS [DeleteResourceResponse]
readsPrec :: Int -> ReadS DeleteResourceResponse
$creadsPrec :: Int -> ReadS DeleteResourceResponse
Prelude.Read, Int -> DeleteResourceResponse -> ShowS
[DeleteResourceResponse] -> ShowS
DeleteResourceResponse -> String
(Int -> DeleteResourceResponse -> ShowS)
-> (DeleteResourceResponse -> String)
-> ([DeleteResourceResponse] -> ShowS)
-> Show DeleteResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceResponse] -> ShowS
$cshowList :: [DeleteResourceResponse] -> ShowS
show :: DeleteResourceResponse -> String
$cshow :: DeleteResourceResponse -> String
showsPrec :: Int -> DeleteResourceResponse -> ShowS
$cshowsPrec :: Int -> DeleteResourceResponse -> ShowS
Prelude.Show, (forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x)
-> (forall x.
Rep DeleteResourceResponse x -> DeleteResourceResponse)
-> Generic DeleteResourceResponse
forall x. Rep DeleteResourceResponse x -> DeleteResourceResponse
forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceResponse x -> DeleteResourceResponse
$cfrom :: forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x
Prelude.Generic)
newDeleteResourceResponse ::
Prelude.Int ->
DeleteResourceResponse
newDeleteResourceResponse :: Int -> DeleteResourceResponse
newDeleteResourceResponse Int
pHttpStatus_ =
DeleteResourceResponse' :: Int -> DeleteResourceResponse
DeleteResourceResponse' {$sel:httpStatus:DeleteResourceResponse' :: Int
httpStatus = Int
pHttpStatus_}
deleteResourceResponse_httpStatus :: Lens.Lens' DeleteResourceResponse Prelude.Int
deleteResourceResponse_httpStatus :: (Int -> f Int)
-> DeleteResourceResponse -> f DeleteResourceResponse
deleteResourceResponse_httpStatus = (DeleteResourceResponse -> Int)
-> (DeleteResourceResponse -> Int -> DeleteResourceResponse)
-> Lens DeleteResourceResponse DeleteResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteResourceResponse' :: DeleteResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteResourceResponse
s@DeleteResourceResponse' {} Int
a -> DeleteResourceResponse
s {$sel:httpStatus:DeleteResourceResponse' :: Int
httpStatus = Int
a} :: DeleteResourceResponse)
instance Prelude.NFData DeleteResourceResponse