/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeConnectionsResponse response = new DescribeConnectionsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Connections", targetDepth)) { var unmarshaller = new ListUnmarshaller <Connection, ConnectionUnmarshaller>(ConnectionUnmarshaller.Instance); response.Connections = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDatabaseMigrationServiceConfig config = new AmazonDatabaseMigrationServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDatabaseMigrationServiceClient client = new AmazonDatabaseMigrationServiceClient(creds, config); DescribeConnectionsResponse resp = new DescribeConnectionsResponse(); do { DescribeConnectionsRequest req = new DescribeConnectionsRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeConnections(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Connections) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeConnectionsResponse response = new DescribeConnectionsResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribeConnectionsResponse response = new DescribeConnectionsResponse(); context.Read(); response.DescribeConnectionsResult = DescribeConnectionsResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDirectConnectConfig config = new AmazonDirectConnectConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDirectConnectClient client = new AmazonDirectConnectClient(creds, config); DescribeConnectionsResponse resp = new DescribeConnectionsResponse(); DescribeConnectionsRequest req = new DescribeConnectionsRequest { }; resp = client.DescribeConnections(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Connections) { AddObject(obj); } }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeConnectionsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("connections", targetDepth)) { context.Read(); response.Connections = new List <Connection>(); ConnectionUnmarshaller unmarshaller = ConnectionUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Connections.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }