{-# 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.RequestUploadCredentials
(
requestUploadCredentials
, RequestUploadCredentials
, rucBuildId
, requestUploadCredentialsResponse
, RequestUploadCredentialsResponse
, rucrsStorageLocation
, rucrsUploadCredentials
, rucrsResponseStatus
) 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
newtype RequestUploadCredentials = RequestUploadCredentials'
{ _rucBuildId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)
requestUploadCredentials
:: Text
-> RequestUploadCredentials
requestUploadCredentials pBuildId_ =
RequestUploadCredentials'
{ _rucBuildId = pBuildId_
}
rucBuildId :: Lens' RequestUploadCredentials Text
rucBuildId = lens _rucBuildId (\ s a -> s{_rucBuildId = a});
instance AWSRequest RequestUploadCredentials where
type Rs RequestUploadCredentials =
RequestUploadCredentialsResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
RequestUploadCredentialsResponse' <$>
(x .?> "StorageLocation") <*>
(x .?> "UploadCredentials")
<*> (pure (fromEnum s)))
instance Hashable RequestUploadCredentials
instance NFData RequestUploadCredentials
instance ToHeaders RequestUploadCredentials where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.RequestUploadCredentials" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON RequestUploadCredentials where
toJSON RequestUploadCredentials'{..}
= object
(catMaybes [Just ("BuildId" .= _rucBuildId)])
instance ToPath RequestUploadCredentials where
toPath = const "/"
instance ToQuery RequestUploadCredentials where
toQuery = const mempty
data RequestUploadCredentialsResponse = RequestUploadCredentialsResponse'
{ _rucrsStorageLocation :: !(Maybe S3Location)
, _rucrsUploadCredentials :: !(Maybe (Sensitive AWSCredentials))
, _rucrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
requestUploadCredentialsResponse
:: Int
-> RequestUploadCredentialsResponse
requestUploadCredentialsResponse pResponseStatus_ =
RequestUploadCredentialsResponse'
{ _rucrsStorageLocation = Nothing
, _rucrsUploadCredentials = Nothing
, _rucrsResponseStatus = pResponseStatus_
}
rucrsStorageLocation :: Lens' RequestUploadCredentialsResponse (Maybe S3Location)
rucrsStorageLocation = lens _rucrsStorageLocation (\ s a -> s{_rucrsStorageLocation = a});
rucrsUploadCredentials :: Lens' RequestUploadCredentialsResponse (Maybe AWSCredentials)
rucrsUploadCredentials = lens _rucrsUploadCredentials (\ s a -> s{_rucrsUploadCredentials = a}) . mapping _Sensitive;
rucrsResponseStatus :: Lens' RequestUploadCredentialsResponse Int
rucrsResponseStatus = lens _rucrsResponseStatus (\ s a -> s{_rucrsResponseStatus = a});
instance NFData RequestUploadCredentialsResponse