Scalr\Modules\Platforms\Azure\AzurePlatformModule::GetServersList PHP Метод

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

public GetServersList ( Scalr_Environment $environment, $resourceGroup, $skipCache = false )
$environment Scalr_Environment
    public function GetServersList(\Scalr_Environment $environment, $resourceGroup, $skipCache = false)
    {
        $cacheKey = sprintf('%s:%s', $environment->id, $resourceGroup);
        if (!$this->instancesListCache[$cacheKey] || $skipCache) {
            $this->instancesListCache[$cacheKey] = array();
            $azure = $environment->azure();
            $subscriptionId = $environment->keychain(SERVER_PLATFORMS::AZURE)->properties[CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID];
            $vmList = $azure->compute->virtualMachine->getList($subscriptionId, $resourceGroup);
            foreach ($vmList as $vm) {
                $info = $azure->compute->virtualMachine->getModelViewInfo($subscriptionId, $resourceGroup, $vm->name, true);
                $statuses = [];
                foreach ($info->properties->instanceView->statuses as $status) {
                    $statusInfo = explode("/", $status->code);
                    $statuses[$statusInfo[0]] = $statusInfo[1];
                }
                $this->instancesListCache[$cacheKey][$vm->name] = $statuses;
            }
        }
        return $this->instancesListCache[$cacheKey];
    }