module Network.AWS.CodeCommit.CreateRepository
(
createRepository
, CreateRepository
, crRepositoryDescription
, crRepositoryName
, createRepositoryResponse
, CreateRepositoryResponse
, crrsRepositoryMetadata
, crrsStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateRepository = CreateRepository'
{ _crRepositoryDescription :: !(Maybe Text)
, _crRepositoryName :: !Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRepository
:: Text
-> CreateRepository
createRepository pRepositoryName_ =
CreateRepository'
{ _crRepositoryDescription = Nothing
, _crRepositoryName = pRepositoryName_
}
crRepositoryDescription :: Lens' CreateRepository (Maybe Text)
crRepositoryDescription = lens _crRepositoryDescription (\ s a -> s{_crRepositoryDescription = a});
crRepositoryName :: Lens' CreateRepository Text
crRepositoryName = lens _crRepositoryName (\ s a -> s{_crRepositoryName = a});
instance AWSRequest CreateRepository where
type Rs CreateRepository = CreateRepositoryResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
CreateRepositoryResponse' <$>
(x .?> "repositoryMetadata") <*> (pure (fromEnum s)))
instance ToHeaders CreateRepository where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.CreateRepository" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateRepository where
toJSON CreateRepository'{..}
= object
(catMaybes
[("repositoryDescription" .=) <$>
_crRepositoryDescription,
Just ("repositoryName" .= _crRepositoryName)])
instance ToPath CreateRepository where
toPath = const "/"
instance ToQuery CreateRepository where
toQuery = const mempty
data CreateRepositoryResponse = CreateRepositoryResponse'
{ _crrsRepositoryMetadata :: !(Maybe RepositoryMetadata)
, _crrsStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createRepositoryResponse
:: Int
-> CreateRepositoryResponse
createRepositoryResponse pStatus_ =
CreateRepositoryResponse'
{ _crrsRepositoryMetadata = Nothing
, _crrsStatus = pStatus_
}
crrsRepositoryMetadata :: Lens' CreateRepositoryResponse (Maybe RepositoryMetadata)
crrsRepositoryMetadata = lens _crrsRepositoryMetadata (\ s a -> s{_crrsRepositoryMetadata = a});
crrsStatus :: Lens' CreateRepositoryResponse Int
crrsStatus = lens _crrsStatus (\ s a -> s{_crrsStatus = a});