All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyuncs.ecs.transform.v20140526.DescribeDemandsResponseUnmarshaller Maven / Gradle / Ivy

Go to download

Aliyun Open API SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com

The newest version!
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.ecs.transform.v20140526;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.ecs.model.v20140526.DescribeDemandsResponse;
import com.aliyuncs.ecs.model.v20140526.DescribeDemandsResponse.Demand;
import com.aliyuncs.ecs.model.v20140526.DescribeDemandsResponse.Demand.SupplyInfo;
import com.aliyuncs.transform.UnmarshallerContext;


public class DescribeDemandsResponseUnmarshaller {

	public static DescribeDemandsResponse unmarshall(DescribeDemandsResponse describeDemandsResponse, UnmarshallerContext _ctx) {
		
		describeDemandsResponse.setRequestId(_ctx.stringValue("DescribeDemandsResponse.RequestId"));
		describeDemandsResponse.setPageSize(_ctx.integerValue("DescribeDemandsResponse.PageSize"));
		describeDemandsResponse.setPageNumber(_ctx.integerValue("DescribeDemandsResponse.PageNumber"));
		describeDemandsResponse.setTotalCount(_ctx.integerValue("DescribeDemandsResponse.TotalCount"));
		describeDemandsResponse.setRegionId(_ctx.stringValue("DescribeDemandsResponse.RegionId"));

		List demands = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeDemandsResponse.Demands.Length"); i++) {
			Demand demand = new Demand();
			demand.setComment(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].Comment"));
			demand.setDemandDescription(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].DemandDescription"));
			demand.setDemandId(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].DemandId"));
			demand.setDemandTime(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].DemandTime"));
			demand.setInstanceType(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].InstanceType"));
			demand.setDemandName(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].DemandName"));
			demand.setPeriod(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].Period"));
			demand.setInstanceChargeType(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].InstanceChargeType"));
			demand.setAvailableAmount(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].AvailableAmount"));
			demand.setEndTime(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].EndTime"));
			demand.setStartTime(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].StartTime"));
			demand.setPeriodUnit(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].PeriodUnit"));
			demand.setZoneId(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].ZoneId"));
			demand.setUsedAmount(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].UsedAmount"));
			demand.setTotalAmount(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].TotalAmount"));
			demand.setDeliveringAmount(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].DeliveringAmount"));
			demand.setInstanceTypeFamily(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].InstanceTypeFamily"));
			demand.setDemandStatus(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].DemandStatus"));

			List supplyInfos = new ArrayList();
			for (int j = 0; j < _ctx.lengthValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos.Length"); j++) {
				SupplyInfo supplyInfo = new SupplyInfo();
				supplyInfo.setAmount(_ctx.integerValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos["+ j +"].Amount"));
				supplyInfo.setSupplyStatus(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos["+ j +"].SupplyStatus"));
				supplyInfo.setSupplyStartTime(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos["+ j +"].SupplyStartTime"));
				supplyInfo.setSupplyEndTime(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos["+ j +"].SupplyEndTime"));
				supplyInfo.setPrivatePoolId(_ctx.stringValue("DescribeDemandsResponse.Demands["+ i +"].SupplyInfos["+ j +"].PrivatePoolId"));

				supplyInfos.add(supplyInfo);
			}
			demand.setSupplyInfos(supplyInfos);

			demands.add(demand);
		}
		describeDemandsResponse.setDemands(demands);
	 
	 	return describeDemandsResponse;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy