{-# 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.GetContainerPolicy
(
getContainerPolicy
, GetContainerPolicy
, gContainerName
, getContainerPolicyResponse
, GetContainerPolicyResponse
, gcprsResponseStatus
, gcprsPolicy
) 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 GetContainerPolicy = GetContainerPolicy'
{ _gContainerName :: Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getContainerPolicy
:: Text
-> GetContainerPolicy
getContainerPolicy pContainerName_ =
GetContainerPolicy' {_gContainerName = pContainerName_}
gContainerName :: Lens' GetContainerPolicy Text
gContainerName = lens _gContainerName (\ s a -> s{_gContainerName = a})
instance AWSRequest GetContainerPolicy where
type Rs GetContainerPolicy =
GetContainerPolicyResponse
request = postJSON mediaStore
response
= receiveJSON
(\ s h x ->
GetContainerPolicyResponse' <$>
(pure (fromEnum s)) <*> (x .:> "Policy"))
instance Hashable GetContainerPolicy where
instance NFData GetContainerPolicy where
instance ToHeaders GetContainerPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("MediaStore_20170901.GetContainerPolicy" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetContainerPolicy where
toJSON GetContainerPolicy'{..}
= object
(catMaybes
[Just ("ContainerName" .= _gContainerName)])
instance ToPath GetContainerPolicy where
toPath = const "/"
instance ToQuery GetContainerPolicy where
toQuery = const mempty
data GetContainerPolicyResponse = GetContainerPolicyResponse'
{ _gcprsResponseStatus :: !Int
, _gcprsPolicy :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
getContainerPolicyResponse
:: Int
-> Text
-> GetContainerPolicyResponse
getContainerPolicyResponse pResponseStatus_ pPolicy_ =
GetContainerPolicyResponse'
{_gcprsResponseStatus = pResponseStatus_, _gcprsPolicy = pPolicy_}
gcprsResponseStatus :: Lens' GetContainerPolicyResponse Int
gcprsResponseStatus = lens _gcprsResponseStatus (\ s a -> s{_gcprsResponseStatus = a})
gcprsPolicy :: Lens' GetContainerPolicyResponse Text
gcprsPolicy = lens _gcprsPolicy (\ s a -> s{_gcprsPolicy = a})
instance NFData GetContainerPolicyResponse where