Example #1
0
        public static VolumeAttachmentUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new VolumeAttachmentUnmarshaller();
            }

            return(instance);
        }
Example #2
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DetachVolumeResponse response = new DetachVolumeResponse();

            int targetDepth = 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression(".", targetDepth))
                    {
                        response.Attachment = VolumeAttachmentUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
            }


            return(response);
        }
        public Volume Unmarshall(XmlUnmarshallerContext context)
        {
            Volume volume        = new Volume();
            int    originalDepth = context.CurrentDepth;
            int    targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 1;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("volumeId", targetDepth))
                    {
                        volume.VolumeId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("size", targetDepth))
                    {
                        volume.Size = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("snapshotId", targetDepth))
                    {
                        volume.SnapshotId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("availabilityZone", targetDepth))
                    {
                        volume.AvailabilityZone = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("status", targetDepth))
                    {
                        volume.State = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("createTime", targetDepth))
                    {
                        volume.CreateTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("attachmentSet/item", targetDepth))
                    {
                        volume.Attachments.Add(VolumeAttachmentUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("tagSet/item", targetDepth))
                    {
                        volume.Tags.Add(TagUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("volumeType", targetDepth))
                    {
                        volume.VolumeType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("iops", targetDepth))
                    {
                        volume.Iops = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(volume);
                }
            }



            return(volume);
        }