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

com.aliyuncs.webplus.transform.v20190320.DescribeEnvResourceResponseUnmarshaller Maven / Gradle / Ivy

/*
 * 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.webplus.transform.v20190320;

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

import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.Instance;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.LoadBalancer;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.MonitorGroup;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.RdsInstance;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.ScalingGroup;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.SecurityGroup;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.VSwitch;
import com.aliyuncs.webplus.model.v20190320.DescribeEnvResourceResponse.EnvResource.Vpc;
import com.aliyuncs.transform.UnmarshallerContext;


public class DescribeEnvResourceResponseUnmarshaller {

	public static DescribeEnvResourceResponse unmarshall(DescribeEnvResourceResponse describeEnvResourceResponse, UnmarshallerContext _ctx) {
		
		describeEnvResourceResponse.setRequestId(_ctx.stringValue("DescribeEnvResourceResponse.RequestId"));
		describeEnvResourceResponse.setCode(_ctx.stringValue("DescribeEnvResourceResponse.Code"));
		describeEnvResourceResponse.setMessage(_ctx.stringValue("DescribeEnvResourceResponse.Message"));

		EnvResource envResource = new EnvResource();
		envResource.setEnvId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.EnvId"));
		envResource.setEnvName(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.EnvName"));
		envResource.setLaunchConfigurationId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.LaunchConfigurationId"));
		envResource.setLaunchTemplateId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.LaunchTemplateId"));

		MonitorGroup monitorGroup = new MonitorGroup();
		monitorGroup.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.MonitorGroup.Id"));
		envResource.setMonitorGroup(monitorGroup);

		ScalingGroup scalingGroup = new ScalingGroup();
		scalingGroup.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.ScalingGroup.Id"));
		envResource.setScalingGroup(scalingGroup);

		Vpc vpc = new Vpc();
		vpc.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.Vpc.Id"));
		envResource.setVpc(vpc);

		List instances = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeEnvResourceResponse.EnvResource.Instances.Length"); i++) {
			Instance instance = new Instance();
			instance.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.Instances["+ i +"].Id"));
			instance.setImported(_ctx.booleanValue("DescribeEnvResourceResponse.EnvResource.Instances["+ i +"].Imported"));

			instances.add(instance);
		}
		envResource.setInstances(instances);

		List vSwitches = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeEnvResourceResponse.EnvResource.VSwitches.Length"); i++) {
			VSwitch vSwitch = new VSwitch();
			vSwitch.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.VSwitches["+ i +"].Id"));

			vSwitches.add(vSwitch);
		}
		envResource.setVSwitches(vSwitches);

		List loadBalancers = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers.Length"); i++) {
			LoadBalancer loadBalancer = new LoadBalancer();
			loadBalancer.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers["+ i +"].Id"));
			loadBalancer.setAddressType(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers["+ i +"].AddressType"));
			loadBalancer.setPort(_ctx.integerValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers["+ i +"].Port"));
			loadBalancer.setProtocol(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers["+ i +"].Protocol"));
			loadBalancer.setImported(_ctx.booleanValue("DescribeEnvResourceResponse.EnvResource.LoadBalancers["+ i +"].Imported"));

			loadBalancers.add(loadBalancer);
		}
		envResource.setLoadBalancers(loadBalancers);

		List defaultSecurityGroups = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeEnvResourceResponse.EnvResource.DefaultSecurityGroups.Length"); i++) {
			SecurityGroup securityGroup = new SecurityGroup();
			securityGroup.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.DefaultSecurityGroups["+ i +"].Id"));

			defaultSecurityGroups.add(securityGroup);
		}
		envResource.setDefaultSecurityGroups(defaultSecurityGroups);

		List rdsInstances = new ArrayList();
		for (int i = 0; i < _ctx.lengthValue("DescribeEnvResourceResponse.EnvResource.RdsInstances.Length"); i++) {
			RdsInstance rdsInstance = new RdsInstance();
			rdsInstance.setId(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.RdsInstances["+ i +"].Id"));
			rdsInstance.setImported(_ctx.booleanValue("DescribeEnvResourceResponse.EnvResource.RdsInstances["+ i +"].Imported"));
			rdsInstance.setDatabaseName(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.RdsInstances["+ i +"].DatabaseName"));
			rdsInstance.setAccountName(_ctx.stringValue("DescribeEnvResourceResponse.EnvResource.RdsInstances["+ i +"].AccountName"));

			rdsInstances.add(rdsInstance);
		}
		envResource.setRdsInstances(rdsInstances);
		describeEnvResourceResponse.setEnvResource(envResource);
	 
	 	return describeEnvResourceResponse;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy