<?php

require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use OpenStack\Identity\v2\Service;
use OpenStack\Common\Transport\Utils as TransportUtils;
use OpenStack\OpenStack;
$authUrl = 'https://example.com:5000/v2.0';
$httpClient = new Client(['base_uri' => TransportUtils::normalizeUrl($authUrl), 'handler' => HandlerStack::create()]);
$options = ['authUrl' => $authUrl, 'region' => 'RegionOne', 'username' => 'foo', 'password' => 'bar', 'tenantName' => 'baz', 'identityService' => Service::factory($httpClient)];
$openstack = new OpenStack($options);
Example #2
0
 public static function getAuthOptsV2()
 {
     $httpClient = new Client(['base_uri' => TransportUtils::normalizeUrl(getenv('OS_AUTH_URL')), 'handler' => HandlerStack::create()]);
     return ['authUrl' => getenv('OS_AUTH_URL'), 'region' => getenv('OS_REGION_NAME'), 'username' => getenv('OS_USERNAME'), 'password' => getenv('OS_PASSWORD'), 'tenantName' => getenv('OS_TENANT_NAME'), 'identityService' => Service::factory($httpClient)];
 }