{-# 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.PutCORSPolicy
(
putCORSPolicy
, PutCORSPolicy
, pcpContainerName
, pcpCORSPolicy
, putCORSPolicyResponse
, PutCORSPolicyResponse
, pcorsprsResponseStatus
) 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 PutCORSPolicy = PutCORSPolicy'
{ _pcpContainerName :: !Text
, _pcpCORSPolicy :: !(List1 CORSRule)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putCORSPolicy
:: Text
-> NonEmpty CORSRule
-> PutCORSPolicy
putCORSPolicy pContainerName_ pCORSPolicy_ =
PutCORSPolicy'
{ _pcpContainerName = pContainerName_
, _pcpCORSPolicy = _List1 # pCORSPolicy_
}
pcpContainerName :: Lens' PutCORSPolicy Text
pcpContainerName = lens _pcpContainerName (\ s a -> s{_pcpContainerName = a})
pcpCORSPolicy :: Lens' PutCORSPolicy (NonEmpty CORSRule)
pcpCORSPolicy = lens _pcpCORSPolicy (\ s a -> s{_pcpCORSPolicy = a}) . _List1
instance AWSRequest PutCORSPolicy where
type Rs PutCORSPolicy = PutCORSPolicyResponse
request = postJSON mediaStore
response
= receiveEmpty
(\ s h x ->
PutCORSPolicyResponse' <$> (pure (fromEnum s)))
instance Hashable PutCORSPolicy where
instance NFData PutCORSPolicy where
instance ToHeaders PutCORSPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MediaStore_20170901.PutCorsPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PutCORSPolicy where
toJSON PutCORSPolicy'{..}
= object
(catMaybes
[Just ("ContainerName" .= _pcpContainerName),
Just ("CorsPolicy" .= _pcpCORSPolicy)])
instance ToPath PutCORSPolicy where
toPath = const "/"
instance ToQuery PutCORSPolicy where
toQuery = const mempty
newtype PutCORSPolicyResponse = PutCORSPolicyResponse'
{ _pcorsprsResponseStatus :: Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
putCORSPolicyResponse
:: Int
-> PutCORSPolicyResponse
putCORSPolicyResponse pResponseStatus_ =
PutCORSPolicyResponse' {_pcorsprsResponseStatus = pResponseStatus_}
pcorsprsResponseStatus :: Lens' PutCORSPolicyResponse Int
pcorsprsResponseStatus = lens _pcorsprsResponseStatus (\ s a -> s{_pcorsprsResponseStatus = a})
instance NFData PutCORSPolicyResponse where