{-# 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.S3.GetBucketLifecycleConfiguration
(
getBucketLifecycleConfiguration
, GetBucketLifecycleConfiguration
, gblcBucket
, getBucketLifecycleConfigurationResponse
, GetBucketLifecycleConfigurationResponse
, gblcrsRules
, gblcrsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
import Network.AWS.S3.Types
import Network.AWS.S3.Types.Product
newtype GetBucketLifecycleConfiguration = GetBucketLifecycleConfiguration'
{ _gblcBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketLifecycleConfiguration
:: BucketName
-> GetBucketLifecycleConfiguration
getBucketLifecycleConfiguration pBucket_ =
GetBucketLifecycleConfiguration' {_gblcBucket = pBucket_}
gblcBucket :: Lens' GetBucketLifecycleConfiguration BucketName
gblcBucket = lens _gblcBucket (\ s a -> s{_gblcBucket = a})
instance AWSRequest GetBucketLifecycleConfiguration
where
type Rs GetBucketLifecycleConfiguration =
GetBucketLifecycleConfigurationResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketLifecycleConfigurationResponse' <$>
(may (parseXMLList "Rule") x) <*>
(pure (fromEnum s)))
instance Hashable GetBucketLifecycleConfiguration
where
instance NFData GetBucketLifecycleConfiguration where
instance ToHeaders GetBucketLifecycleConfiguration
where
toHeaders = const mempty
instance ToPath GetBucketLifecycleConfiguration where
toPath GetBucketLifecycleConfiguration'{..}
= mconcat ["/", toBS _gblcBucket]
instance ToQuery GetBucketLifecycleConfiguration
where
toQuery = const (mconcat ["lifecycle"])
data GetBucketLifecycleConfigurationResponse = GetBucketLifecycleConfigurationResponse'
{ _gblcrsRules :: !(Maybe [LifecycleRule])
, _gblcrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketLifecycleConfigurationResponse
:: Int
-> GetBucketLifecycleConfigurationResponse
getBucketLifecycleConfigurationResponse pResponseStatus_ =
GetBucketLifecycleConfigurationResponse'
{_gblcrsRules = Nothing, _gblcrsResponseStatus = pResponseStatus_}
gblcrsRules :: Lens' GetBucketLifecycleConfigurationResponse [LifecycleRule]
gblcrsRules = lens _gblcrsRules (\ s a -> s{_gblcrsRules = a}) . _Default . _Coerce
gblcrsResponseStatus :: Lens' GetBucketLifecycleConfigurationResponse Int
gblcrsResponseStatus = lens _gblcrsResponseStatus (\ s a -> s{_gblcrsResponseStatus = a})
instance NFData
GetBucketLifecycleConfigurationResponse
where