{-# 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.OpsWorks.CreateDeployment
(
createDeployment
, CreateDeployment
, cdCustomJSON
, cdAppId
, cdInstanceIds
, cdLayerIds
, cdComment
, cdStackId
, cdCommand
, createDeploymentResponse
, CreateDeploymentResponse
, cdrsDeploymentId
, cdrsResponseStatus
) 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 CreateDeployment = CreateDeployment'
{ _cdCustomJSON :: !(Maybe Text)
, _cdAppId :: !(Maybe Text)
, _cdInstanceIds :: !(Maybe [Text])
, _cdLayerIds :: !(Maybe [Text])
, _cdComment :: !(Maybe Text)
, _cdStackId :: !Text
, _cdCommand :: !DeploymentCommand
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDeployment
:: Text
-> DeploymentCommand
-> CreateDeployment
createDeployment pStackId_ pCommand_ =
CreateDeployment'
{ _cdCustomJSON = Nothing
, _cdAppId = Nothing
, _cdInstanceIds = Nothing
, _cdLayerIds = Nothing
, _cdComment = Nothing
, _cdStackId = pStackId_
, _cdCommand = pCommand_
}
cdCustomJSON :: Lens' CreateDeployment (Maybe Text)
cdCustomJSON = lens _cdCustomJSON (\ s a -> s{_cdCustomJSON = a})
cdAppId :: Lens' CreateDeployment (Maybe Text)
cdAppId = lens _cdAppId (\ s a -> s{_cdAppId = a})
cdInstanceIds :: Lens' CreateDeployment [Text]
cdInstanceIds = lens _cdInstanceIds (\ s a -> s{_cdInstanceIds = a}) . _Default . _Coerce
cdLayerIds :: Lens' CreateDeployment [Text]
cdLayerIds = lens _cdLayerIds (\ s a -> s{_cdLayerIds = a}) . _Default . _Coerce
cdComment :: Lens' CreateDeployment (Maybe Text)
cdComment = lens _cdComment (\ s a -> s{_cdComment = a})
cdStackId :: Lens' CreateDeployment Text
cdStackId = lens _cdStackId (\ s a -> s{_cdStackId = a})
cdCommand :: Lens' CreateDeployment DeploymentCommand
cdCommand = lens _cdCommand (\ s a -> s{_cdCommand = a})
instance AWSRequest CreateDeployment where
type Rs CreateDeployment = CreateDeploymentResponse
request = postJSON opsWorks
response
= receiveJSON
(\ s h x ->
CreateDeploymentResponse' <$>
(x .?> "DeploymentId") <*> (pure (fromEnum s)))
instance Hashable CreateDeployment where
instance NFData CreateDeployment where
instance ToHeaders CreateDeployment where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("OpsWorks_20130218.CreateDeployment" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateDeployment where
toJSON CreateDeployment'{..}
= object
(catMaybes
[("CustomJson" .=) <$> _cdCustomJSON,
("AppId" .=) <$> _cdAppId,
("InstanceIds" .=) <$> _cdInstanceIds,
("LayerIds" .=) <$> _cdLayerIds,
("Comment" .=) <$> _cdComment,
Just ("StackId" .= _cdStackId),
Just ("Command" .= _cdCommand)])
instance ToPath CreateDeployment where
toPath = const "/"
instance ToQuery CreateDeployment where
toQuery = const mempty
data CreateDeploymentResponse = CreateDeploymentResponse'
{ _cdrsDeploymentId :: !(Maybe Text)
, _cdrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createDeploymentResponse
:: Int
-> CreateDeploymentResponse
createDeploymentResponse pResponseStatus_ =
CreateDeploymentResponse'
{_cdrsDeploymentId = Nothing, _cdrsResponseStatus = pResponseStatus_}
cdrsDeploymentId :: Lens' CreateDeploymentResponse (Maybe Text)
cdrsDeploymentId = lens _cdrsDeploymentId (\ s a -> s{_cdrsDeploymentId = a})
cdrsResponseStatus :: Lens' CreateDeploymentResponse Int
cdrsResponseStatus = lens _cdrsResponseStatus (\ s a -> s{_cdrsResponseStatus = a})
instance NFData CreateDeploymentResponse where