public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonGameLiftConfig config = new AmazonGameLiftConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonGameLiftClient client = new AmazonGameLiftClient(creds, config); DescribePlayerSessionsResponse resp = new DescribePlayerSessionsResponse(); do { DescribePlayerSessionsRequest req = new DescribePlayerSessionsRequest { NextToken = resp.NextToken , Limit = maxItems }; resp = client.DescribePlayerSessions(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.PlayerSessions) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribePlayerSessionsResponse response = new DescribePlayerSessionsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PlayerSessions", targetDepth)) { var unmarshaller = new ListUnmarshaller <PlayerSession, PlayerSessionUnmarshaller>(PlayerSessionUnmarshaller.Instance); response.PlayerSessions = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static DescribePlayerSessionsResult ParseFromBufferedDescribePlayerSessionsResponse(DescribePlayerSessionsResponse response) { var translation = new DescribePlayerSessionsResult(); translation.NextToken = response.NextToken; translation.PlayerSessions = new List <PlayerSession>(); foreach (var playerSession in response.PlayerSessions) { var translatedPlayerSession = new PlayerSession(); translatedPlayerSession.CreationTime = playerSession.CreationTime; translatedPlayerSession.FleetId = playerSession.FleetId; translatedPlayerSession.GameSessionId = playerSession.GameSessionId; translatedPlayerSession.IpAddress = playerSession.IpAddress; translatedPlayerSession.PlayerData = playerSession.PlayerData; translatedPlayerSession.PlayerId = playerSession.PlayerId; translatedPlayerSession.PlayerSessionId = playerSession.PlayerSessionId; translatedPlayerSession.Port = playerSession.Port; translatedPlayerSession.Status = PlayerSessionStatusMapper.GetPlayerSessionStatusForName(playerSession.Status); translatedPlayerSession.TerminationTime = playerSession.TerminationTime; translatedPlayerSession.DnsName = playerSession.DnsName; translation.AddPlayerSession(translatedPlayerSession); } return(translation); }