module Network.AWS.ECR.CreateRepository
(
createRepository
, CreateRepository
, crRepositoryName
, createRepositoryResponse
, CreateRepositoryResponse
, crrsRepository
, crrsResponseStatus
) 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
newtype CreateRepository = CreateRepository'
{ _crRepositoryName :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRepository
:: Text
-> CreateRepository
createRepository pRepositoryName_ =
CreateRepository'
{ _crRepositoryName = pRepositoryName_
}
crRepositoryName :: Lens' CreateRepository Text
crRepositoryName = lens _crRepositoryName (\ s a -> s{_crRepositoryName = a});
instance AWSRequest CreateRepository where
type Rs CreateRepository = CreateRepositoryResponse
request = postJSON ecr
response
= receiveJSON
(\ s h x ->
CreateRepositoryResponse' <$>
(x .?> "repository") <*> (pure (fromEnum s)))
instance Hashable CreateRepository
instance NFData CreateRepository
instance ToHeaders CreateRepository where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerRegistry_V20150921.CreateRepository"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateRepository where
toJSON CreateRepository'{..}
= object
(catMaybes
[Just ("repositoryName" .= _crRepositoryName)])
instance ToPath CreateRepository where
toPath = const "/"
instance ToQuery CreateRepository where
toQuery = const mempty
data CreateRepositoryResponse = CreateRepositoryResponse'
{ _crrsRepository :: !(Maybe Repository)
, _crrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRepositoryResponse
:: Int
-> CreateRepositoryResponse
createRepositoryResponse pResponseStatus_ =
CreateRepositoryResponse'
{ _crrsRepository = Nothing
, _crrsResponseStatus = pResponseStatus_
}
crrsRepository :: Lens' CreateRepositoryResponse (Maybe Repository)
crrsRepository = lens _crrsRepository (\ s a -> s{_crrsRepository = a});
crrsResponseStatus :: Lens' CreateRepositoryResponse Int
crrsResponseStatus = lens _crrsResponseStatus (\ s a -> s{_crrsResponseStatus = a});
instance NFData CreateRepositoryResponse