public function testDescribeInstances() { $response = Kec::getInstance()->request('DescribeInstances', [], 'cn-beijing-6'); return $this->assertEquals($response->getStatusCode(), 200); }
var_dump("securityGroupId is " . $securityGroupId); //查询镜像 $response = Kec::getInstance()->request('DescribeImages'); $imageInfo = getResponse($response); $imageId = $imageInfo['ImagesSet'][0]['ImageId']; var_dump("imageId is " . $imageId); //创建kec $param = array('ImageId' => $imageId, 'MaxCount' => 1, 'MinCount' => 1, 'SubnetId' => $subnetId, 'InstancePassword' => 'zhangli@King9', 'ChargeType' => 'Daily', 'PurchaseTime' => 0, 'SecurityGroupId' => $securityGroupId); $response = Kec::getInstance()->request('RunInstances', array('query' => $param)); $kecInfo = getResponse($response); $kecInstanceId = $kecInfo['InstancesSet'][0]['InstanceId']; var_dump("kecInstanceId is " . $kecInstanceId); //查询kec实例信息 $param = array('Filter.1.Name' => 'instance-id', 'Filter.1.Value.1' => $kecInstanceId); while (true) { $response = Kec::getInstance()->request('DescribeInstances', array('query' => $param)); $kecInstanceInfo = getResponse($response); $networkInterfaceId = $kecInstanceInfo['InstancesSet'][0]['NetworkInterfaceSet'][0]['NetworkInterfaceId']; if (is_null($networkInterfaceId)) { echo "sleeping...\n"; sleep(5); continue; } else { var_dump("networkInterfaceId is " . $networkInterfaceId); break; } } //获取用户可选链路信息 $response = Eip::getInstance()->request('GetLines'); $lineInfo = getResponse($response); $lineId = $lineInfo['LineSet'][0]['LineId'];