module Network.AWS.ECR.GetRepositoryPolicy
(
getRepositoryPolicy
, GetRepositoryPolicy
, grpRegistryId
, grpRepositoryName
, getRepositoryPolicyResponse
, GetRepositoryPolicyResponse
, grprsRegistryId
, grprsRepositoryName
, grprsPolicyText
, grprsResponseStatus
) where
import Network.AWS.ECR.Types
import Network.AWS.ECR.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data GetRepositoryPolicy = GetRepositoryPolicy'
{ _grpRegistryId :: !(Maybe Text)
, _grpRepositoryName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getRepositoryPolicy
:: Text
-> GetRepositoryPolicy
getRepositoryPolicy pRepositoryName_ =
GetRepositoryPolicy'
{ _grpRegistryId = Nothing
, _grpRepositoryName = pRepositoryName_
}
grpRegistryId :: Lens' GetRepositoryPolicy (Maybe Text)
grpRegistryId = lens _grpRegistryId (\ s a -> s{_grpRegistryId = a});
grpRepositoryName :: Lens' GetRepositoryPolicy Text
grpRepositoryName = lens _grpRepositoryName (\ s a -> s{_grpRepositoryName = a});
instance AWSRequest GetRepositoryPolicy where
type Rs GetRepositoryPolicy =
GetRepositoryPolicyResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
GetRepositoryPolicyResponse' <$>
(x .?> "registryId") <*> (x .?> "repositoryName") <*>
(x .?> "policyText")
<*> (pure (fromEnum s)))
instance Hashable GetRepositoryPolicy
instance ToHeaders GetRepositoryPolicy where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON GetRepositoryPolicy where
toJSON GetRepositoryPolicy'{..}
= object
(catMaybes
[("registryId" .=) <$> _grpRegistryId,
Just ("repositoryName" .= _grpRepositoryName)])
instance ToPath GetRepositoryPolicy where
toPath = const "/"
instance ToQuery GetRepositoryPolicy where
toQuery = const mempty
data GetRepositoryPolicyResponse = GetRepositoryPolicyResponse'
{ _grprsRegistryId :: !(Maybe Text)
, _grprsRepositoryName :: !(Maybe Text)
, _grprsPolicyText :: !(Maybe Text)
, _grprsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
getRepositoryPolicyResponse
:: Int
-> GetRepositoryPolicyResponse
getRepositoryPolicyResponse pResponseStatus_ =
GetRepositoryPolicyResponse'
{ _grprsRegistryId = Nothing
, _grprsRepositoryName = Nothing
, _grprsPolicyText = Nothing
, _grprsResponseStatus = pResponseStatus_
}
grprsRegistryId :: Lens' GetRepositoryPolicyResponse (Maybe Text)
grprsRegistryId = lens _grprsRegistryId (\ s a -> s{_grprsRegistryId = a});
grprsRepositoryName :: Lens' GetRepositoryPolicyResponse (Maybe Text)
grprsRepositoryName = lens _grprsRepositoryName (\ s a -> s{_grprsRepositoryName = a});
grprsPolicyText :: Lens' GetRepositoryPolicyResponse (Maybe Text)
grprsPolicyText = lens _grprsPolicyText (\ s a -> s{_grprsPolicyText = a});
grprsResponseStatus :: Lens' GetRepositoryPolicyResponse Int
grprsResponseStatus = lens _grprsResponseStatus (\ s a -> s{_grprsResponseStatus = a});