{-# 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.DescribeSessions
(
describeSessions
, DescribeSessions
, dsUserId
, dsNextToken
, dsLimit
, dsAuthenticationType
, dsStackName
, dsFleetName
, describeSessionsResponse
, DescribeSessionsResponse
, dssrsNextToken
, dssrsSessions
, dssrsResponseStatus
) 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 DescribeSessions = DescribeSessions'
{ _dsUserId :: !(Maybe Text)
, _dsNextToken :: !(Maybe Text)
, _dsLimit :: !(Maybe Int)
, _dsAuthenticationType :: !(Maybe AuthenticationType)
, _dsStackName :: !Text
, _dsFleetName :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSessions
:: Text
-> Text
-> DescribeSessions
describeSessions pStackName_ pFleetName_ =
DescribeSessions'
{ _dsUserId = Nothing
, _dsNextToken = Nothing
, _dsLimit = Nothing
, _dsAuthenticationType = Nothing
, _dsStackName = pStackName_
, _dsFleetName = pFleetName_
}
dsUserId :: Lens' DescribeSessions (Maybe Text)
dsUserId = lens _dsUserId (\ s a -> s{_dsUserId = a})
dsNextToken :: Lens' DescribeSessions (Maybe Text)
dsNextToken = lens _dsNextToken (\ s a -> s{_dsNextToken = a})
dsLimit :: Lens' DescribeSessions (Maybe Int)
dsLimit = lens _dsLimit (\ s a -> s{_dsLimit = a})
dsAuthenticationType :: Lens' DescribeSessions (Maybe AuthenticationType)
dsAuthenticationType = lens _dsAuthenticationType (\ s a -> s{_dsAuthenticationType = a})
dsStackName :: Lens' DescribeSessions Text
dsStackName = lens _dsStackName (\ s a -> s{_dsStackName = a})
dsFleetName :: Lens' DescribeSessions Text
dsFleetName = lens _dsFleetName (\ s a -> s{_dsFleetName = a})
instance AWSRequest DescribeSessions where
type Rs DescribeSessions = DescribeSessionsResponse
request = postJSON appStream
response
= receiveJSON
(\ s h x ->
DescribeSessionsResponse' <$>
(x .?> "NextToken") <*> (x .?> "Sessions" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribeSessions where
instance NFData DescribeSessions where
instance ToHeaders DescribeSessions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("PhotonAdminProxyService.DescribeSessions" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeSessions where
toJSON DescribeSessions'{..}
= object
(catMaybes
[("UserId" .=) <$> _dsUserId,
("NextToken" .=) <$> _dsNextToken,
("Limit" .=) <$> _dsLimit,
("AuthenticationType" .=) <$> _dsAuthenticationType,
Just ("StackName" .= _dsStackName),
Just ("FleetName" .= _dsFleetName)])
instance ToPath DescribeSessions where
toPath = const "/"
instance ToQuery DescribeSessions where
toQuery = const mempty
data DescribeSessionsResponse = DescribeSessionsResponse'
{ _dssrsNextToken :: !(Maybe Text)
, _dssrsSessions :: !(Maybe [Session])
, _dssrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
describeSessionsResponse
:: Int
-> DescribeSessionsResponse
describeSessionsResponse pResponseStatus_ =
DescribeSessionsResponse'
{ _dssrsNextToken = Nothing
, _dssrsSessions = Nothing
, _dssrsResponseStatus = pResponseStatus_
}
dssrsNextToken :: Lens' DescribeSessionsResponse (Maybe Text)
dssrsNextToken = lens _dssrsNextToken (\ s a -> s{_dssrsNextToken = a})
dssrsSessions :: Lens' DescribeSessionsResponse [Session]
dssrsSessions = lens _dssrsSessions (\ s a -> s{_dssrsSessions = a}) . _Default . _Coerce
dssrsResponseStatus :: Lens' DescribeSessionsResponse Int
dssrsResponseStatus = lens _dssrsResponseStatus (\ s a -> s{_dssrsResponseStatus = a})
instance NFData DescribeSessionsResponse where