{-# 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.Mobile.CreateProject
(
createProject
, CreateProject
, cpContents
, cpName
, cpRegion
, cpSnapshotId
, createProjectResponse
, CreateProjectResponse
, cprsDetails
, cprsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.Mobile.Types
import Network.AWS.Mobile.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateProject = CreateProject'
{ _cpContents :: !(Maybe ByteString)
, _cpName :: !(Maybe Text)
, _cpRegion :: !(Maybe Text)
, _cpSnapshotId :: !(Maybe Text)
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createProject
:: CreateProject
createProject =
CreateProject'
{ _cpContents = Nothing
, _cpName = Nothing
, _cpRegion = Nothing
, _cpSnapshotId = Nothing
}
cpContents :: Lens' CreateProject (Maybe ByteString)
cpContents = lens _cpContents (\ s a -> s{_cpContents = a})
cpName :: Lens' CreateProject (Maybe Text)
cpName = lens _cpName (\ s a -> s{_cpName = a})
cpRegion :: Lens' CreateProject (Maybe Text)
cpRegion = lens _cpRegion (\ s a -> s{_cpRegion = a})
cpSnapshotId :: Lens' CreateProject (Maybe Text)
cpSnapshotId = lens _cpSnapshotId (\ s a -> s{_cpSnapshotId = a})
instance AWSRequest CreateProject where
type Rs CreateProject = CreateProjectResponse
request = postBody mobile
response
= receiveJSON
(\ s h x ->
CreateProjectResponse' <$>
(x .?> "details") <*> (pure (fromEnum s)))
instance Hashable CreateProject where
instance NFData CreateProject where
instance ToBody CreateProject where
toBody = toBody . _cpContents
instance ToHeaders CreateProject where
toHeaders
= const
(mconcat
["Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToPath CreateProject where
toPath = const "/projects"
instance ToQuery CreateProject where
toQuery CreateProject'{..}
= mconcat
["name" =: _cpName, "region" =: _cpRegion,
"snapshotId" =: _cpSnapshotId]
data CreateProjectResponse = CreateProjectResponse'
{ _cprsDetails :: !(Maybe ProjectDetails)
, _cprsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createProjectResponse
:: Int
-> CreateProjectResponse
createProjectResponse pResponseStatus_ =
CreateProjectResponse'
{_cprsDetails = Nothing, _cprsResponseStatus = pResponseStatus_}
cprsDetails :: Lens' CreateProjectResponse (Maybe ProjectDetails)
cprsDetails = lens _cprsDetails (\ s a -> s{_cprsDetails = a})
cprsResponseStatus :: Lens' CreateProjectResponse Int
cprsResponseStatus = lens _cprsResponseStatus (\ s a -> s{_cprsResponseStatus = a})
instance NFData CreateProjectResponse where