{-# 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.MediaStore.PutContainerPolicy
(
putContainerPolicy
, PutContainerPolicy
, pContainerName
, pPolicy
, putContainerPolicyResponse
, PutContainerPolicyResponse
, pcprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.MediaStore.Types
import Network.AWS.MediaStore.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PutContainerPolicy = PutContainerPolicy'
{ _pContainerName :: !Text
, _pPolicy :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putContainerPolicy
:: Text
-> Text
-> PutContainerPolicy
putContainerPolicy pContainerName_ pPolicy_ =
PutContainerPolicy' {_pContainerName = pContainerName_, _pPolicy = pPolicy_}
pContainerName :: Lens' PutContainerPolicy Text
pContainerName = lens _pContainerName (\ s a -> s{_pContainerName = a})
pPolicy :: Lens' PutContainerPolicy Text
pPolicy = lens _pPolicy (\ s a -> s{_pPolicy = a})
instance AWSRequest PutContainerPolicy where
type Rs PutContainerPolicy =
PutContainerPolicyResponse
request = postJSON mediaStore
response
= receiveEmpty
(\ s h x ->
PutContainerPolicyResponse' <$> (pure (fromEnum s)))
instance Hashable PutContainerPolicy where
instance NFData PutContainerPolicy where
instance ToHeaders PutContainerPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MediaStore_20170901.PutContainerPolicy" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutContainerPolicy where
toJSON PutContainerPolicy'{..}
= object
(catMaybes
[Just ("ContainerName" .= _pContainerName),
Just ("Policy" .= _pPolicy)])
instance ToPath PutContainerPolicy where
toPath = const "/"
instance ToQuery PutContainerPolicy where
toQuery = const mempty
newtype PutContainerPolicyResponse = PutContainerPolicyResponse'
{ _pcprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putContainerPolicyResponse
:: Int
-> PutContainerPolicyResponse
putContainerPolicyResponse pResponseStatus_ =
PutContainerPolicyResponse' {_pcprsResponseStatus = pResponseStatus_}
pcprsResponseStatus :: Lens' PutContainerPolicyResponse Int
pcprsResponseStatus = lens _pcprsResponseStatus (\ s a -> s{_pcprsResponseStatus = a})
instance NFData PutContainerPolicyResponse where