regionId($regionId) ->name($this->clientName); } /** * @throws ClientException */ public function tearDown() { AlibabaCloud::del($this->clientName); } /** * @expectedException \AlibabaCloud\Client\Exception\ServerException * @expectedExceptionMessageRegExp /NoPermission: You are not authorized to do this action. You should be authorized by RAM./ * @throws ClientException * @throws ServerException */ public function testGetSessionCredential() { $credential = AlibabaCloud::get($this->clientName) ->getSessionCredential(30, 25); self::assertInstanceOf(StsCredential::class, $credential); } /** * @expectedException \AlibabaCloud\Client\Exception\ServerException * @expectedExceptionMessageRegExp /NoPermission: You are not authorized to do this action. You should be authorized by RAM./ * @throws ClientException * @throws ServerException */ public function testEcsInJapan() { $result = (new DescribeAccessPointsRequest()) ->client($this->clientName) ->connectTimeout(20) ->timeout(25) ->request(); static::assertArrayHasKey('AccessPointSet', $result); } /** * @expectedException \AlibabaCloud\Client\Exception\ServerException * @expectedExceptionMessageRegExp /NoPermission: You are not authorized to do this action. You should be authorized by RAM./ * @throws ClientException * @throws ServerException */ public function testEcsNotInJapan() { // Setup $regionId = \AlibabaCloud\Client\env('REGION_ID', 'cn-hangzhou'); // Test (new DescribeAccessPointsRequest()) ->client($this->clientName) ->regionId($regionId) ->connectTimeout(25) ->timeout(30) ->request(); } }