{-# 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.GetBucketVersioning
(
getBucketVersioning
, GetBucketVersioning
, gbvBucket
, getBucketVersioningResponse
, GetBucketVersioningResponse
, gbvrsStatus
, gbvrsMFADelete
, gbvrsResponseStatus
) 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 GetBucketVersioning = GetBucketVersioning'
{ _gbvBucket :: BucketName
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketVersioning
:: BucketName
-> GetBucketVersioning
getBucketVersioning pBucket_ = GetBucketVersioning' {_gbvBucket = pBucket_}
gbvBucket :: Lens' GetBucketVersioning BucketName
gbvBucket = lens _gbvBucket (\ s a -> s{_gbvBucket = a})
instance AWSRequest GetBucketVersioning where
type Rs GetBucketVersioning =
GetBucketVersioningResponse
request = get s3
response
= receiveXML
(\ s h x ->
GetBucketVersioningResponse' <$>
(x .@? "Status") <*> (x .@? "MfaDelete") <*>
(pure (fromEnum s)))
instance Hashable GetBucketVersioning where
instance NFData GetBucketVersioning where
instance ToHeaders GetBucketVersioning where
toHeaders = const mempty
instance ToPath GetBucketVersioning where
toPath GetBucketVersioning'{..}
= mconcat ["/", toBS _gbvBucket]
instance ToQuery GetBucketVersioning where
toQuery = const (mconcat ["versioning"])
data GetBucketVersioningResponse = GetBucketVersioningResponse'
{ _gbvrsStatus :: !(Maybe BucketVersioningStatus)
, _gbvrsMFADelete :: !(Maybe MFADeleteStatus)
, _gbvrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getBucketVersioningResponse
:: Int
-> GetBucketVersioningResponse
getBucketVersioningResponse pResponseStatus_ =
GetBucketVersioningResponse'
{ _gbvrsStatus = Nothing
, _gbvrsMFADelete = Nothing
, _gbvrsResponseStatus = pResponseStatus_
}
gbvrsStatus :: Lens' GetBucketVersioningResponse (Maybe BucketVersioningStatus)
gbvrsStatus = lens _gbvrsStatus (\ s a -> s{_gbvrsStatus = a})
gbvrsMFADelete :: Lens' GetBucketVersioningResponse (Maybe MFADeleteStatus)
gbvrsMFADelete = lens _gbvrsMFADelete (\ s a -> s{_gbvrsMFADelete = a})
gbvrsResponseStatus :: Lens' GetBucketVersioningResponse Int
gbvrsResponseStatus = lens _gbvrsResponseStatus (\ s a -> s{_gbvrsResponseStatus = a})
instance NFData GetBucketVersioningResponse where