Esempio n. 1
0
        public static BlockDeviceMappingUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new BlockDeviceMappingUnmarshaller();
            }

            return(instance);
        }
        public LaunchSpecification Unmarshall(XmlUnmarshallerContext context)
        {
            LaunchSpecification launchSpecification = new LaunchSpecification();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("imageId", targetDepth))
                    {
                        launchSpecification.ImageId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("keyName", targetDepth))
                    {
                        launchSpecification.KeyName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("groupSet/item", targetDepth))
                    {
                        launchSpecification.AllSecurityGroups.Add(GroupIdentifierUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("groupSet/item/groupName", targetDepth))
                    {
                        launchSpecification.SecurityGroups.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("userData", targetDepth))
                    {
                        launchSpecification.UserData = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("addressingType", targetDepth))
                    {
                        launchSpecification.AddressingType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("instanceType", targetDepth))
                    {
                        launchSpecification.InstanceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("placement", targetDepth))
                    {
                        launchSpecification.Placement = SpotPlacementUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("kernelId", targetDepth))
                    {
                        launchSpecification.KernelId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ramdiskId", targetDepth))
                    {
                        launchSpecification.RamdiskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("blockDeviceMapping/item", targetDepth))
                    {
                        launchSpecification.BlockDeviceMappings.Add(BlockDeviceMappingUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("monitoring/enabled", targetDepth))
                    {
                        launchSpecification.MonitoringEnabled = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("subnetId", targetDepth))
                    {
                        launchSpecification.SubnetId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("networkInterfaceSet/item", targetDepth))
                    {
                        launchSpecification.NetworkInterfaces.Add(InstanceNetworkInterfaceSpecificationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("iamInstanceProfile", targetDepth))
                    {
                        launchSpecification.IamInstanceProfile = IamInstanceProfileSpecificationUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ebsOptimized", targetDepth))
                    {
                        launchSpecification.EbsOptimized = BoolUnmarshaller.GetInstance().Unmarshall(context);

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



            return(launchSpecification);
        }
Esempio n. 3
0
        public ImageAttribute Unmarshall(XmlUnmarshallerContext context)
        {
            ImageAttribute imageAttribute = new ImageAttribute();
            int            originalDepth  = context.CurrentDepth;
            int            targetDepth    = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("imageId", targetDepth))
                    {
                        imageAttribute.ImageId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("launchPermission/item", targetDepth))
                    {
                        imageAttribute.LaunchPermissions.Add(LaunchPermissionUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("productCodes/item", targetDepth))
                    {
                        imageAttribute.ProductCodes.Add(ProductCodeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("kernel/value", targetDepth))
                    {
                        imageAttribute.KernelId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ramdisk/value", targetDepth))
                    {
                        imageAttribute.RamdiskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("description/value", targetDepth))
                    {
                        imageAttribute.Description = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("sriovNetSupport/value", targetDepth))
                    {
                        imageAttribute.SriovNetSupport = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("blockDeviceMapping/item", targetDepth))
                    {
                        imageAttribute.BlockDeviceMappings.Add(BlockDeviceMappingUnmarshaller.GetInstance().Unmarshall(context));

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



            return(imageAttribute);
        }
Esempio n. 4
0
        public Image Unmarshall(XmlUnmarshallerContext context)
        {
            Image image         = new Image();
            int   originalDepth = context.CurrentDepth;
            int   targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("imageId", targetDepth))
                    {
                        image.ImageId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("imageLocation", targetDepth))
                    {
                        image.ImageLocation = StringUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("imageOwnerId", targetDepth))
                    {
                        image.OwnerId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("isPublic", targetDepth))
                    {
                        image.Public = BoolUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("productCodes/item", targetDepth))
                    {
                        image.ProductCodes.Add(ProductCodeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("architecture", targetDepth))
                    {
                        image.Architecture = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("imageType", targetDepth))
                    {
                        image.ImageType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("kernelId", targetDepth))
                    {
                        image.KernelId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ramdiskId", targetDepth))
                    {
                        image.RamdiskId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("platform", targetDepth))
                    {
                        image.Platform = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("sriovNetSupport", targetDepth))
                    {
                        image.SriovNetSupport = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("stateReason", targetDepth))
                    {
                        image.StateReason = StateReasonUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("imageOwnerAlias", targetDepth))
                    {
                        image.ImageOwnerAlias = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("name", targetDepth))
                    {
                        image.Name = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("description", targetDepth))
                    {
                        image.Description = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("rootDeviceType", targetDepth))
                    {
                        image.RootDeviceType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("rootDeviceName", targetDepth))
                    {
                        image.RootDeviceName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("blockDeviceMapping/item", targetDepth))
                    {
                        image.BlockDeviceMappings.Add(BlockDeviceMappingUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("virtualizationType", targetDepth))
                    {
                        image.VirtualizationType = StringUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("hypervisor", targetDepth))
                    {
                        image.Hypervisor = StringUnmarshaller.GetInstance().Unmarshall(context);

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



            return(image);
        }