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

com.aliyuncs.ens.transform.v20171110.DescribeReservedResourceResponseUnmarshaller 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.ens.transform.v20171110;

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

import com.aliyuncs.ens.model.v20171110.DescribeReservedResourceResponse;
import com.aliyuncs.ens.model.v20171110.DescribeReservedResourceResponse.Image;
import com.aliyuncs.ens.model.v20171110.DescribeReservedResourceResponse.SupportResource;
import com.aliyuncs.transform.UnmarshallerContext;


public class DescribeReservedResourceResponseUnmarshaller {

	public static DescribeReservedResourceResponse unmarshall(DescribeReservedResourceResponse describeReservedResourceResponse, UnmarshallerContext _ctx) {
		
		describeReservedResourceResponse.setRequestId(_ctx.stringValue("DescribeReservedResourceResponse.RequestId"));
		describeReservedResourceResponse.setCode(_ctx.integerValue("DescribeReservedResourceResponse.Code"));

		List images = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeReservedResourceResponse.Images.Length"); i++) {
			Image image = new Image();
			image.setImageName(_ctx.stringValue("DescribeReservedResourceResponse.Images["+ i +"].ImageName"));
			image.setImageId(_ctx.stringValue("DescribeReservedResourceResponse.Images["+ i +"].ImageId"));

			images.add(image);
		}
		describeReservedResourceResponse.setImages(images);

		List supportResources = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeReservedResourceResponse.SupportResources.Length"); i++) {
			SupportResource supportResource = new SupportResource();
			supportResource.setEnsRegionId(_ctx.stringValue("DescribeReservedResourceResponse.SupportResources["+ i +"].EnsRegionId"));
			supportResource.setSupportResourcesCount(_ctx.stringValue("DescribeReservedResourceResponse.SupportResources["+ i +"].SupportResourcesCount"));
			supportResource.setInstanceSpec(_ctx.stringValue("DescribeReservedResourceResponse.SupportResources["+ i +"].InstanceSpec"));

			List dataDiskSizes = new ArrayList();
			for (int j = 0; j < _ctx.lengthValue("DescribeReservedResourceResponse.SupportResources["+ i +"].DataDiskSizes.Length"); j++) {
				dataDiskSizes.add(_ctx.stringValue("DescribeReservedResourceResponse.SupportResources["+ i +"].DataDiskSizes["+ j +"]"));
			}
			supportResource.setDataDiskSizes(dataDiskSizes);

			List systemDiskSizes = new ArrayList();
			for (int j = 0; j < _ctx.lengthValue("DescribeReservedResourceResponse.SupportResources["+ i +"].SystemDiskSizes.Length"); j++) {
				systemDiskSizes.add(_ctx.stringValue("DescribeReservedResourceResponse.SupportResources["+ i +"].SystemDiskSizes["+ j +"]"));
			}
			supportResource.setSystemDiskSizes(systemDiskSizes);

			supportResources.add(supportResource);
		}
		describeReservedResourceResponse.setSupportResources(supportResources);
	 
	 	return describeReservedResourceResponse;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy