{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- Module : Network.AWS.S3.PutBucketLogging -- Copyright : (c) 2013-2014 Brendan Hay -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or -- you can obtain it at http://mozilla.org/MPL/2.0/. -- Maintainer : Brendan Hay -- Stability : experimental -- Portability : non-portable (GHC extensions) -- | Set the logging parameters for a bucket and to specify permissions for who -- can view and modify the logging parameters. To set the logging status of a -- bucket, you must be the bucket owner. -- -- module Network.AWS.S3.PutBucketLogging ( -- * Request PutBucketLogging -- ** Request constructor , putBucketLogging -- ** Request lenses , pblBucket , pblBucketLoggingStatus , pblContentMD5 -- * Response , PutBucketLoggingResponse -- ** Response constructor , putBucketLoggingResponse ) where import Network.AWS.Prelude import Network.AWS.Request.RestXML import Network.AWS.S3.Types import qualified GHC.Exts data PutBucketLogging = PutBucketLogging { _pblBucket :: Text , _pblBucketLoggingStatus :: BucketLoggingStatus , _pblContentMD5 :: Maybe Text } deriving (Eq, Show) -- | 'PutBucketLogging' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'pblBucket' @::@ 'Text' -- -- * 'pblBucketLoggingStatus' @::@ 'BucketLoggingStatus' -- -- * 'pblContentMD5' @::@ 'Maybe' 'Text' -- putBucketLogging :: Text -- ^ 'pblBucket' -> BucketLoggingStatus -- ^ 'pblBucketLoggingStatus' -> PutBucketLogging putBucketLogging p1 p2 = PutBucketLogging { _pblBucket = p1 , _pblBucketLoggingStatus = p2 , _pblContentMD5 = Nothing } pblBucket :: Lens' PutBucketLogging Text pblBucket = lens _pblBucket (\s a -> s { _pblBucket = a }) pblBucketLoggingStatus :: Lens' PutBucketLogging BucketLoggingStatus pblBucketLoggingStatus = lens _pblBucketLoggingStatus (\s a -> s { _pblBucketLoggingStatus = a }) pblContentMD5 :: Lens' PutBucketLogging (Maybe Text) pblContentMD5 = lens _pblContentMD5 (\s a -> s { _pblContentMD5 = a }) data PutBucketLoggingResponse = PutBucketLoggingResponse deriving (Eq, Ord, Show, Generic) -- | 'PutBucketLoggingResponse' constructor. putBucketLoggingResponse :: PutBucketLoggingResponse putBucketLoggingResponse = PutBucketLoggingResponse instance ToPath PutBucketLogging where toPath PutBucketLogging{..} = mconcat [ "/" , toText _pblBucket ] instance ToQuery PutBucketLogging where toQuery = const "logging" instance ToHeaders PutBucketLogging where toHeaders PutBucketLogging{..} = mconcat [ "Content-MD5" =: _pblContentMD5 ] instance ToXMLRoot PutBucketLogging where toXMLRoot PutBucketLogging{..} = namespaced ns "PutBucketLogging" [ "BucketLoggingStatus" =@ _pblBucketLoggingStatus ] instance ToXML PutBucketLogging instance AWSRequest PutBucketLogging where type Sv PutBucketLogging = S3 type Rs PutBucketLogging = PutBucketLoggingResponse request = put response = nullResponse PutBucketLoggingResponse