{-# 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.GetCORSPolicy
(
getCORSPolicy
, GetCORSPolicy
, gcpContainerName
, getCORSPolicyResponse
, GetCORSPolicyResponse
, gcorsprsResponseStatus
, gcorsprsCORSPolicy
) 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
newtype GetCORSPolicy = GetCORSPolicy'
{ _gcpContainerName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCORSPolicy
:: Text
-> GetCORSPolicy
getCORSPolicy pContainerName_ =
GetCORSPolicy' {_gcpContainerName = pContainerName_}
gcpContainerName :: Lens' GetCORSPolicy Text
gcpContainerName = lens _gcpContainerName (\ s a -> s{_gcpContainerName = a})
instance AWSRequest GetCORSPolicy where
type Rs GetCORSPolicy = GetCORSPolicyResponse
request = postJSON mediaStore
response
= receiveJSON
(\ s h x ->
GetCORSPolicyResponse' <$>
(pure (fromEnum s)) <*> (x .:> "CorsPolicy"))
instance Hashable GetCORSPolicy where
instance NFData GetCORSPolicy where
instance ToHeaders GetCORSPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MediaStore_20170901.GetCorsPolicy" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetCORSPolicy where
toJSON GetCORSPolicy'{..}
= object
(catMaybes
[Just ("ContainerName" .= _gcpContainerName)])
instance ToPath GetCORSPolicy where
toPath = const "/"
instance ToQuery GetCORSPolicy where
toQuery = const mempty
data GetCORSPolicyResponse = GetCORSPolicyResponse'
{ _gcorsprsResponseStatus :: !Int
, _gcorsprsCORSPolicy :: !(List1 CORSRule)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getCORSPolicyResponse
:: Int
-> NonEmpty CORSRule
-> GetCORSPolicyResponse
getCORSPolicyResponse pResponseStatus_ pCORSPolicy_ =
GetCORSPolicyResponse'
{ _gcorsprsResponseStatus = pResponseStatus_
, _gcorsprsCORSPolicy = _List1 # pCORSPolicy_
}
gcorsprsResponseStatus :: Lens' GetCORSPolicyResponse Int
gcorsprsResponseStatus = lens _gcorsprsResponseStatus (\ s a -> s{_gcorsprsResponseStatus = a})
gcorsprsCORSPolicy :: Lens' GetCORSPolicyResponse (NonEmpty CORSRule)
gcorsprsCORSPolicy = lens _gcorsprsCORSPolicy (\ s a -> s{_gcorsprsCORSPolicy = a}) . _List1
instance NFData GetCORSPolicyResponse where