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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Marker", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Marker = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Schemas", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.Schemas = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            DescribeSchemasResponse resp = new DescribeSchemasResponse();

            do
            {
                DescribeSchemasRequest req = new DescribeSchemasRequest
                {
                    Marker = resp.Marker
                    ,
                    MaxRecords = maxItems
                };

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

                foreach (var obj in resp.Schemas)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.Marker));
        }
        public static DescribeSchemasResponse Unmarshall(UnmarshallerContext context)
        {
            DescribeSchemasResponse describeSchemasResponse = new DescribeSchemasResponse();

            describeSchemasResponse.HttpResponse = context.HttpResponse;
            describeSchemasResponse.RequestId    = context.StringValue("DescribeSchemas.RequestId");

            List <DescribeSchemasResponse.DescribeSchemas_Schema> describeSchemasResponse_items = new List <DescribeSchemasResponse.DescribeSchemas_Schema>();

            for (int i = 0; i < context.Length("DescribeSchemas.Items.Length"); i++)
            {
                DescribeSchemasResponse.DescribeSchemas_Schema schema = new DescribeSchemasResponse.DescribeSchemas_Schema();
                schema.DBClusterId = context.StringValue("DescribeSchemas.Items[" + i + "].DBClusterId");
                schema.SchemaName  = context.StringValue("DescribeSchemas.Items[" + i + "].SchemaName");

                describeSchemasResponse_items.Add(schema);
            }
            describeSchemasResponse.Items = describeSchemasResponse_items;

            return(describeSchemasResponse);
        }