module Network.AWS.OpsWorks.CreateApp
(
createApp
, CreateApp
, caSSLConfiguration
, caEnvironment
, caEnableSSL
, caShortname
, caDataSources
, caAppSource
, caAttributes
, caDomains
, caDescription
, caStackId
, caName
, caType
, createAppResponse
, CreateAppResponse
, carsAppId
, carsResponseStatus
) where
import Network.AWS.Lens
import Network.AWS.OpsWorks.Types
import Network.AWS.OpsWorks.Types.Product
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateApp = CreateApp'
{ _caSSLConfiguration :: !(Maybe SSLConfiguration)
, _caEnvironment :: !(Maybe [EnvironmentVariable])
, _caEnableSSL :: !(Maybe Bool)
, _caShortname :: !(Maybe Text)
, _caDataSources :: !(Maybe [DataSource])
, _caAppSource :: !(Maybe Source)
, _caAttributes :: !(Maybe (Map AppAttributesKeys Text))
, _caDomains :: !(Maybe [Text])
, _caDescription :: !(Maybe Text)
, _caStackId :: !Text
, _caName :: !Text
, _caType :: !AppType
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createApp
:: Text
-> Text
-> AppType
-> CreateApp
createApp pStackId_ pName_ pType_ =
CreateApp'
{ _caSSLConfiguration = Nothing
, _caEnvironment = Nothing
, _caEnableSSL = Nothing
, _caShortname = Nothing
, _caDataSources = Nothing
, _caAppSource = Nothing
, _caAttributes = Nothing
, _caDomains = Nothing
, _caDescription = Nothing
, _caStackId = pStackId_
, _caName = pName_
, _caType = pType_
}
caSSLConfiguration :: Lens' CreateApp (Maybe SSLConfiguration)
caSSLConfiguration = lens _caSSLConfiguration (\ s a -> s{_caSSLConfiguration = a});
caEnvironment :: Lens' CreateApp [EnvironmentVariable]
caEnvironment = lens _caEnvironment (\ s a -> s{_caEnvironment = a}) . _Default . _Coerce;
caEnableSSL :: Lens' CreateApp (Maybe Bool)
caEnableSSL = lens _caEnableSSL (\ s a -> s{_caEnableSSL = a});
caShortname :: Lens' CreateApp (Maybe Text)
caShortname = lens _caShortname (\ s a -> s{_caShortname = a});
caDataSources :: Lens' CreateApp [DataSource]
caDataSources = lens _caDataSources (\ s a -> s{_caDataSources = a}) . _Default . _Coerce;
caAppSource :: Lens' CreateApp (Maybe Source)
caAppSource = lens _caAppSource (\ s a -> s{_caAppSource = a});
caAttributes :: Lens' CreateApp (HashMap AppAttributesKeys Text)
caAttributes = lens _caAttributes (\ s a -> s{_caAttributes = a}) . _Default . _Map;
caDomains :: Lens' CreateApp [Text]
caDomains = lens _caDomains (\ s a -> s{_caDomains = a}) . _Default . _Coerce;
caDescription :: Lens' CreateApp (Maybe Text)
caDescription = lens _caDescription (\ s a -> s{_caDescription = a});
caStackId :: Lens' CreateApp Text
caStackId = lens _caStackId (\ s a -> s{_caStackId = a});
caName :: Lens' CreateApp Text
caName = lens _caName (\ s a -> s{_caName = a});
caType :: Lens' CreateApp AppType
caType = lens _caType (\ s a -> s{_caType = a});
instance AWSRequest CreateApp where
type Rs CreateApp = CreateAppResponse
request = postJSON opsWorks
response
= receiveJSON
(\ s h x ->
CreateAppResponse' <$>
(x .?> "AppId") <*> (pure (fromEnum s)))
instance ToHeaders CreateApp where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorks_20130218.CreateApp" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateApp where
toJSON CreateApp'{..}
= object
(catMaybes
[("SslConfiguration" .=) <$> _caSSLConfiguration,
("Environment" .=) <$> _caEnvironment,
("EnableSsl" .=) <$> _caEnableSSL,
("Shortname" .=) <$> _caShortname,
("DataSources" .=) <$> _caDataSources,
("AppSource" .=) <$> _caAppSource,
("Attributes" .=) <$> _caAttributes,
("Domains" .=) <$> _caDomains,
("Description" .=) <$> _caDescription,
Just ("StackId" .= _caStackId),
Just ("Name" .= _caName), Just ("Type" .= _caType)])
instance ToPath CreateApp where
toPath = const "/"
instance ToQuery CreateApp where
toQuery = const mempty
data CreateAppResponse = CreateAppResponse'
{ _carsAppId :: !(Maybe Text)
, _carsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createAppResponse
:: Int
-> CreateAppResponse
createAppResponse pResponseStatus_ =
CreateAppResponse'
{ _carsAppId = Nothing
, _carsResponseStatus = pResponseStatus_
}
carsAppId :: Lens' CreateAppResponse (Maybe Text)
carsAppId = lens _carsAppId (\ s a -> s{_carsAppId = a});
carsResponseStatus :: Lens' CreateAppResponse Int
carsResponseStatus = lens _carsResponseStatus (\ s a -> s{_carsResponseStatus = a});