{-# 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.PutRetentionPolicy
(
PutRetentionPolicy (..),
newPutRetentionPolicy,
putRetentionPolicy_id,
putRetentionPolicy_description,
putRetentionPolicy_organizationId,
putRetentionPolicy_name,
putRetentionPolicy_folderConfigurations,
PutRetentionPolicyResponse (..),
newPutRetentionPolicyResponse,
putRetentionPolicyResponse_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 PutRetentionPolicy = PutRetentionPolicy'
{
PutRetentionPolicy -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
PutRetentionPolicy -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Core.Sensitive Prelude.Text),
PutRetentionPolicy -> Text
organizationId :: Prelude.Text,
PutRetentionPolicy -> Text
name :: Prelude.Text,
PutRetentionPolicy -> [FolderConfiguration]
folderConfigurations :: [FolderConfiguration]
}
deriving (PutRetentionPolicy -> PutRetentionPolicy -> Bool
(PutRetentionPolicy -> PutRetentionPolicy -> Bool)
-> (PutRetentionPolicy -> PutRetentionPolicy -> Bool)
-> Eq PutRetentionPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRetentionPolicy -> PutRetentionPolicy -> Bool
$c/= :: PutRetentionPolicy -> PutRetentionPolicy -> Bool
== :: PutRetentionPolicy -> PutRetentionPolicy -> Bool
$c== :: PutRetentionPolicy -> PutRetentionPolicy -> Bool
Prelude.Eq, Int -> PutRetentionPolicy -> ShowS
[PutRetentionPolicy] -> ShowS
PutRetentionPolicy -> String
(Int -> PutRetentionPolicy -> ShowS)
-> (PutRetentionPolicy -> String)
-> ([PutRetentionPolicy] -> ShowS)
-> Show PutRetentionPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRetentionPolicy] -> ShowS
$cshowList :: [PutRetentionPolicy] -> ShowS
show :: PutRetentionPolicy -> String
$cshow :: PutRetentionPolicy -> String
showsPrec :: Int -> PutRetentionPolicy -> ShowS
$cshowsPrec :: Int -> PutRetentionPolicy -> ShowS
Prelude.Show, (forall x. PutRetentionPolicy -> Rep PutRetentionPolicy x)
-> (forall x. Rep PutRetentionPolicy x -> PutRetentionPolicy)
-> Generic PutRetentionPolicy
forall x. Rep PutRetentionPolicy x -> PutRetentionPolicy
forall x. PutRetentionPolicy -> Rep PutRetentionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutRetentionPolicy x -> PutRetentionPolicy
$cfrom :: forall x. PutRetentionPolicy -> Rep PutRetentionPolicy x
Prelude.Generic)
newPutRetentionPolicy ::
Prelude.Text ->
Prelude.Text ->
PutRetentionPolicy
newPutRetentionPolicy :: Text -> Text -> PutRetentionPolicy
newPutRetentionPolicy Text
pOrganizationId_ Text
pName_ =
PutRetentionPolicy' :: Maybe Text
-> Maybe (Sensitive Text)
-> Text
-> Text
-> [FolderConfiguration]
-> PutRetentionPolicy
PutRetentionPolicy'
{ $sel:id:PutRetentionPolicy' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:PutRetentionPolicy' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:PutRetentionPolicy' :: Text
organizationId = Text
pOrganizationId_,
$sel:name:PutRetentionPolicy' :: Text
name = Text
pName_,
$sel:folderConfigurations:PutRetentionPolicy' :: [FolderConfiguration]
folderConfigurations = [FolderConfiguration]
forall a. Monoid a => a
Prelude.mempty
}
putRetentionPolicy_id :: Lens.Lens' PutRetentionPolicy (Prelude.Maybe Prelude.Text)
putRetentionPolicy_id :: (Maybe Text -> f (Maybe Text))
-> PutRetentionPolicy -> f PutRetentionPolicy
putRetentionPolicy_id = (PutRetentionPolicy -> Maybe Text)
-> (PutRetentionPolicy -> Maybe Text -> PutRetentionPolicy)
-> Lens
PutRetentionPolicy PutRetentionPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicy' {Maybe Text
id :: Maybe Text
$sel:id:PutRetentionPolicy' :: PutRetentionPolicy -> Maybe Text
id} -> Maybe Text
id) (\s :: PutRetentionPolicy
s@PutRetentionPolicy' {} Maybe Text
a -> PutRetentionPolicy
s {$sel:id:PutRetentionPolicy' :: Maybe Text
id = Maybe Text
a} :: PutRetentionPolicy)
putRetentionPolicy_description :: Lens.Lens' PutRetentionPolicy (Prelude.Maybe Prelude.Text)
putRetentionPolicy_description :: (Maybe Text -> f (Maybe Text))
-> PutRetentionPolicy -> f PutRetentionPolicy
putRetentionPolicy_description = (PutRetentionPolicy -> Maybe (Sensitive Text))
-> (PutRetentionPolicy
-> Maybe (Sensitive Text) -> PutRetentionPolicy)
-> Lens
PutRetentionPolicy
PutRetentionPolicy
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicy' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:PutRetentionPolicy' :: PutRetentionPolicy -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: PutRetentionPolicy
s@PutRetentionPolicy' {} Maybe (Sensitive Text)
a -> PutRetentionPolicy
s {$sel:description:PutRetentionPolicy' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: PutRetentionPolicy) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> PutRetentionPolicy -> f PutRetentionPolicy)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> PutRetentionPolicy
-> f PutRetentionPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
putRetentionPolicy_organizationId :: Lens.Lens' PutRetentionPolicy Prelude.Text
putRetentionPolicy_organizationId :: (Text -> f Text) -> PutRetentionPolicy -> f PutRetentionPolicy
putRetentionPolicy_organizationId = (PutRetentionPolicy -> Text)
-> (PutRetentionPolicy -> Text -> PutRetentionPolicy)
-> Lens PutRetentionPolicy PutRetentionPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicy' {Text
organizationId :: Text
$sel:organizationId:PutRetentionPolicy' :: PutRetentionPolicy -> Text
organizationId} -> Text
organizationId) (\s :: PutRetentionPolicy
s@PutRetentionPolicy' {} Text
a -> PutRetentionPolicy
s {$sel:organizationId:PutRetentionPolicy' :: Text
organizationId = Text
a} :: PutRetentionPolicy)
putRetentionPolicy_name :: Lens.Lens' PutRetentionPolicy Prelude.Text
putRetentionPolicy_name :: (Text -> f Text) -> PutRetentionPolicy -> f PutRetentionPolicy
putRetentionPolicy_name = (PutRetentionPolicy -> Text)
-> (PutRetentionPolicy -> Text -> PutRetentionPolicy)
-> Lens PutRetentionPolicy PutRetentionPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicy' {Text
name :: Text
$sel:name:PutRetentionPolicy' :: PutRetentionPolicy -> Text
name} -> Text
name) (\s :: PutRetentionPolicy
s@PutRetentionPolicy' {} Text
a -> PutRetentionPolicy
s {$sel:name:PutRetentionPolicy' :: Text
name = Text
a} :: PutRetentionPolicy)
putRetentionPolicy_folderConfigurations :: Lens.Lens' PutRetentionPolicy [FolderConfiguration]
putRetentionPolicy_folderConfigurations :: ([FolderConfiguration] -> f [FolderConfiguration])
-> PutRetentionPolicy -> f PutRetentionPolicy
putRetentionPolicy_folderConfigurations = (PutRetentionPolicy -> [FolderConfiguration])
-> (PutRetentionPolicy
-> [FolderConfiguration] -> PutRetentionPolicy)
-> Lens
PutRetentionPolicy
PutRetentionPolicy
[FolderConfiguration]
[FolderConfiguration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicy' {[FolderConfiguration]
folderConfigurations :: [FolderConfiguration]
$sel:folderConfigurations:PutRetentionPolicy' :: PutRetentionPolicy -> [FolderConfiguration]
folderConfigurations} -> [FolderConfiguration]
folderConfigurations) (\s :: PutRetentionPolicy
s@PutRetentionPolicy' {} [FolderConfiguration]
a -> PutRetentionPolicy
s {$sel:folderConfigurations:PutRetentionPolicy' :: [FolderConfiguration]
folderConfigurations = [FolderConfiguration]
a} :: PutRetentionPolicy) (([FolderConfiguration] -> f [FolderConfiguration])
-> PutRetentionPolicy -> f PutRetentionPolicy)
-> (([FolderConfiguration] -> f [FolderConfiguration])
-> [FolderConfiguration] -> f [FolderConfiguration])
-> ([FolderConfiguration] -> f [FolderConfiguration])
-> PutRetentionPolicy
-> f PutRetentionPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FolderConfiguration] -> f [FolderConfiguration])
-> [FolderConfiguration] -> f [FolderConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest PutRetentionPolicy where
type
AWSResponse PutRetentionPolicy =
PutRetentionPolicyResponse
request :: PutRetentionPolicy -> Request PutRetentionPolicy
request = Service -> PutRetentionPolicy -> Request PutRetentionPolicy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutRetentionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRetentionPolicy)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutRetentionPolicy))
-> Logger
-> Service
-> Proxy PutRetentionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse PutRetentionPolicy)))
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 -> PutRetentionPolicyResponse
PutRetentionPolicyResponse'
(Int -> PutRetentionPolicyResponse)
-> Either String Int -> Either String PutRetentionPolicyResponse
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 PutRetentionPolicy
instance Prelude.NFData PutRetentionPolicy
instance Core.ToHeaders PutRetentionPolicy where
toHeaders :: PutRetentionPolicy -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutRetentionPolicy -> 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.PutRetentionPolicy" ::
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 PutRetentionPolicy where
toJSON :: PutRetentionPolicy -> Value
toJSON PutRetentionPolicy' {[FolderConfiguration]
Maybe Text
Maybe (Sensitive Text)
Text
folderConfigurations :: [FolderConfiguration]
name :: Text
organizationId :: Text
description :: Maybe (Sensitive Text)
id :: Maybe Text
$sel:folderConfigurations:PutRetentionPolicy' :: PutRetentionPolicy -> [FolderConfiguration]
$sel:name:PutRetentionPolicy' :: PutRetentionPolicy -> Text
$sel:organizationId:PutRetentionPolicy' :: PutRetentionPolicy -> Text
$sel:description:PutRetentionPolicy' :: PutRetentionPolicy -> Maybe (Sensitive Text)
$sel:id:PutRetentionPolicy' :: PutRetentionPolicy -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Id" 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
id,
(Text
"Description" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"FolderConfigurations"
Text -> [FolderConfiguration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [FolderConfiguration]
folderConfigurations
)
]
)
instance Core.ToPath PutRetentionPolicy where
toPath :: PutRetentionPolicy -> ByteString
toPath = ByteString -> PutRetentionPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutRetentionPolicy where
toQuery :: PutRetentionPolicy -> QueryString
toQuery = QueryString -> PutRetentionPolicy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutRetentionPolicyResponse = PutRetentionPolicyResponse'
{
PutRetentionPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool
(PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool)
-> (PutRetentionPolicyResponse
-> PutRetentionPolicyResponse -> Bool)
-> Eq PutRetentionPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool
$c/= :: PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool
== :: PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool
$c== :: PutRetentionPolicyResponse -> PutRetentionPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutRetentionPolicyResponse]
ReadPrec PutRetentionPolicyResponse
Int -> ReadS PutRetentionPolicyResponse
ReadS [PutRetentionPolicyResponse]
(Int -> ReadS PutRetentionPolicyResponse)
-> ReadS [PutRetentionPolicyResponse]
-> ReadPrec PutRetentionPolicyResponse
-> ReadPrec [PutRetentionPolicyResponse]
-> Read PutRetentionPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutRetentionPolicyResponse]
$creadListPrec :: ReadPrec [PutRetentionPolicyResponse]
readPrec :: ReadPrec PutRetentionPolicyResponse
$creadPrec :: ReadPrec PutRetentionPolicyResponse
readList :: ReadS [PutRetentionPolicyResponse]
$creadList :: ReadS [PutRetentionPolicyResponse]
readsPrec :: Int -> ReadS PutRetentionPolicyResponse
$creadsPrec :: Int -> ReadS PutRetentionPolicyResponse
Prelude.Read, Int -> PutRetentionPolicyResponse -> ShowS
[PutRetentionPolicyResponse] -> ShowS
PutRetentionPolicyResponse -> String
(Int -> PutRetentionPolicyResponse -> ShowS)
-> (PutRetentionPolicyResponse -> String)
-> ([PutRetentionPolicyResponse] -> ShowS)
-> Show PutRetentionPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutRetentionPolicyResponse] -> ShowS
$cshowList :: [PutRetentionPolicyResponse] -> ShowS
show :: PutRetentionPolicyResponse -> String
$cshow :: PutRetentionPolicyResponse -> String
showsPrec :: Int -> PutRetentionPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutRetentionPolicyResponse -> ShowS
Prelude.Show, (forall x.
PutRetentionPolicyResponse -> Rep PutRetentionPolicyResponse x)
-> (forall x.
Rep PutRetentionPolicyResponse x -> PutRetentionPolicyResponse)
-> Generic PutRetentionPolicyResponse
forall x.
Rep PutRetentionPolicyResponse x -> PutRetentionPolicyResponse
forall x.
PutRetentionPolicyResponse -> Rep PutRetentionPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutRetentionPolicyResponse x -> PutRetentionPolicyResponse
$cfrom :: forall x.
PutRetentionPolicyResponse -> Rep PutRetentionPolicyResponse x
Prelude.Generic)
newPutRetentionPolicyResponse ::
Prelude.Int ->
PutRetentionPolicyResponse
newPutRetentionPolicyResponse :: Int -> PutRetentionPolicyResponse
newPutRetentionPolicyResponse Int
pHttpStatus_ =
PutRetentionPolicyResponse' :: Int -> PutRetentionPolicyResponse
PutRetentionPolicyResponse'
{ $sel:httpStatus:PutRetentionPolicyResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
putRetentionPolicyResponse_httpStatus :: Lens.Lens' PutRetentionPolicyResponse Prelude.Int
putRetentionPolicyResponse_httpStatus :: (Int -> f Int)
-> PutRetentionPolicyResponse -> f PutRetentionPolicyResponse
putRetentionPolicyResponse_httpStatus = (PutRetentionPolicyResponse -> Int)
-> (PutRetentionPolicyResponse
-> Int -> PutRetentionPolicyResponse)
-> Lens
PutRetentionPolicyResponse PutRetentionPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutRetentionPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutRetentionPolicyResponse' :: PutRetentionPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutRetentionPolicyResponse
s@PutRetentionPolicyResponse' {} Int
a -> PutRetentionPolicyResponse
s {$sel:httpStatus:PutRetentionPolicyResponse' :: Int
httpStatus = Int
a} :: PutRetentionPolicyResponse)
instance Prelude.NFData PutRetentionPolicyResponse