示例#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)
        {
            DescribeVpcPeeringConnectionsResponse response = new DescribeVpcPeeringConnectionsResponse();

            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("vpcPeeringConnectionSet/item", targetDepth))
                    {
                        var unmarshaller = VpcPeeringConnectionUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.VpcPeeringConnections.Add(item);
                        continue;
                    }
                }
            }

            return(response);
        }
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonEC2Config config = new AmazonEC2Config();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonEC2Client client = new AmazonEC2Client(creds, config);

            DescribeVpcPeeringConnectionsResponse resp = new DescribeVpcPeeringConnectionsResponse();

            do
            {
                DescribeVpcPeeringConnectionsRequest req = new DescribeVpcPeeringConnectionsRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.DescribeVpcPeeringConnections(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.VpcPeeringConnections)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
示例#3
0
        internal static void WriteVpcPeeringConnections(IAmazonEC2 ec2, DateTime captureTime, string accountId, string region)
        {
            DescribeVpcPeeringConnectionsResponse vpcPeeringResponses = ec2.DescribeVpcPeeringConnections();

            foreach (var vpcPeer in vpcPeeringResponses.VpcPeeringConnections)
            {
                string vpcPeerJson = JsonConvert.SerializeObject(vpcPeer);
                Common.UpdateTopology(captureTime, accountId, region, "vpcpc", vpcPeer.VpcPeeringConnectionId, vpcPeerJson, "UPDATE");
            }
        }
示例#4
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeVpcPeeringConnectionsResponse response = new DescribeVpcPeeringConnectionsResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("VpcPeeringConnections", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <VpcPeeringConnection, VpcPeeringConnectionUnmarshaller>(VpcPeeringConnectionUnmarshaller.Instance);
                    response.VpcPeeringConnections = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
示例#5
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeVpcPeeringConnectionsResponse response = new DescribeVpcPeeringConnectionsResponse();

            int targetDepth = 2;

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("vpcPeeringConnectionSet/item", targetDepth))
                    {
                        response.VpcPeeringConnections.Add(VpcPeeringConnectionUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
            }


            return(response);
        }