public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribePermissionsResponse response = new DescribePermissionsResponse(); context.Read(); UnmarshallResult(context, response); return(response); }
public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribePermissionsResponse response = new DescribePermissionsResponse(); context.Read(); response.DescribePermissionsResult = DescribePermissionsResultUnmarshaller.GetInstance().Unmarshall(context); return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DescribePermissionsResponse response = new DescribePermissionsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Permissions", targetDepth)) { var unmarshaller = new ListUnmarshaller <Permission, PermissionUnmarshaller>(PermissionUnmarshaller.Instance); response.Permissions = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonOpsWorksConfig config = new AmazonOpsWorksConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonOpsWorksClient client = new AmazonOpsWorksClient(creds, config); DescribePermissionsResponse resp = new DescribePermissionsResponse(); DescribePermissionsRequest req = new DescribePermissionsRequest { }; resp = client.DescribePermissions(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Permissions) { AddObject(obj); } }
private static void UnmarshallResult(JsonUnmarshallerContext context, DescribePermissionsResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; while (context.Read()) { if (context.TestExpression("Permissions", targetDepth)) { context.Read(); response.Permissions = new List <Permission>(); PermissionUnmarshaller unmarshaller = PermissionUnmarshaller.GetInstance(); while (context.Read()) { JsonToken token = context.CurrentTokenType; if (token == JsonToken.ArrayStart) { continue; } if (token == JsonToken.ArrayEnd) { break; } response.Permissions.Add(unmarshaller.Unmarshall(context)); } continue; } if (context.CurrentDepth <= originalDepth) { return; } } return; }