{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CloudWatchLogs.PutRetentionPolicy
(
putRetentionPolicy
, PutRetentionPolicy
, prpLogGroupName
, prpRetentionInDays
, putRetentionPolicyResponse
, PutRetentionPolicyResponse
) where
import Network.AWS.CloudWatchLogs.Types
import Network.AWS.CloudWatchLogs.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutRetentionPolicy = PutRetentionPolicy'
{ _prpLogGroupName :: !Text
, _prpRetentionInDays :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
putRetentionPolicy
:: Text
-> Int
-> PutRetentionPolicy
putRetentionPolicy pLogGroupName_ pRetentionInDays_ =
PutRetentionPolicy'
{ _prpLogGroupName = pLogGroupName_
, _prpRetentionInDays = pRetentionInDays_
}
prpLogGroupName :: Lens' PutRetentionPolicy Text
prpLogGroupName = lens _prpLogGroupName (\ s a -> s{_prpLogGroupName = a});
prpRetentionInDays :: Lens' PutRetentionPolicy Int
prpRetentionInDays = lens _prpRetentionInDays (\ s a -> s{_prpRetentionInDays = a});
instance AWSRequest PutRetentionPolicy where
type Rs PutRetentionPolicy =
PutRetentionPolicyResponse
request = postJSON cloudWatchLogs
response = receiveNull PutRetentionPolicyResponse'
instance Hashable PutRetentionPolicy
instance NFData PutRetentionPolicy
instance ToHeaders PutRetentionPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("Logs_20140328.PutRetentionPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutRetentionPolicy where
toJSON PutRetentionPolicy'{..}
= object
(catMaybes
[Just ("logGroupName" .= _prpLogGroupName),
Just ("retentionInDays" .= _prpRetentionInDays)])
instance ToPath PutRetentionPolicy where
toPath = const "/"
instance ToQuery PutRetentionPolicy where
toQuery = const mempty
data PutRetentionPolicyResponse =
PutRetentionPolicyResponse'
deriving (Eq,Read,Show,Data,Typeable,Generic)
putRetentionPolicyResponse
:: PutRetentionPolicyResponse
putRetentionPolicyResponse = PutRetentionPolicyResponse'
instance NFData PutRetentionPolicyResponse