{-# 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.ECS.CreateCluster
(
createCluster
, CreateCluster
, ccClusterName
, createClusterResponse
, CreateClusterResponse
, ccrsCluster
, ccrsResponseStatus
) where
import Network.AWS.ECS.Types
import Network.AWS.ECS.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
newtype CreateCluster = CreateCluster'
{ _ccClusterName :: Maybe Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createCluster
:: CreateCluster
createCluster = CreateCluster' {_ccClusterName = Nothing}
ccClusterName :: Lens' CreateCluster (Maybe Text)
ccClusterName = lens _ccClusterName (\ s a -> s{_ccClusterName = a})
instance AWSRequest CreateCluster where
type Rs CreateCluster = CreateClusterResponse
request = postJSON ecs
response
= receiveJSON
(\ s h x ->
CreateClusterResponse' <$>
(x .?> "cluster") <*> (pure (fromEnum s)))
instance Hashable CreateCluster where
instance NFData CreateCluster where
instance ToHeaders CreateCluster where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("AmazonEC2ContainerServiceV20141113.CreateCluster"
:: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateCluster where
toJSON CreateCluster'{..}
= object
(catMaybes [("clusterName" .=) <$> _ccClusterName])
instance ToPath CreateCluster where
toPath = const "/"
instance ToQuery CreateCluster where
toQuery = const mempty
data CreateClusterResponse = CreateClusterResponse'
{ _ccrsCluster :: !(Maybe Cluster)
, _ccrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createClusterResponse
:: Int
-> CreateClusterResponse
createClusterResponse pResponseStatus_ =
CreateClusterResponse'
{_ccrsCluster = Nothing, _ccrsResponseStatus = pResponseStatus_}
ccrsCluster :: Lens' CreateClusterResponse (Maybe Cluster)
ccrsCluster = lens _ccrsCluster (\ s a -> s{_ccrsCluster = a})
ccrsResponseStatus :: Lens' CreateClusterResponse Int
ccrsResponseStatus = lens _ccrsResponseStatus (\ s a -> s{_ccrsResponseStatus = a})
instance NFData CreateClusterResponse where