Exemplo n.º 1
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)
        {
            ListEventSourceMappingsResponse response = new ListEventSourceMappingsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("EventSourceMappings", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <EventSourceMappingConfiguration, EventSourceMappingConfigurationUnmarshaller>(EventSourceMappingConfigurationUnmarshaller.Instance);
                    response.EventSourceMappings = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextMarker", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextMarker = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonLambdaConfig config = new AmazonLambdaConfig();

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

            ListEventSourceMappingsResponse resp = new ListEventSourceMappingsResponse();

            do
            {
                ListEventSourceMappingsRequest req = new ListEventSourceMappingsRequest
                {
                    Marker = resp.NextMarker
                    ,
                    MaxItems = maxItems
                };

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

                foreach (var obj in resp.EventSourceMappings)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextMarker));
        }