Skip to content

Commit

Permalink
Adding new GameLift operations
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanhay committed Aug 16, 2016
1 parent e5b733b commit ab07f78
Show file tree
Hide file tree
Showing 9 changed files with 527 additions and 0 deletions.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module : Network.AWS.GameLift.DescribeRuntimeConfiguration
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <[email protected]>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the current runtime configuration for the specified fleet. The runtime configuration tells GameLift how to launch server processes on instances in the fleet.
module Network.AWS.GameLift.DescribeRuntimeConfiguration
(
-- * Creating a Request
describeRuntimeConfiguration
, DescribeRuntimeConfiguration
-- * Request Lenses
, drcFleetId

-- * Destructuring the Response
, describeRuntimeConfigurationResponse
, DescribeRuntimeConfigurationResponse
-- * Response Lenses
, drcrsRuntimeConfiguration
, drcrsResponseStatus
) 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

-- | Represents the input for a request action.
--
-- /See:/ 'describeRuntimeConfiguration' smart constructor.
newtype DescribeRuntimeConfiguration = DescribeRuntimeConfiguration'
{ _drcFleetId :: Text
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'DescribeRuntimeConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drcFleetId'
describeRuntimeConfiguration
:: Text -- ^ 'drcFleetId'
-> DescribeRuntimeConfiguration
describeRuntimeConfiguration pFleetId_ =
DescribeRuntimeConfiguration'
{ _drcFleetId = pFleetId_
}

-- | Unique identifier of the fleet to get the runtime configuration for.
drcFleetId :: Lens' DescribeRuntimeConfiguration Text
drcFleetId = lens _drcFleetId (\ s a -> s{_drcFleetId = a});

instance AWSRequest DescribeRuntimeConfiguration
where
type Rs DescribeRuntimeConfiguration =
DescribeRuntimeConfigurationResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
DescribeRuntimeConfigurationResponse' <$>
(x .?> "RuntimeConfiguration") <*>
(pure (fromEnum s)))

instance Hashable DescribeRuntimeConfiguration

instance NFData DescribeRuntimeConfiguration

instance ToHeaders DescribeRuntimeConfiguration where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.DescribeRuntimeConfiguration" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])

instance ToJSON DescribeRuntimeConfiguration where
toJSON DescribeRuntimeConfiguration'{..}
= object
(catMaybes [Just ("FleetId" .= _drcFleetId)])

instance ToPath DescribeRuntimeConfiguration where
toPath = const "/"

instance ToQuery DescribeRuntimeConfiguration where
toQuery = const mempty

-- | Represents the returned data in response to a request action.
--
-- /See:/ 'describeRuntimeConfigurationResponse' smart constructor.
data DescribeRuntimeConfigurationResponse = DescribeRuntimeConfigurationResponse'
{ _drcrsRuntimeConfiguration :: !(Maybe RuntimeConfiguration)
, _drcrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'DescribeRuntimeConfigurationResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drcrsRuntimeConfiguration'
--
-- * 'drcrsResponseStatus'
describeRuntimeConfigurationResponse
:: Int -- ^ 'drcrsResponseStatus'
-> DescribeRuntimeConfigurationResponse
describeRuntimeConfigurationResponse pResponseStatus_ =
DescribeRuntimeConfigurationResponse'
{ _drcrsRuntimeConfiguration = Nothing
, _drcrsResponseStatus = pResponseStatus_
}

-- | Instructions describing how server processes should be launched and maintained on each instance in the fleet.
drcrsRuntimeConfiguration :: Lens' DescribeRuntimeConfigurationResponse (Maybe RuntimeConfiguration)
drcrsRuntimeConfiguration = lens _drcrsRuntimeConfiguration (\ s a -> s{_drcrsRuntimeConfiguration = a});

-- | The response status code.
drcrsResponseStatus :: Lens' DescribeRuntimeConfigurationResponse Int
drcrsResponseStatus = lens _drcrsResponseStatus (\ s a -> s{_drcrsResponseStatus = a});

instance NFData DescribeRuntimeConfigurationResponse
234 changes: 234 additions & 0 deletions amazonka-gamelift/gen/Network/AWS/GameLift/SearchGameSessions.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module : Network.AWS.GameLift.SearchGameSessions
-- Copyright : (c) 2013-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <[email protected]>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves a list of game sessions in a fleet that match a set of search criteria and sorts them in a specified order. Currently game session searches are limited to a single fleet. Search results include only game sessions that are in ACTIVE status.
--
-- You can search or sort by the following game session attributes:
--
-- - __gameSessionId__ -- ID value assigned to a game session. This unique value is returned in a < GameSession> object when a new game session is created.
-- - __gameSessionName__ -- Name assigned to a game session. This value is set when requesting a new game session with < CreateGameSession> or updating with < UpdateGameSession>. Game session names do not need to be unique to a game session.
-- - __creationTimeMillis__ -- Value indicating when a game session was created. It is expressed in Unix time as milliseconds.
-- - __playerSessionCount__ -- Number of players currently connected to a game session. This value changes rapidly as players join the session or drop out.
-- - __maximumSessions__ -- Maximum number of player sessions allowed for a game session. This value is set when requesting a new game session with < CreateGameSession> or updating with < UpdateGameSession>.
-- - __hasAvailablePlayerSessions__ -- Boolean value indicating whether or not a game session has reached its maximum number of players. When searching with this attribute, the search value must be 'true' or 'false'. It is highly recommended that all search requests include this filter attribute to optimize search performance and return only sessions that players can join.
--
-- To search or sort, specify either a fleet ID or an alias ID, and provide a search filter expression, a sort expression, or both. Use the pagination parameters to retrieve results as a set of sequential pages. If successful, a collection of < GameSession> objects matching the request is returned.
--
-- Returned values for 'playerSessionCount' and 'hasAvailablePlayerSessions' change quickly as players join sessions and others drop out. Results should be considered a snapshot in time. Be sure to refresh search results often, and handle sessions that fill up before a player can join.
module Network.AWS.GameLift.SearchGameSessions
(
-- * Creating a Request
searchGameSessions
, SearchGameSessions
-- * Request Lenses
, sgsFilterExpression
, sgsSortExpression
, sgsAliasId
, sgsNextToken
, sgsLimit
, sgsFleetId

-- * Destructuring the Response
, searchGameSessionsResponse
, SearchGameSessionsResponse
-- * Response Lenses
, sgsrsGameSessions
, sgsrsNextToken
, sgsrsResponseStatus
) 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

-- | Represents the input for a request action.
--
-- /See:/ 'searchGameSessions' smart constructor.
data SearchGameSessions = SearchGameSessions'
{ _sgsFilterExpression :: !(Maybe Text)
, _sgsSortExpression :: !(Maybe Text)
, _sgsAliasId :: !(Maybe Text)
, _sgsNextToken :: !(Maybe Text)
, _sgsLimit :: !(Maybe Nat)
, _sgsFleetId :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'SearchGameSessions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sgsFilterExpression'
--
-- * 'sgsSortExpression'
--
-- * 'sgsAliasId'
--
-- * 'sgsNextToken'
--
-- * 'sgsLimit'
--
-- * 'sgsFleetId'
searchGameSessions
:: SearchGameSessions
searchGameSessions =
SearchGameSessions'
{ _sgsFilterExpression = Nothing
, _sgsSortExpression = Nothing
, _sgsAliasId = Nothing
, _sgsNextToken = Nothing
, _sgsLimit = Nothing
, _sgsFleetId = Nothing
}

-- | String containing the search criteria for the session search. If no filter expression is included, the request returns results for all game sessions in the fleet that are in ACTIVE status.
--
-- A filter expression can contain one or multiple conditions. Each condition consists of the following:
--
-- - __Operand__ -- Name of a game session attribute. Valid values are 'gameSessionName', 'gameSessionId', 'creationTimeMillis', 'playerSessionCount', 'maximumSessions', 'hasAvailablePlayerSessions'.
-- - __Comparator__ -- Valid comparators are: '=', '&lt;&gt;', '&lt;', '&gt;', '&lt;=', '&gt;='.
-- - __Value__ -- Value to be searched for. Values can be numbers, boolean values (true\/false) or strings. String values are case sensitive, enclosed in single quotes. Special characters must be escaped. Boolean and string values can only be used with the comparators '=' and '&lt;&gt;'. For example, the following filter expression searches on 'gameSessionName': \"'FilterExpression\": \"gameSessionName = \'Matt\\\\\'s Awesome Game 1\'\"'.
--
-- To chain multiple conditions in a single expression, use the logical keywords 'AND', 'OR', and 'NOT' and parentheses as needed. For example: 'x AND y AND NOT z', 'NOT (x OR y)'.
--
-- Session search evaluates conditions from left to right using the following precedence rules:
--
-- 1. '=', '&lt;&gt;', '&lt;', '&gt;', '&lt;=', '&gt;='
-- 2. Parentheses
-- 3. NOT
-- 4. AND
-- 5. OR
--
-- For example, this filter expression retrieves game sessions hosting at least ten players that have an open player slot: '\"maximumSessions&gt;=10 AND hasAvailablePlayerSessions=true\"'.
sgsFilterExpression :: Lens' SearchGameSessions (Maybe Text)
sgsFilterExpression = lens _sgsFilterExpression (\ s a -> s{_sgsFilterExpression = a});

-- | Instructions on how to sort the search results. If no sort expression is included, the request returns results in random order. A sort expression consists of the following elements:
--
-- - __Operand__ -- Name of a game session attribute. Valid values are 'gameSessionName', 'gameSessionId', 'creationTimeMillis', 'playerSessionCount', 'maximumSessions', 'hasAvailablePlayerSessions'.
-- - __Order__ -- Valid sort orders are 'ASC' (ascending) and 'DESC' (descending).
--
-- For example, this sort expression returns the oldest active sessions first: '\"SortExpression\": \"creationTimeMillis ASC\"'. Results with a null value for the sort operand are returned at the end of the list.
sgsSortExpression :: Lens' SearchGameSessions (Maybe Text)
sgsSortExpression = lens _sgsSortExpression (\ s a -> s{_sgsSortExpression = a});

-- | Unique identifier for a fleet alias. Each request must reference either a fleet ID or alias ID, but not both.
sgsAliasId :: Lens' SearchGameSessions (Maybe Text)
sgsAliasId = lens _sgsAliasId (\ s a -> s{_sgsAliasId = a});

-- | Token indicating the start of the next sequential page of results. Use the token that is returned with a previous call to this action. To specify the start of the result set, do not specify a value.
sgsNextToken :: Lens' SearchGameSessions (Maybe Text)
sgsNextToken = lens _sgsNextToken (\ s a -> s{_sgsNextToken = a});

-- | Maximum number of results to return. Use this parameter with 'NextToken' to get results as a set of sequential pages. The maximum number of results returned is 20, even if this value is not set or is set higher than 20.
sgsLimit :: Lens' SearchGameSessions (Maybe Natural)
sgsLimit = lens _sgsLimit (\ s a -> s{_sgsLimit = a}) . mapping _Nat;

-- | Unique identifier for a fleet. Each request must reference either a fleet ID or alias ID, but not both.
sgsFleetId :: Lens' SearchGameSessions (Maybe Text)
sgsFleetId = lens _sgsFleetId (\ s a -> s{_sgsFleetId = a});

instance AWSRequest SearchGameSessions where
type Rs SearchGameSessions =
SearchGameSessionsResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
SearchGameSessionsResponse' <$>
(x .?> "GameSessions" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))

instance Hashable SearchGameSessions

instance NFData SearchGameSessions

instance ToHeaders SearchGameSessions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.SearchGameSessions" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])

instance ToJSON SearchGameSessions where
toJSON SearchGameSessions'{..}
= object
(catMaybes
[("FilterExpression" .=) <$> _sgsFilterExpression,
("SortExpression" .=) <$> _sgsSortExpression,
("AliasId" .=) <$> _sgsAliasId,
("NextToken" .=) <$> _sgsNextToken,
("Limit" .=) <$> _sgsLimit,
("FleetId" .=) <$> _sgsFleetId])

instance ToPath SearchGameSessions where
toPath = const "/"

instance ToQuery SearchGameSessions where
toQuery = const mempty

-- | Represents the returned data in response to a request action.
--
-- /See:/ 'searchGameSessionsResponse' smart constructor.
data SearchGameSessionsResponse = SearchGameSessionsResponse'
{ _sgsrsGameSessions :: !(Maybe [GameSession])
, _sgsrsNextToken :: !(Maybe Text)
, _sgsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'SearchGameSessionsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sgsrsGameSessions'
--
-- * 'sgsrsNextToken'
--
-- * 'sgsrsResponseStatus'
searchGameSessionsResponse
:: Int -- ^ 'sgsrsResponseStatus'
-> SearchGameSessionsResponse
searchGameSessionsResponse pResponseStatus_ =
SearchGameSessionsResponse'
{ _sgsrsGameSessions = Nothing
, _sgsrsNextToken = Nothing
, _sgsrsResponseStatus = pResponseStatus_
}

-- | Collection of objects containing game session properties for each session matching the request.
sgsrsGameSessions :: Lens' SearchGameSessionsResponse [GameSession]
sgsrsGameSessions = lens _sgsrsGameSessions (\ s a -> s{_sgsrsGameSessions = a}) . _Default . _Coerce;

-- | Token indicating where to resume retrieving results on the next call to this action. If no token is returned, these results represent the end of the list.
--
-- If a request has a limit that exactly matches the number of remaining results, a token is returned even though there are no more results to retrieve.
sgsrsNextToken :: Lens' SearchGameSessionsResponse (Maybe Text)
sgsrsNextToken = lens _sgsrsNextToken (\ s a -> s{_sgsrsNextToken = a});

-- | The response status code.
sgsrsResponseStatus :: Lens' SearchGameSessionsResponse Int
sgsrsResponseStatus = lens _sgsrsResponseStatus (\ s a -> s{_sgsrsResponseStatus = a});

instance NFData SearchGameSessionsResponse
Loading

0 comments on commit ab07f78

Please sign in to comment.