예제 #1
0
        public static GetInventorySchemaResponse Unmarshall(UnmarshallerContext _ctx)
        {
            GetInventorySchemaResponse getInventorySchemaResponse = new GetInventorySchemaResponse();

            getInventorySchemaResponse.HttpResponse = _ctx.HttpResponse;
            getInventorySchemaResponse.RequestId    = _ctx.StringValue("GetInventorySchema.RequestId");
            getInventorySchemaResponse.NextToken    = _ctx.StringValue("GetInventorySchema.NextToken");

            List <GetInventorySchemaResponse.GetInventorySchema_Schema> getInventorySchemaResponse_schemas = new List <GetInventorySchemaResponse.GetInventorySchema_Schema>();

            for (int i = 0; i < _ctx.Length("GetInventorySchema.Schemas.Length"); i++)
            {
                GetInventorySchemaResponse.GetInventorySchema_Schema schema = new GetInventorySchemaResponse.GetInventorySchema_Schema();
                schema.TypeName = _ctx.StringValue("GetInventorySchema.Schemas[" + i + "].TypeName");
                schema.Version  = _ctx.StringValue("GetInventorySchema.Schemas[" + i + "].Version");

                List <GetInventorySchemaResponse.GetInventorySchema_Schema.GetInventorySchema_Attribute> schema_attributes = new List <GetInventorySchemaResponse.GetInventorySchema_Schema.GetInventorySchema_Attribute>();
                for (int j = 0; j < _ctx.Length("GetInventorySchema.Schemas[" + i + "].Attributes.Length"); j++)
                {
                    GetInventorySchemaResponse.GetInventorySchema_Schema.GetInventorySchema_Attribute attribute = new GetInventorySchemaResponse.GetInventorySchema_Schema.GetInventorySchema_Attribute();
                    attribute.Name     = _ctx.StringValue("GetInventorySchema.Schemas[" + i + "].Attributes[" + j + "].Name");
                    attribute.DataType = _ctx.StringValue("GetInventorySchema.Schemas[" + i + "].Attributes[" + j + "].DataType");

                    schema_attributes.Add(attribute);
                }
                schema.Attributes = schema_attributes;

                getInventorySchemaResponse_schemas.Add(schema);
            }
            getInventorySchemaResponse.Schemas = getInventorySchemaResponse_schemas;

            return(getInventorySchemaResponse);
        }
예제 #2
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)
        {
            GetInventorySchemaResponse response = new GetInventorySchemaResponse();

            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("Schemas", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <InventoryItemSchema, InventoryItemSchemaUnmarshaller>(InventoryItemSchemaUnmarshaller.Instance);
                    response.Schemas = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

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

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

            GetInventorySchemaResponse resp = new GetInventorySchemaResponse();

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

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

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