{-# 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.DeleteRetentionPolicy
(
DeleteRetentionPolicy (..),
newDeleteRetentionPolicy,
deleteRetentionPolicy_organizationId,
deleteRetentionPolicy_id,
DeleteRetentionPolicyResponse (..),
newDeleteRetentionPolicyResponse,
deleteRetentionPolicyResponse_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 DeleteRetentionPolicy = DeleteRetentionPolicy'
{
DeleteRetentionPolicy -> Text
organizationId :: Prelude.Text,
DeleteRetentionPolicy -> Text
id :: Prelude.Text
}
deriving (DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool
(DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool)
-> (DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool)
-> Eq DeleteRetentionPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool
$c/= :: DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool
== :: DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool
$c== :: DeleteRetentionPolicy -> DeleteRetentionPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteRetentionPolicy]
ReadPrec DeleteRetentionPolicy
Int -> ReadS DeleteRetentionPolicy
ReadS [DeleteRetentionPolicy]
(Int -> ReadS DeleteRetentionPolicy)
-> ReadS [DeleteRetentionPolicy]
-> ReadPrec DeleteRetentionPolicy
-> ReadPrec [DeleteRetentionPolicy]
-> Read DeleteRetentionPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRetentionPolicy]
$creadListPrec :: ReadPrec [DeleteRetentionPolicy]
readPrec :: ReadPrec DeleteRetentionPolicy
$creadPrec :: ReadPrec DeleteRetentionPolicy
readList :: ReadS [DeleteRetentionPolicy]
$creadList :: ReadS [DeleteRetentionPolicy]
readsPrec :: Int -> ReadS DeleteRetentionPolicy
$creadsPrec :: Int -> ReadS DeleteRetentionPolicy
Prelude.Read, Int -> DeleteRetentionPolicy -> ShowS
[DeleteRetentionPolicy] -> ShowS
DeleteRetentionPolicy -> String
(Int -> DeleteRetentionPolicy -> ShowS)
-> (DeleteRetentionPolicy -> String)
-> ([DeleteRetentionPolicy] -> ShowS)
-> Show DeleteRetentionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRetentionPolicy] -> ShowS
$cshowList :: [DeleteRetentionPolicy] -> ShowS
show :: DeleteRetentionPolicy -> String
$cshow :: DeleteRetentionPolicy -> String
showsPrec :: Int -> DeleteRetentionPolicy -> ShowS
$cshowsPrec :: Int -> DeleteRetentionPolicy -> ShowS
Prelude.Show, (forall x. DeleteRetentionPolicy -> Rep DeleteRetentionPolicy x)
-> (forall x. Rep DeleteRetentionPolicy x -> DeleteRetentionPolicy)
-> Generic DeleteRetentionPolicy
forall x. Rep DeleteRetentionPolicy x -> DeleteRetentionPolicy
forall x. DeleteRetentionPolicy -> Rep DeleteRetentionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRetentionPolicy x -> DeleteRetentionPolicy
$cfrom :: forall x. DeleteRetentionPolicy -> Rep DeleteRetentionPolicy x
Prelude.Generic)
newDeleteRetentionPolicy ::
Prelude.Text ->
Prelude.Text ->
DeleteRetentionPolicy
newDeleteRetentionPolicy :: Text -> Text -> DeleteRetentionPolicy
newDeleteRetentionPolicy Text
pOrganizationId_ Text
pId_ =
DeleteRetentionPolicy' :: Text -> Text -> DeleteRetentionPolicy
DeleteRetentionPolicy'
{ $sel:organizationId:DeleteRetentionPolicy' :: Text
organizationId =
Text
pOrganizationId_,
$sel:id:DeleteRetentionPolicy' :: Text
id = Text
pId_
}
deleteRetentionPolicy_organizationId :: Lens.Lens' DeleteRetentionPolicy Prelude.Text
deleteRetentionPolicy_organizationId :: (Text -> f Text)
-> DeleteRetentionPolicy -> f DeleteRetentionPolicy
deleteRetentionPolicy_organizationId = (DeleteRetentionPolicy -> Text)
-> (DeleteRetentionPolicy -> Text -> DeleteRetentionPolicy)
-> Lens DeleteRetentionPolicy DeleteRetentionPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRetentionPolicy' {Text
organizationId :: Text
$sel:organizationId:DeleteRetentionPolicy' :: DeleteRetentionPolicy -> Text
organizationId} -> Text
organizationId) (\s :: DeleteRetentionPolicy
s@DeleteRetentionPolicy' {} Text
a -> DeleteRetentionPolicy
s {$sel:organizationId:DeleteRetentionPolicy' :: Text
organizationId = Text
a} :: DeleteRetentionPolicy)
deleteRetentionPolicy_id :: Lens.Lens' DeleteRetentionPolicy Prelude.Text
deleteRetentionPolicy_id :: (Text -> f Text)
-> DeleteRetentionPolicy -> f DeleteRetentionPolicy
deleteRetentionPolicy_id = (DeleteRetentionPolicy -> Text)
-> (DeleteRetentionPolicy -> Text -> DeleteRetentionPolicy)
-> Lens DeleteRetentionPolicy DeleteRetentionPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRetentionPolicy' {Text
id :: Text
$sel:id:DeleteRetentionPolicy' :: DeleteRetentionPolicy -> Text
id} -> Text
id) (\s :: DeleteRetentionPolicy
s@DeleteRetentionPolicy' {} Text
a -> DeleteRetentionPolicy
s {$sel:id:DeleteRetentionPolicy' :: Text
id = Text
a} :: DeleteRetentionPolicy)
instance Core.AWSRequest DeleteRetentionPolicy where
type
AWSResponse DeleteRetentionPolicy =
DeleteRetentionPolicyResponse
request :: DeleteRetentionPolicy -> Request DeleteRetentionPolicy
request = Service -> DeleteRetentionPolicy -> Request DeleteRetentionPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteRetentionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteRetentionPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteRetentionPolicy))
-> Logger
-> Service
-> Proxy DeleteRetentionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteRetentionPolicy)))
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 -> DeleteRetentionPolicyResponse
DeleteRetentionPolicyResponse'
(Int -> DeleteRetentionPolicyResponse)
-> Either String Int -> Either String DeleteRetentionPolicyResponse
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 DeleteRetentionPolicy
instance Prelude.NFData DeleteRetentionPolicy
instance Core.ToHeaders DeleteRetentionPolicy where
toHeaders :: DeleteRetentionPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteRetentionPolicy -> 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.DeleteRetentionPolicy" ::
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 DeleteRetentionPolicy where
toJSON :: DeleteRetentionPolicy -> Value
toJSON DeleteRetentionPolicy' {Text
id :: Text
organizationId :: Text
$sel:id:DeleteRetentionPolicy' :: DeleteRetentionPolicy -> Text
$sel:organizationId:DeleteRetentionPolicy' :: DeleteRetentionPolicy -> 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
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)
instance Core.ToPath DeleteRetentionPolicy where
toPath :: DeleteRetentionPolicy -> ByteString
toPath = ByteString -> DeleteRetentionPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteRetentionPolicy where
toQuery :: DeleteRetentionPolicy -> QueryString
toQuery = QueryString -> DeleteRetentionPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteRetentionPolicyResponse = DeleteRetentionPolicyResponse'
{
DeleteRetentionPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool
(DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool)
-> (DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool)
-> Eq DeleteRetentionPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool
$c/= :: DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool
== :: DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool
$c== :: DeleteRetentionPolicyResponse
-> DeleteRetentionPolicyResponse -> Bool
Prelude.Eq, ReadPrec [DeleteRetentionPolicyResponse]
ReadPrec DeleteRetentionPolicyResponse
Int -> ReadS DeleteRetentionPolicyResponse
ReadS [DeleteRetentionPolicyResponse]
(Int -> ReadS DeleteRetentionPolicyResponse)
-> ReadS [DeleteRetentionPolicyResponse]
-> ReadPrec DeleteRetentionPolicyResponse
-> ReadPrec [DeleteRetentionPolicyResponse]
-> Read DeleteRetentionPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRetentionPolicyResponse]
$creadListPrec :: ReadPrec [DeleteRetentionPolicyResponse]
readPrec :: ReadPrec DeleteRetentionPolicyResponse
$creadPrec :: ReadPrec DeleteRetentionPolicyResponse
readList :: ReadS [DeleteRetentionPolicyResponse]
$creadList :: ReadS [DeleteRetentionPolicyResponse]
readsPrec :: Int -> ReadS DeleteRetentionPolicyResponse
$creadsPrec :: Int -> ReadS DeleteRetentionPolicyResponse
Prelude.Read, Int -> DeleteRetentionPolicyResponse -> ShowS
[DeleteRetentionPolicyResponse] -> ShowS
DeleteRetentionPolicyResponse -> String
(Int -> DeleteRetentionPolicyResponse -> ShowS)
-> (DeleteRetentionPolicyResponse -> String)
-> ([DeleteRetentionPolicyResponse] -> ShowS)
-> Show DeleteRetentionPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRetentionPolicyResponse] -> ShowS
$cshowList :: [DeleteRetentionPolicyResponse] -> ShowS
show :: DeleteRetentionPolicyResponse -> String
$cshow :: DeleteRetentionPolicyResponse -> String
showsPrec :: Int -> DeleteRetentionPolicyResponse -> ShowS
$cshowsPrec :: Int -> DeleteRetentionPolicyResponse -> ShowS
Prelude.Show, (forall x.
DeleteRetentionPolicyResponse
-> Rep DeleteRetentionPolicyResponse x)
-> (forall x.
Rep DeleteRetentionPolicyResponse x
-> DeleteRetentionPolicyResponse)
-> Generic DeleteRetentionPolicyResponse
forall x.
Rep DeleteRetentionPolicyResponse x
-> DeleteRetentionPolicyResponse
forall x.
DeleteRetentionPolicyResponse
-> Rep DeleteRetentionPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteRetentionPolicyResponse x
-> DeleteRetentionPolicyResponse
$cfrom :: forall x.
DeleteRetentionPolicyResponse
-> Rep DeleteRetentionPolicyResponse x
Prelude.Generic)
newDeleteRetentionPolicyResponse ::
Prelude.Int ->
DeleteRetentionPolicyResponse
newDeleteRetentionPolicyResponse :: Int -> DeleteRetentionPolicyResponse
newDeleteRetentionPolicyResponse Int
pHttpStatus_ =
DeleteRetentionPolicyResponse' :: Int -> DeleteRetentionPolicyResponse
DeleteRetentionPolicyResponse'
{ $sel:httpStatus:DeleteRetentionPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
deleteRetentionPolicyResponse_httpStatus :: Lens.Lens' DeleteRetentionPolicyResponse Prelude.Int
deleteRetentionPolicyResponse_httpStatus :: (Int -> f Int)
-> DeleteRetentionPolicyResponse -> f DeleteRetentionPolicyResponse
deleteRetentionPolicyResponse_httpStatus = (DeleteRetentionPolicyResponse -> Int)
-> (DeleteRetentionPolicyResponse
-> Int -> DeleteRetentionPolicyResponse)
-> Lens
DeleteRetentionPolicyResponse DeleteRetentionPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRetentionPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteRetentionPolicyResponse' :: DeleteRetentionPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteRetentionPolicyResponse
s@DeleteRetentionPolicyResponse' {} Int
a -> DeleteRetentionPolicyResponse
s {$sel:httpStatus:DeleteRetentionPolicyResponse' :: Int
httpStatus = Int
a} :: DeleteRetentionPolicyResponse)
instance Prelude.NFData DeleteRetentionPolicyResponse