{-# 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.GameLift.CreateBuild
(
createBuild
, CreateBuild
, cbStorageLocation
, cbOperatingSystem
, cbName
, cbVersion
, createBuildResponse
, CreateBuildResponse
, cbrsStorageLocation
, cbrsUploadCredentials
, cbrsBuild
, cbrsResponseStatus
) where
import Network.AWS.GameLift.Types
import Network.AWS.GameLift.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreateBuild = CreateBuild'
{ _cbStorageLocation :: !(Maybe S3Location)
, _cbOperatingSystem :: !(Maybe OperatingSystem)
, _cbName :: !(Maybe Text)
, _cbVersion :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createBuild
:: CreateBuild
createBuild =
CreateBuild'
{ _cbStorageLocation = Nothing
, _cbOperatingSystem = Nothing
, _cbName = Nothing
, _cbVersion = Nothing
}
cbStorageLocation :: Lens' CreateBuild (Maybe S3Location)
cbStorageLocation = lens _cbStorageLocation (\ s a -> s{_cbStorageLocation = a});
cbOperatingSystem :: Lens' CreateBuild (Maybe OperatingSystem)
cbOperatingSystem = lens _cbOperatingSystem (\ s a -> s{_cbOperatingSystem = a});
cbName :: Lens' CreateBuild (Maybe Text)
cbName = lens _cbName (\ s a -> s{_cbName = a});
cbVersion :: Lens' CreateBuild (Maybe Text)
cbVersion = lens _cbVersion (\ s a -> s{_cbVersion = a});
instance AWSRequest CreateBuild where
type Rs CreateBuild = CreateBuildResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
CreateBuildResponse' <$>
(x .?> "StorageLocation") <*>
(x .?> "UploadCredentials")
<*> (x .?> "Build")
<*> (pure (fromEnum s)))
instance Hashable CreateBuild
instance NFData CreateBuild
instance ToHeaders CreateBuild where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.CreateBuild" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateBuild where
toJSON CreateBuild'{..}
= object
(catMaybes
[("StorageLocation" .=) <$> _cbStorageLocation,
("OperatingSystem" .=) <$> _cbOperatingSystem,
("Name" .=) <$> _cbName,
("Version" .=) <$> _cbVersion])
instance ToPath CreateBuild where
toPath = const "/"
instance ToQuery CreateBuild where
toQuery = const mempty
data CreateBuildResponse = CreateBuildResponse'
{ _cbrsStorageLocation :: !(Maybe S3Location)
, _cbrsUploadCredentials :: !(Maybe (Sensitive AWSCredentials))
, _cbrsBuild :: !(Maybe Build)
, _cbrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createBuildResponse
:: Int
-> CreateBuildResponse
createBuildResponse pResponseStatus_ =
CreateBuildResponse'
{ _cbrsStorageLocation = Nothing
, _cbrsUploadCredentials = Nothing
, _cbrsBuild = Nothing
, _cbrsResponseStatus = pResponseStatus_
}
cbrsStorageLocation :: Lens' CreateBuildResponse (Maybe S3Location)
cbrsStorageLocation = lens _cbrsStorageLocation (\ s a -> s{_cbrsStorageLocation = a});
cbrsUploadCredentials :: Lens' CreateBuildResponse (Maybe AWSCredentials)
cbrsUploadCredentials = lens _cbrsUploadCredentials (\ s a -> s{_cbrsUploadCredentials = a}) . mapping _Sensitive;
cbrsBuild :: Lens' CreateBuildResponse (Maybe Build)
cbrsBuild = lens _cbrsBuild (\ s a -> s{_cbrsBuild = a});
cbrsResponseStatus :: Lens' CreateBuildResponse Int
cbrsResponseStatus = lens _cbrsResponseStatus (\ s a -> s{_cbrsResponseStatus = a});
instance NFData CreateBuildResponse