private static void UnmarshallResult(XmlUnmarshallerContext context, DescribePoliciesResponse response) { 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("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ScalingPolicies/member", targetDepth)) { var unmarshaller = ScalingPolicyUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.ScalingPolicies.Add(item); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribePoliciesResponse response = new DescribePoliciesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribePoliciesResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
/// <summary> /// <para> Returns descriptions of what each policy does. This action supports pagination. If the response includes a token, there are more /// records available. To get the additional records, repeat the request with the response token as the NextToken parameter. </para> /// </summary> /// /// <param name="describePoliciesRequest">Container for the necessary parameters to execute the DescribePolicies service method on /// AmazonAutoScaling.</param> /// /// <returns>The response from the DescribePolicies service method, as returned by AmazonAutoScaling.</returns> /// /// <exception cref="InvalidNextTokenException"/> public DescribePoliciesResponse DescribePolicies(DescribePoliciesRequest describePoliciesRequest) { IRequest <DescribePoliciesRequest> request = new DescribePoliciesRequestMarshaller().Marshall(describePoliciesRequest); DescribePoliciesResponse response = Invoke <DescribePoliciesRequest, DescribePoliciesResponse> (request, this.signer, DescribePoliciesResponseUnmarshaller.GetInstance()); return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonAutoScalingConfig config = new AmazonAutoScalingConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonAutoScalingClient client = new AmazonAutoScalingClient(creds, config); DescribePoliciesResponse resp = new DescribePoliciesResponse(); do { DescribePoliciesRequest req = new DescribePoliciesRequest { NextToken = resp.NextToken , MaxRecords = maxItems }; resp = client.DescribePolicies(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ScalingPolicies) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { DescribePoliciesResponse response = new DescribePoliciesResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("DescribePoliciesResult", 2)) { response.DescribePoliciesResult = DescribePoliciesResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }
private static void UnmarshallResult(XmlUnmarshallerContext context, DescribePoliciesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("ScalingPolicies/member", targetDepth)) { response.ScalingPolicies.Add(ScalingPolicyUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("NextToken", targetDepth)) { response.NextToken = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }