public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonRekognitionConfig config = new AmazonRekognitionConfig();

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

            ListStreamProcessorsResponse resp = new ListStreamProcessorsResponse();

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

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

                foreach (var obj in resp.StreamProcessors)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListStreamProcessorsResponse response = new ListStreamProcessorsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("StreamProcessors", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <StreamProcessor, StreamProcessorUnmarshaller>(StreamProcessorUnmarshaller.Instance);
                    response.StreamProcessors = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Example #3
0
        public List <string> ListStreamProcessors()
        {
            List <string> streamProcessors = new List <string>();
            ListStreamProcessorsResponse listStreamProcessorsResponse =
                rekognitionClient.ListStreamProcessors(new ListStreamProcessorsRequest()
            {
                MaxResults = 100,
            });

            //List all stream processors (and state) returned from Rekognition
            foreach (StreamProcessor streamProcessor in listStreamProcessorsResponse.StreamProcessors)
            {
                streamProcessors.Add(streamProcessor.Name);
                Console.WriteLine("StreamProcessor name - " + streamProcessor.Name);
                Console.WriteLine("Status - " + streamProcessor.Status + "\n");
            }

            return(streamProcessors);
        }
Example #4
0
        public static List <string> ListStreamProcessors()
        {
            List <string> streamProcessors = null;

            try
            {
                AmazonRekognitionClient rekognitionClient;
                using (rekognitionClient = new AmazonRekognitionClient(MyAWSConfigs.KinesisRegion))
                {
                    ListStreamProcessorsResponse listStreamProcessorsResponse =
                        rekognitionClient.ListStreamProcessors(new ListStreamProcessorsRequest()
                    {
                        MaxResults = 100,
                    });

                    if (listStreamProcessorsResponse.HttpStatusCode == System.Net.HttpStatusCode.OK)
                    {
                        streamProcessors = new List <string>();

                        // List all stream processors (and state) returned from Rekognition
                        foreach (StreamProcessor streamProcessor in listStreamProcessorsResponse.StreamProcessors)
                        {
                            streamProcessors.Add(streamProcessor.Name);
                            Console.WriteLine("StreamProcessor name - " + streamProcessor.Name);
                            Console.WriteLine("Status - " + streamProcessor.Status + "\n");
                        }
                    }
                }
            }
            catch (AmazonRekognitionException e)
            {
                Console.WriteLine("AmazonRekognitionException: " + e);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e);
            }

            return(streamProcessors);
        }