/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGatewaysResponse response = new ListGatewaysResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("gatewaySummaries", targetDepth)) { var unmarshaller = new ListUnmarshaller <GatewaySummary, GatewaySummaryUnmarshaller>(GatewaySummaryUnmarshaller.Instance); response.GatewaySummaries = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGatewaysResponse response = new ListGatewaysResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Gateways", targetDepth)) { var unmarshaller = new ListUnmarshaller <GatewayInfo, GatewayInfoUnmarshaller>( GatewayInfoUnmarshaller.GetInstance()); response.Gateways = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonStorageGatewayConfig config = new AmazonStorageGatewayConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonStorageGatewayClient client = new AmazonStorageGatewayClient(creds, config); ListGatewaysResponse resp = new ListGatewaysResponse(); do { ListGatewaysRequest req = new ListGatewaysRequest { Marker = resp.Marker , Limit = maxItems }; resp = client.ListGateways(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Gateways) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonIoTSiteWiseConfig config = new AmazonIoTSiteWiseConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonIoTSiteWiseClient client = new AmazonIoTSiteWiseClient(creds, config); ListGatewaysResponse resp = new ListGatewaysResponse(); do { ListGatewaysRequest req = new ListGatewaysRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListGateways(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.GatewaySummaries) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGatewaysResponse response = new ListGatewaysResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGatewaysResponse response = new ListGatewaysResponse(); context.Read(); response.ListGatewaysResult = ListGatewaysResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, ListGatewaysResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Gateways", targetDepth)) { context.Read(); response.Gateways = new List <GatewayInfo>(); GatewayInfoUnmarshaller unmarshaller = GatewayInfoUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Gateways.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.TestExpression("Marker", targetDepth)) { context.Read(); response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }