Contains the output of AllocateAddress.
Наследование: Amazon.Runtime.AmazonWebServiceResponse
 public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) 
 {   
     AllocateAddressResponse response = new AllocateAddressResponse();
     
     int targetDepth = 2;
     while (context.Read())
     {
         if (context.IsStartElement || context.IsAttribute)
         {
             
             if (context.TestExpression("publicIp", targetDepth))
             {
                 response.PublicIp = StringUnmarshaller.GetInstance().Unmarshall(context);
                     
                 continue;
             }
             if (context.TestExpression("domain", targetDepth))
             {
                 response.Domain = StringUnmarshaller.GetInstance().Unmarshall(context);
                     
                 continue;
             }
             if (context.TestExpression("allocationId", targetDepth))
             {
                 response.AllocationId = StringUnmarshaller.GetInstance().Unmarshall(context);
                     
                 continue;
             }
         }
     }
          
                 
     return response;
 }
Пример #2
0
 public string AllocateAddress()
 {
     try
     {
         Amazon.EC2.Model.AllocateAddressRequest  request  = new Amazon.EC2.Model.AllocateAddressRequest();
         Amazon.EC2.Model.AllocateAddressResponse response = ec2.AllocateAddress(request);
         return(response.AllocateAddressResult.PublicIp);
     }
     catch (WebException e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
     catch (AmazonEC2Exception e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
 }
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            AllocateAddressResponse response = new AllocateAddressResponse();

            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("allocationId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.AllocationId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("domain", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Domain = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("publicIp", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.PublicIp = unmarshaller.Unmarshall(context);
                        continue;
                    }
                } 
            }

            return response;
        }