{-# 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.AppStream.CreateStack
(
createStack
, CreateStack
, csFeedbackURL
, csStorageConnectors
, csDisplayName
, csDescription
, csRedirectURL
, csName
, createStackResponse
, CreateStackResponse
, csrsStack
, csrsResponseStatus
) where
import Network.AWS.AppStream.Types
import Network.AWS.AppStream.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateStack = CreateStack'
{ _csFeedbackURL :: !(Maybe Text)
, _csStorageConnectors :: !(Maybe [StorageConnector])
, _csDisplayName :: !(Maybe Text)
, _csDescription :: !(Maybe Text)
, _csRedirectURL :: !(Maybe Text)
, _csName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createStack
:: Text
-> CreateStack
createStack pName_ =
CreateStack'
{ _csFeedbackURL = Nothing
, _csStorageConnectors = Nothing
, _csDisplayName = Nothing
, _csDescription = Nothing
, _csRedirectURL = Nothing
, _csName = pName_
}
csFeedbackURL :: Lens' CreateStack (Maybe Text)
csFeedbackURL = lens _csFeedbackURL (\ s a -> s{_csFeedbackURL = a})
csStorageConnectors :: Lens' CreateStack [StorageConnector]
csStorageConnectors = lens _csStorageConnectors (\ s a -> s{_csStorageConnectors = a}) . _Default . _Coerce
csDisplayName :: Lens' CreateStack (Maybe Text)
csDisplayName = lens _csDisplayName (\ s a -> s{_csDisplayName = a})
csDescription :: Lens' CreateStack (Maybe Text)
csDescription = lens _csDescription (\ s a -> s{_csDescription = a})
csRedirectURL :: Lens' CreateStack (Maybe Text)
csRedirectURL = lens _csRedirectURL (\ s a -> s{_csRedirectURL = a})
csName :: Lens' CreateStack Text
csName = lens _csName (\ s a -> s{_csName = a})
instance AWSRequest CreateStack where
type Rs CreateStack = CreateStackResponse
request = postJSON appStream
response
= receiveJSON
(\ s h x ->
CreateStackResponse' <$>
(x .?> "Stack") <*> (pure (fromEnum s)))
instance Hashable CreateStack where
instance NFData CreateStack where
instance ToHeaders CreateStack where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("PhotonAdminProxyService.CreateStack" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateStack where
toJSON CreateStack'{..}
= object
(catMaybes
[("FeedbackURL" .=) <$> _csFeedbackURL,
("StorageConnectors" .=) <$> _csStorageConnectors,
("DisplayName" .=) <$> _csDisplayName,
("Description" .=) <$> _csDescription,
("RedirectURL" .=) <$> _csRedirectURL,
Just ("Name" .= _csName)])
instance ToPath CreateStack where
toPath = const "/"
instance ToQuery CreateStack where
toQuery = const mempty
data CreateStackResponse = CreateStackResponse'
{ _csrsStack :: !(Maybe Stack)
, _csrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createStackResponse
:: Int
-> CreateStackResponse
createStackResponse pResponseStatus_ =
CreateStackResponse'
{_csrsStack = Nothing, _csrsResponseStatus = pResponseStatus_}
csrsStack :: Lens' CreateStackResponse (Maybe Stack)
csrsStack = lens _csrsStack (\ s a -> s{_csrsStack = a})
csrsResponseStatus :: Lens' CreateStackResponse Int
csrsResponseStatus = lens _csrsResponseStatus (\ s a -> s{_csrsResponseStatus = a})
instance NFData CreateStackResponse where