Search in sources :

Example 1 with DescribeZonesResponse

use of com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse in project jointware by isdream.

the class AliyunECSAPIExample method main.

/**
 * @param args
 * @throws ClientException
 * @throws ServerException
 */
public static void main(String[] args) throws ServerException, ClientException {
    IClientProfile profile = DefaultProfile.getProfile(REGINE_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
    IAcsClient client = new DefaultAcsClient(profile);
    DescribeZonesRequest request = new DescribeZonesRequest();
    DescribeZonesResponse response = client.getAcsResponse(request);
    System.out.println(response.getZones().get(0).getZoneId());
    DescribeInstancesRequest dur = new DescribeInstancesRequest();
    for (Instance ins : client.getAcsResponse(dur).getInstances()) {
        System.out.println(ins.getInstanceName() + "\t:" + ins.getRegionId());
    }
}
Also used : DefaultAcsClient(com.aliyuncs.DefaultAcsClient) Instance(com.aliyuncs.ecs.model.v20140526.DescribeInstancesResponse.Instance) DescribeZonesRequest(com.aliyuncs.ecs.model.v20140526.DescribeZonesRequest) DescribeZonesResponse(com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse) IAcsClient(com.aliyuncs.IAcsClient) IClientProfile(com.aliyuncs.profile.IClientProfile) DescribeInstancesRequest(com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest)

Example 2 with DescribeZonesResponse

use of com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse in project jointware by isdream.

the class ECSMain method main.

/**
 * @param args
 * @throws ClientException
 * @throws ServerException
 */
public static void main(String[] args) throws ServerException, ClientException {
    IClientProfile profile = DefaultProfile.getProfile(REGINE_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
    IAcsClient client = new DefaultAcsClient(profile);
    DescribeZonesRequest request = new DescribeZonesRequest();
    DescribeZonesResponse response = client.getAcsResponse(request);
    System.out.println(response.getZones().get(0).getZoneId());
    DescribeInstancesRequest dur = new DescribeInstancesRequest();
    for (Instance ins : client.getAcsResponse(dur).getInstances()) {
        System.out.println(ins.getInstanceName() + "\t:" + ins.getRegionId());
    }
// dur.setZoneId(zoneId);;
}
Also used : DefaultAcsClient(com.github.isdream.chameleon.vm.aliyun.adapters.DefaultAcsClient) Instance(com.aliyuncs.ecs.model.v20140526.DescribeInstancesResponse.Instance) DescribeZonesRequest(com.aliyuncs.ecs.model.v20140526.DescribeZonesRequest) DescribeZonesResponse(com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse) IAcsClient(com.aliyuncs.IAcsClient) IClientProfile(com.aliyuncs.profile.IClientProfile) DescribeInstancesRequest(com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest)

Aggregations

IAcsClient (com.aliyuncs.IAcsClient)2 DescribeInstancesRequest (com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest)2 Instance (com.aliyuncs.ecs.model.v20140526.DescribeInstancesResponse.Instance)2 DescribeZonesRequest (com.aliyuncs.ecs.model.v20140526.DescribeZonesRequest)2 DescribeZonesResponse (com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse)2 IClientProfile (com.aliyuncs.profile.IClientProfile)2 DefaultAcsClient (com.aliyuncs.DefaultAcsClient)1 DefaultAcsClient (com.github.isdream.chameleon.vm.aliyun.adapters.DefaultAcsClient)1