public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeVTLDevicesResponse response = new DescribeVTLDevicesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("GatewayARN", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.GatewayARN = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("VTLDevices", targetDepth)) { var unmarshaller = new ListUnmarshaller <VTLDevice, VTLDeviceUnmarshaller>(VTLDeviceUnmarshaller.Instance); response.VTLDevices = unmarshaller.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); DescribeVTLDevicesResponse resp = new DescribeVTLDevicesResponse(); do { DescribeVTLDevicesRequest req = new DescribeVTLDevicesRequest { Marker = resp.Marker , Limit = maxItems }; resp = client.DescribeVTLDevices(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.VTLDevices) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeVTLDevicesResponse response = new DescribeVTLDevicesResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeVTLDevicesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("GatewayARN", targetDepth)) { context.Read(); response.GatewayARN = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("VTLDevices", targetDepth)) { context.Read(); response.VTLDevices = new List <VTLDevice>(); VTLDeviceUnmarshaller unmarshaller = VTLDeviceUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.VTLDevices.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; }