{-# 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.GetBucketLogging
(
getBucketLogging
, GetBucketLogging
, gBucket
, getBucketLoggingResponse
, GetBucketLoggingResponse
, gblrsLoggingEnabled
, gblrsResponseStatus
) 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 GetBucketLogging = GetBucketLogging'
{ _gBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketLogging
:: BucketName
-> GetBucketLogging
getBucketLogging pBucket_ = GetBucketLogging' {_gBucket = pBucket_}
gBucket :: Lens' GetBucketLogging BucketName
gBucket = lens _gBucket (\ s a -> s{_gBucket = a})
instance AWSRequest GetBucketLogging where
type Rs GetBucketLogging = GetBucketLoggingResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketLoggingResponse' <$>
(x .@? "LoggingEnabled") <*> (pure (fromEnum s)))
instance Hashable GetBucketLogging where
instance NFData GetBucketLogging where
instance ToHeaders GetBucketLogging where
toHeaders = const mempty
instance ToPath GetBucketLogging where
toPath GetBucketLogging'{..}
= mconcat ["/", toBS _gBucket]
instance ToQuery GetBucketLogging where
toQuery = const (mconcat ["logging"])
data GetBucketLoggingResponse = GetBucketLoggingResponse'
{ _gblrsLoggingEnabled :: !(Maybe LoggingEnabled)
, _gblrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketLoggingResponse
:: Int
-> GetBucketLoggingResponse
getBucketLoggingResponse pResponseStatus_ =
GetBucketLoggingResponse'
{_gblrsLoggingEnabled = Nothing, _gblrsResponseStatus = pResponseStatus_}
gblrsLoggingEnabled :: Lens' GetBucketLoggingResponse (Maybe LoggingEnabled)
gblrsLoggingEnabled = lens _gblrsLoggingEnabled (\ s a -> s{_gblrsLoggingEnabled = a})
gblrsResponseStatus :: Lens' GetBucketLoggingResponse Int
gblrsResponseStatus = lens _gblrsResponseStatus (\ s a -> s{_gblrsResponseStatus = a})
instance NFData GetBucketLoggingResponse where