module Network.AWS.OpsWorks.CreateApp
(
CreateApp
, createApp
, caAppSource
, caAttributes
, caDataSources
, caDescription
, caDomains
, caEnableSsl
, caEnvironment
, caName
, caShortname
, caSslConfiguration
, caStackId
, caType
, CreateAppResponse
, createAppResponse
, carAppId
) where
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.OpsWorks.Types
import qualified GHC.Exts
data CreateApp = CreateApp
{ _caAppSource :: Maybe Source
, _caAttributes :: Map AppAttributesKeys Text
, _caDataSources :: List "DataSources" DataSource
, _caDescription :: Maybe Text
, _caDomains :: List "Domains" Text
, _caEnableSsl :: Maybe Bool
, _caEnvironment :: List "Environment" EnvironmentVariable
, _caName :: Text
, _caShortname :: Maybe Text
, _caSslConfiguration :: Maybe SslConfiguration
, _caStackId :: Text
, _caType :: AppType
} deriving (Eq, Show)
createApp :: Text
-> Text
-> AppType
-> CreateApp
createApp p1 p2 p3 = CreateApp
{ _caStackId = p1
, _caName = p2
, _caType = p3
, _caShortname = Nothing
, _caDescription = Nothing
, _caDataSources = mempty
, _caAppSource = Nothing
, _caDomains = mempty
, _caEnableSsl = Nothing
, _caSslConfiguration = Nothing
, _caAttributes = mempty
, _caEnvironment = mempty
}
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 }) . _Map
caDataSources :: Lens' CreateApp [DataSource]
caDataSources = lens _caDataSources (\s a -> s { _caDataSources = a }) . _List
caDescription :: Lens' CreateApp (Maybe Text)
caDescription = lens _caDescription (\s a -> s { _caDescription = a })
caDomains :: Lens' CreateApp [Text]
caDomains = lens _caDomains (\s a -> s { _caDomains = a }) . _List
caEnableSsl :: Lens' CreateApp (Maybe Bool)
caEnableSsl = lens _caEnableSsl (\s a -> s { _caEnableSsl = a })
caEnvironment :: Lens' CreateApp [EnvironmentVariable]
caEnvironment = lens _caEnvironment (\s a -> s { _caEnvironment = a }) . _List
caName :: Lens' CreateApp Text
caName = lens _caName (\s a -> s { _caName = a })
caShortname :: Lens' CreateApp (Maybe Text)
caShortname = lens _caShortname (\s a -> s { _caShortname = a })
caSslConfiguration :: Lens' CreateApp (Maybe SslConfiguration)
caSslConfiguration =
lens _caSslConfiguration (\s a -> s { _caSslConfiguration = a })
caStackId :: Lens' CreateApp Text
caStackId = lens _caStackId (\s a -> s { _caStackId = a })
caType :: Lens' CreateApp AppType
caType = lens _caType (\s a -> s { _caType = a })
newtype CreateAppResponse = CreateAppResponse
{ _carAppId :: Maybe Text
} deriving (Eq, Ord, Show, Monoid)
createAppResponse :: CreateAppResponse
createAppResponse = CreateAppResponse
{ _carAppId = Nothing
}
carAppId :: Lens' CreateAppResponse (Maybe Text)
carAppId = lens _carAppId (\s a -> s { _carAppId = a })
instance ToPath CreateApp where
toPath = const "/"
instance ToQuery CreateApp where
toQuery = const mempty
instance ToHeaders CreateApp
instance ToJSON CreateApp where
toJSON CreateApp{..} = object
[ "StackId" .= _caStackId
, "Shortname" .= _caShortname
, "Name" .= _caName
, "Description" .= _caDescription
, "DataSources" .= _caDataSources
, "Type" .= _caType
, "AppSource" .= _caAppSource
, "Domains" .= _caDomains
, "EnableSsl" .= _caEnableSsl
, "SslConfiguration" .= _caSslConfiguration
, "Attributes" .= _caAttributes
, "Environment" .= _caEnvironment
]
instance AWSRequest CreateApp where
type Sv CreateApp = OpsWorks
type Rs CreateApp = CreateAppResponse
request = post "CreateApp"
response = jsonResponse
instance FromJSON CreateAppResponse where
parseJSON = withObject "CreateAppResponse" $ \o -> CreateAppResponse
<$> o .:? "AppId"