Search in sources :

Example 1 with DefaultAcsClient

use of com.github.isdream.chameleon.vm.aliyun.adapters.DefaultAcsClient 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)1 DescribeInstancesRequest (com.aliyuncs.ecs.model.v20140526.DescribeInstancesRequest)1 Instance (com.aliyuncs.ecs.model.v20140526.DescribeInstancesResponse.Instance)1 DescribeZonesRequest (com.aliyuncs.ecs.model.v20140526.DescribeZonesRequest)1 DescribeZonesResponse (com.aliyuncs.ecs.model.v20140526.DescribeZonesResponse)1 IClientProfile (com.aliyuncs.profile.IClientProfile)1 DefaultAcsClient (com.github.isdream.chameleon.vm.aliyun.adapters.DefaultAcsClient)1