Пример #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateVpcResponse response = new CreateVpcResponse();

            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("vpc", targetDepth))
                    {
                        var unmarshaller = VpcUnmarshaller.Instance;
                        response.Vpc = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return(response);
        }
        public static CreateVpcResponse Unmarshall(UnmarshallerContext context)
        {
            CreateVpcResponse createVpcResponse = new CreateVpcResponse();

            createVpcResponse.HttpResponse = context.HttpResponse;
            createVpcResponse.RequestId    = context.StringValue("CreateVpc.RequestId");
            createVpcResponse.VpcId        = context.StringValue("CreateVpc.VpcId");
            createVpcResponse.VRouterId    = context.StringValue("CreateVpc.VRouterId");
            createVpcResponse.RouteTableId = context.StringValue("CreateVpc.RouteTableId");

            return(createVpcResponse);
        }
        public static CreateVpcResponse Unmarshall(UnmarshallerContext _ctx)
        {
            CreateVpcResponse createVpcResponse = new CreateVpcResponse();

            createVpcResponse.HttpResponse    = _ctx.HttpResponse;
            createVpcResponse.RequestId       = _ctx.StringValue("CreateVpc.RequestId");
            createVpcResponse.VpcId           = _ctx.StringValue("CreateVpc.VpcId");
            createVpcResponse.VRouterId       = _ctx.StringValue("CreateVpc.VRouterId");
            createVpcResponse.RouteTableId    = _ctx.StringValue("CreateVpc.RouteTableId");
            createVpcResponse.ResourceGroupId = _ctx.StringValue("CreateVpc.ResourceGroupId");

            return(createVpcResponse);
        }
Пример #4
0
        public static void CreateVPCEndpoint()
        {
            AmazonEC2Client   client      = new AmazonEC2Client();
            CreateVpcRequest  vpcRequest  = new CreateVpcRequest("10.32.0.0/16");
            CreateVpcResponse vpcResponse = client.CreateVpc(vpcRequest);
            Vpc vpc = vpcResponse.Vpc;
            CreateVpcEndpointRequest endpointRequest = new CreateVpcEndpointRequest();

            endpointRequest.VpcId       = vpc.VpcId;
            endpointRequest.ServiceName = "com.amazonaws.us-west-2.s3";
            CreateVpcEndpointResponse cVpcErsp = client.CreateVpcEndpoint(endpointRequest);
            VpcEndpoint vpcEndPoint            = cVpcErsp.VpcEndpoint;
        }
Пример #5
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            CreateVpcResponse response = new CreateVpcResponse();

            int targetDepth = 2;

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

                        continue;
                    }
                }
            }


            return(response);
        }