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

com.aliyuncs.clouddesktop.transform.v20170301.DescribeDesktopsResponseUnmarshaller 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.clouddesktop.transform.v20170301;

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

import com.aliyuncs.clouddesktop.model.v20170301.DescribeDesktopsResponse;
import com.aliyuncs.clouddesktop.model.v20170301.DescribeDesktopsResponse.DesktopAttributes;
import com.aliyuncs.clouddesktop.model.v20170301.DescribeDesktopsResponse.DesktopAttributes.DiskInfo;
import com.aliyuncs.transform.UnmarshallerContext;


public class DescribeDesktopsResponseUnmarshaller {

	public static DescribeDesktopsResponse unmarshall(DescribeDesktopsResponse describeDesktopsResponse, UnmarshallerContext context) {
		
		describeDesktopsResponse.setRequestId(context.stringValue("DescribeDesktopsResponse.RequestId"));
		describeDesktopsResponse.setSuccess(context.booleanValue("DescribeDesktopsResponse.Success"));
		describeDesktopsResponse.setMessage(context.stringValue("DescribeDesktopsResponse.Message"));
		describeDesktopsResponse.setErrorCode(context.stringValue("DescribeDesktopsResponse.ErrorCode"));
		describeDesktopsResponse.setTotal(context.integerValue("DescribeDesktopsResponse.Total"));
		describeDesktopsResponse.setPageSize(context.integerValue("DescribeDesktopsResponse.PageSize"));
		describeDesktopsResponse.setPageCount(context.integerValue("DescribeDesktopsResponse.PageCount"));
		describeDesktopsResponse.setPage(context.integerValue("DescribeDesktopsResponse.Page"));

		List desktops = new ArrayList();
		for (int i = 0; i < context.lengthValue("DescribeDesktopsResponse.Desktops.Length"); i++) {
			DesktopAttributes desktopAttributes = new DesktopAttributes();
			desktopAttributes.setDesktopId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DesktopId"));
			desktopAttributes.setDesktopName(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DesktopName"));
			desktopAttributes.setUserName(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].userName"));
			desktopAttributes.setRegionId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].RegionId"));
			desktopAttributes.setZoneId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ZoneId"));
			desktopAttributes.setStatus(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].Status"));
			desktopAttributes.setImageId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ImageId"));
			desktopAttributes.setImageName(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ImageName"));
			desktopAttributes.setImagePlatform(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ImagePlatform"));
			desktopAttributes.setImageArch(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ImageArch"));
			desktopAttributes.setImageSize(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ImageSize"));
			desktopAttributes.setDesktopType(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DesktopType"));
			desktopAttributes.setCpu(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].Cpu"));
			desktopAttributes.setMemory(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].Memory"));
			desktopAttributes.setEipAddress(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].EipAddress"));
			desktopAttributes.setEipInstanceId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].EipInstanceId"));
			desktopAttributes.setInternetChargeType(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].InternetChargeType"));
			desktopAttributes.setInternetBandwidth(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].InternetBandwidth"));
			desktopAttributes.setVpcId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].VpcId"));
			desktopAttributes.setSwitchId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].SwitchId"));
			desktopAttributes.setDesktopIpAddress(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DesktopIpAddress"));
			desktopAttributes.setDesktopChargeType(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DesktopChargeType"));
			desktopAttributes.setCreateDate(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].CreateDate"));
			desktopAttributes.setExpiredDate(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ExpiredDate"));
			desktopAttributes.setEnable(context.booleanValue("DescribeDesktopsResponse.Desktops["+ i +"].Enable"));
			desktopAttributes.setErrorCode(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ErrorCode"));
			desktopAttributes.setErrorMessage(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].ErrorMessage"));
			desktopAttributes.setPolicy(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].Policy"));
			desktopAttributes.setUserGroup(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].UserGroup"));

			List securityGroups = new ArrayList();
			for (int j = 0; j < context.lengthValue("DescribeDesktopsResponse.Desktops["+ i +"].SecurityGroups.Length"); j++) {
				securityGroups.add(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].SecurityGroups["+ j +"]"));
			}
			desktopAttributes.setSecurityGroups(securityGroups);

			List diskInfos = new ArrayList();
			for (int j = 0; j < context.lengthValue("DescribeDesktopsResponse.Desktops["+ i +"].DiskInfos.Length"); j++) {
				DiskInfo diskInfo = new DiskInfo();
				diskInfo.setId(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DiskInfos["+ j +"].Id"));
				diskInfo.setCategory(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DiskInfos["+ j +"].Category"));
				diskInfo.setType(context.stringValue("DescribeDesktopsResponse.Desktops["+ i +"].DiskInfos["+ j +"].Type"));
				diskInfo.setSize(context.integerValue("DescribeDesktopsResponse.Desktops["+ i +"].DiskInfos["+ j +"].Size"));

				diskInfos.add(diskInfo);
			}
			desktopAttributes.setDiskInfos(diskInfos);

			desktops.add(desktopAttributes);
		}
		describeDesktopsResponse.setDesktops(desktops);
	 
	 	return describeDesktopsResponse;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy