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

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

Get list of all user subscriptions.
public getSubscriptionsList ( ) : Scalr\Service\Azure\DataType\SubscriptionList
Результат Scalr\Service\Azure\DataType\SubscriptionList List of subscription objects
    public function getSubscriptionsList()
    {
        $result = null;
        $path = '/subscriptions';
        $step = $this->environment->keychain(\SERVER_PLATFORMS::AZURE)->properties[CloudCredentialsProperty::AZURE_AUTH_STEP];
        if ($step == 3) {
            $token = $this->getClientToken(Azure::URL_MANAGEMENT_WINDOWS);
        }
        if (empty($token) && $step != 3) {
            $token = $this->getAccessToken();
        }
        $headers = ['Authorization' => 'Bearer ' . $token->token];
        $request = $this->getClient()->prepareRequest($path, 'GET', self::SUBSCRIPTION_API_VERSION, self::URL_MANAGEMENT_WINDOWS, [], [], $headers);
        $response = $this->getClient()->call($request);
        if (!$response->hasError()) {
            $resultArray = $response->getResult();
            $result = new SubscriptionList();
            foreach ($resultArray as $array) {
                $result->append(SubscriptionData::initArray($array));
            }
        }
        return $result;
    }