Пример #1
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);

            DescribeFlowLogsResponse resp = new DescribeFlowLogsResponse();

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

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

                foreach (var obj in resp.FlowLogs)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Пример #2
0
        public static DescribeFlowLogsResponse Unmarshall(UnmarshallerContext context)
        {
            DescribeFlowLogsResponse describeFlowLogsResponse = new DescribeFlowLogsResponse();

            describeFlowLogsResponse.HttpResponse = context.HttpResponse;
            describeFlowLogsResponse.RequestId    = context.StringValue("DescribeFlowLogs.RequestId");
            describeFlowLogsResponse.Success      = context.StringValue("DescribeFlowLogs.Success");
            describeFlowLogsResponse.TotalCount   = context.StringValue("DescribeFlowLogs.TotalCount");
            describeFlowLogsResponse.PageNumber   = context.StringValue("DescribeFlowLogs.PageNumber");
            describeFlowLogsResponse.PageSize     = context.StringValue("DescribeFlowLogs.PageSize");

            List <DescribeFlowLogsResponse.DescribeFlowLogs_FlowLog> describeFlowLogsResponse_flowLogs = new List <DescribeFlowLogsResponse.DescribeFlowLogs_FlowLog>();

            for (int i = 0; i < context.Length("DescribeFlowLogs.FlowLogs.Length"); i++)
            {
                DescribeFlowLogsResponse.DescribeFlowLogs_FlowLog flowLog = new DescribeFlowLogsResponse.DescribeFlowLogs_FlowLog();
                flowLog.FlowLogId    = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].FlowLogId");
                flowLog.FlowLogName  = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].FlowLogName");
                flowLog.Description  = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].Description");
                flowLog.CreationTime = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].CreationTime");
                flowLog.ResourceType = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].ResourceType");
                flowLog.ResourceId   = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].ResourceId");
                flowLog.ProjectName  = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].ProjectName");
                flowLog.LogStoreName = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].LogStoreName");
                flowLog.Status       = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].Status");
                flowLog.TrafficType  = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].TrafficType");
                flowLog.RegionId     = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].RegionId");

                describeFlowLogsResponse_flowLogs.Add(flowLog);
            }
            describeFlowLogsResponse.FlowLogs = describeFlowLogsResponse_flowLogs;

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

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

            return(response);
        }
Пример #4
0
        public static DescribeFlowLogsResponse Unmarshall(UnmarshallerContext context)
        {
            DescribeFlowLogsResponse describeFlowLogsResponse = new DescribeFlowLogsResponse();

            describeFlowLogsResponse.HttpResponse = context.HttpResponse;
            describeFlowLogsResponse.RequestId    = context.StringValue("DescribeFlowLogs.RequestId");
            describeFlowLogsResponse.TotalCount   = context.IntegerValue("DescribeFlowLogs.TotalCount");
            describeFlowLogsResponse.PageNumber   = context.IntegerValue("DescribeFlowLogs.PageNumber");
            describeFlowLogsResponse.PageSize     = context.IntegerValue("DescribeFlowLogs.PageSize");

            List <DescribeFlowLogsResponse.DescribeFlowLogs_FlowLogSetType> describeFlowLogsResponse_flowLogs = new List <DescribeFlowLogsResponse.DescribeFlowLogs_FlowLogSetType>();

            for (int i = 0; i < context.Length("DescribeFlowLogs.FlowLogs.Length"); i++)
            {
                DescribeFlowLogsResponse.DescribeFlowLogs_FlowLogSetType flowLogSetType = new DescribeFlowLogsResponse.DescribeFlowLogs_FlowLogSetType();
                flowLogSetType.FlowLogId         = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].FlowLogId");
                flowLogSetType.Description       = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].Description");
                flowLogSetType.ActiveAging       = context.IntegerValue("DescribeFlowLogs.FlowLogs[" + i + "].ActiveAging");
                flowLogSetType.InactiveAging     = context.IntegerValue("DescribeFlowLogs.FlowLogs[" + i + "].InactiveAging");
                flowLogSetType.OutputType        = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].OutputType");
                flowLogSetType.SlsRegionId       = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].SlsRegionId");
                flowLogSetType.ProjectName       = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].ProjectName");
                flowLogSetType.LogstoreName      = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].LogstoreName");
                flowLogSetType.NetflowServerIp   = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].NetflowServerIp");
                flowLogSetType.NetflowServerPort = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].NetflowServerPort");
                flowLogSetType.NetflowVersion    = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].NetflowVersion");
                flowLogSetType.Status            = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].Status");
                flowLogSetType.Name        = context.StringValue("DescribeFlowLogs.FlowLogs[" + i + "].Name");
                flowLogSetType.TotalSagNum = context.IntegerValue("DescribeFlowLogs.FlowLogs[" + i + "].TotalSagNum");

                describeFlowLogsResponse_flowLogs.Add(flowLogSetType);
            }
            describeFlowLogsResponse.FlowLogs = describeFlowLogsResponse_flowLogs;

            return(describeFlowLogsResponse);
        }