Scalr\Service\Azure::getEnvironment PHP Метод

getEnvironment() публичный Метод

Gets an Scalr Environment object which is associated with the Azure client instance
public getEnvironment ( ) : Scalr_Environment
Результат Scalr_Environment Returns Scalr Environment object
    public function getEnvironment()
    {
        return $this->environment;
    }

Usage Example

Пример #1
0
 /**
  * Set test names for objects
  */
 protected function setUp()
 {
     parent::setUp();
     if ($this->isSkipFunctionalTests()) {
         $this->markTestSkipped();
     }
     $testEnvId = \Scalr::config('scalr.phpunit.envid');
     try {
         $this->testEnv = \Scalr_Environment::init()->loadById($testEnvId);
     } catch (Exception $e) {
         $this->markTestSkipped('Test Environment does not exist.');
     }
     if (!$this->testEnv || !$this->testEnv->isPlatformEnabled(\SERVER_PLATFORMS::AZURE)) {
         $this->markTestSkipped('Azure platform is not enabled.');
     }
     $this->azure = $this->testEnv->azure();
     $this->subscriptionId = $this->azure->getEnvironment()->cloudCredentials(SERVER_PLATFORMS::AZURE)->properties[Entity\CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID];
     $this->resourceGroupName = 'test3-resource-group-' . $this->getInstallationId();
     $this->availabilitySetName = 'test3-availability-set-' . $this->getInstallationId();
     $this->vmName = 'test3-virtual-machine-' . $this->getInstallationId();
     $this->vnName = 'test3-virtual-network-' . $this->getInstallationId();
     $this->nicName = 'test3-network-interface' . $this->getInstallationId();
     $this->publicIpName = 'myPublicIP3';
     $this->storageName = 'teststorage3' . $this->getInstallationId();
     $this->sgName = 'test3-security-group' . $this->getInstallationId();
 }