예제 #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)
        {
            DescribeConnectorsResponse response = new DescribeConnectorsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("connectorConfigurations", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <string, ConnectorConfiguration, StringUnmarshaller, ConnectorConfigurationUnmarshaller>(StringUnmarshaller.Instance, ConnectorConfigurationUnmarshaller.Instance);
                    response.ConnectorConfigurations = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("connectors", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ConnectorDetail, ConnectorDetailUnmarshaller>(ConnectorDetailUnmarshaller.Instance);
                    response.Connectors = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
예제 #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonAppflowConfig config = new AmazonAppflowConfig();

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

            DescribeConnectorsResponse resp = new DescribeConnectorsResponse();

            do
            {
                DescribeConnectorsRequest req = new DescribeConnectorsRequest
                {
                    NextToken = resp.NextToken
                };

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

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