/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribePlacementGroupsResponse response = new DescribePlacementGroupsResponse(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth = 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("placementGroupSet/item", targetDepth)) { var unmarshaller = PlacementGroupUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.PlacementGroups.Add(item); continue; } } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonEC2Config config = new AmazonEC2Config(); config.RegionEndpoint = region; ConfigureClient(config); AmazonEC2Client client = new AmazonEC2Client(creds, config); DescribePlacementGroupsResponse resp = new DescribePlacementGroupsResponse(); DescribePlacementGroupsRequest req = new DescribePlacementGroupsRequest { }; resp = client.DescribePlacementGroups(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.PlacementGroups) { AddObject(obj); } }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribePlacementGroupsResponse response = new DescribePlacementGroupsResponse(); int targetDepth = 2; while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("placementGroupSet/item", targetDepth)) { response.PlacementGroups.Add(PlacementGroupUnmarshaller.GetInstance().Unmarshall(context)); continue; } } } return(response); }