/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeVpcEndpointsResponse response = new DescribeVpcEndpointsResponse();

            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("nextToken", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.NextToken = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("vpcEndpointSet/item", targetDepth))
                    {
                        var unmarshaller = VpcEndpointUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.VpcEndpoints.Add(item);
                        continue;
                    }
                }
            }

            return(response);
        }
Пример #2
0
        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);

            DescribeVpcEndpointsResponse resp = new DescribeVpcEndpointsResponse();

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

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

                foreach (var obj in resp.VpcEndpoints)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Пример #3
0
        public static void DescribeVPCEndPoints()
        {
            AmazonEC2Client             client          = new AmazonEC2Client();
            DescribeVpcEndpointsRequest endpointRequest = new DescribeVpcEndpointsRequest();

            endpointRequest.MaxResults = 5;
            DescribeVpcEndpointsResponse endpointResponse = client.DescribeVpcEndpoints(endpointRequest);
            List <VpcEndpoint>           endpointList     = endpointResponse.VpcEndpoints;

            foreach (VpcEndpoint vpc in endpointList)
            {
                Console.WriteLine("VpcEndpoint ID = " + vpc.VpcEndpointId);
                List <string> routeTableIds = vpc.RouteTableIds;
                foreach (string id in routeTableIds)
                {
                    Console.WriteLine("\tRoute Table ID = " + id);
                }
            }
        }
Пример #4
0
        private static void DeleteVPCEndPoint()
        {
            AmazonEC2Client             client          = new AmazonEC2Client();
            DescribeVpcEndpointsRequest endpointRequest = new DescribeVpcEndpointsRequest();

            endpointRequest.MaxResults = 5;
            DescribeVpcEndpointsResponse endpointResponse = client.DescribeVpcEndpoints(endpointRequest);
            List <VpcEndpoint>           endpointList     = endpointResponse.VpcEndpoints;
            var vpcEndPointListIds = new List <string>();

            foreach (VpcEndpoint vpc in endpointList)
            {
                Console.WriteLine("VpcEndpoint ID = " + vpc.VpcEndpointId);
                vpcEndPointListIds.Add(vpc.VpcEndpointId);
            }
            DeleteVpcEndpointsRequest deleteRequest = new DeleteVpcEndpointsRequest();

            deleteRequest.VpcEndpointIds = vpcEndPointListIds;
            client.DeleteVpcEndpoints(deleteRequest);
        }