public static EC2SecurityGroupUnmarshaller GetInstance() { if (instance == null) { instance = new EC2SecurityGroupUnmarshaller(); } return(instance); }
public ClusterSecurityGroup Unmarshall(XmlUnmarshallerContext context) { ClusterSecurityGroup clusterSecurityGroup = new ClusterSecurityGroup(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } if (context.IsStartOfDocument) { targetDepth++; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("ClusterSecurityGroupName", targetDepth)) { clusterSecurityGroup.ClusterSecurityGroupName = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Description", targetDepth)) { clusterSecurityGroup.Description = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("EC2SecurityGroups/EC2SecurityGroup", targetDepth)) { clusterSecurityGroup.EC2SecurityGroups.Add(EC2SecurityGroupUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("IPRanges/IPRange", targetDepth)) { clusterSecurityGroup.IPRanges.Add(IPRangeUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return(clusterSecurityGroup); } } return(clusterSecurityGroup); }