{-# 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.CreateStreamingURL
(
createStreamingURL
, CreateStreamingURL
, csuSessionContext
, csuApplicationId
, csuValidity
, csuStackName
, csuFleetName
, csuUserId
, createStreamingURLResponse
, CreateStreamingURLResponse
, csursStreamingURL
, csursExpires
, csursResponseStatus
) 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 CreateStreamingURL = CreateStreamingURL'
{ _csuSessionContext :: !(Maybe Text)
, _csuApplicationId :: !(Maybe Text)
, _csuValidity :: !(Maybe Integer)
, _csuStackName :: !Text
, _csuFleetName :: !Text
, _csuUserId :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createStreamingURL
:: Text
-> Text
-> Text
-> CreateStreamingURL
createStreamingURL pStackName_ pFleetName_ pUserId_ =
CreateStreamingURL'
{ _csuSessionContext = Nothing
, _csuApplicationId = Nothing
, _csuValidity = Nothing
, _csuStackName = pStackName_
, _csuFleetName = pFleetName_
, _csuUserId = pUserId_
}
csuSessionContext :: Lens' CreateStreamingURL (Maybe Text)
csuSessionContext = lens _csuSessionContext (\ s a -> s{_csuSessionContext = a})
csuApplicationId :: Lens' CreateStreamingURL (Maybe Text)
csuApplicationId = lens _csuApplicationId (\ s a -> s{_csuApplicationId = a})
csuValidity :: Lens' CreateStreamingURL (Maybe Integer)
csuValidity = lens _csuValidity (\ s a -> s{_csuValidity = a})
csuStackName :: Lens' CreateStreamingURL Text
csuStackName = lens _csuStackName (\ s a -> s{_csuStackName = a})
csuFleetName :: Lens' CreateStreamingURL Text
csuFleetName = lens _csuFleetName (\ s a -> s{_csuFleetName = a})
csuUserId :: Lens' CreateStreamingURL Text
csuUserId = lens _csuUserId (\ s a -> s{_csuUserId = a})
instance AWSRequest CreateStreamingURL where
type Rs CreateStreamingURL =
CreateStreamingURLResponse
request = postJSON appStream
response
= receiveJSON
(\ s h x ->
CreateStreamingURLResponse' <$>
(x .?> "StreamingURL") <*> (x .?> "Expires") <*>
(pure (fromEnum s)))
instance Hashable CreateStreamingURL where
instance NFData CreateStreamingURL where
instance ToHeaders CreateStreamingURL where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("PhotonAdminProxyService.CreateStreamingURL" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreateStreamingURL where
toJSON CreateStreamingURL'{..}
= object
(catMaybes
[("SessionContext" .=) <$> _csuSessionContext,
("ApplicationId" .=) <$> _csuApplicationId,
("Validity" .=) <$> _csuValidity,
Just ("StackName" .= _csuStackName),
Just ("FleetName" .= _csuFleetName),
Just ("UserId" .= _csuUserId)])
instance ToPath CreateStreamingURL where
toPath = const "/"
instance ToQuery CreateStreamingURL where
toQuery = const mempty
data CreateStreamingURLResponse = CreateStreamingURLResponse'
{ _csursStreamingURL :: !(Maybe Text)
, _csursExpires :: !(Maybe POSIX)
, _csursResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
createStreamingURLResponse
:: Int
-> CreateStreamingURLResponse
createStreamingURLResponse pResponseStatus_ =
CreateStreamingURLResponse'
{ _csursStreamingURL = Nothing
, _csursExpires = Nothing
, _csursResponseStatus = pResponseStatus_
}
csursStreamingURL :: Lens' CreateStreamingURLResponse (Maybe Text)
csursStreamingURL = lens _csursStreamingURL (\ s a -> s{_csursStreamingURL = a})
csursExpires :: Lens' CreateStreamingURLResponse (Maybe UTCTime)
csursExpires = lens _csursExpires (\ s a -> s{_csursExpires = a}) . mapping _Time
csursResponseStatus :: Lens' CreateStreamingURLResponse Int
csursResponseStatus = lens _csursResponseStatus (\ s a -> s{_csursResponseStatus = a})
instance NFData CreateStreamingURLResponse where