Skip to content

Commit 867c155

Browse files
committed
Added docs and example to work with identity v2.0
1 parent 40f7ec9 commit 867c155

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Authentication
2+
==============
3+
4+
Identity v2.0
5+
-------------
6+
7+
We recommend users to use identity v3 when possible.
8+
9+
RackSpace cloud and OVH cloud, however, are still using Keystone v2.0. This following code will work for such providers.
10+
11+
12+
.. sample:: identity/v2/authentication.php

doc/services/identity/v2/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Identity v2
2+
===========
3+
4+
.. toctree::
5+
:maxdepth: 3
6+
7+
authentication
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
require 'vendor/autoload.php';
4+
5+
use GuzzleHttp\Client;
6+
use GuzzleHttp\HandlerStack;
7+
use OpenStack\Common\Transport\Utils as TransportUtils;
8+
use OpenStack\OpenStack;
9+
10+
$authUrl = 'https://keystone.example.com:5000/v2.0';
11+
12+
$options = [
13+
'authUrl' => $authUrl,
14+
'region' => 'RegionOne',
15+
'username' => 'foo',
16+
'password' => 'bar',
17+
'tenantName' => 'baz',
18+
'identityService' => new Client(
19+
[
20+
'base_uri' => TransportUtils::normalizeUrl($authUrl),
21+
'handler' => HandlerStack::create(),
22+
]
23+
),
24+
];
25+
26+
/** @var OpenStack $openstack */
27+
$openstack = new OpenStack($options);
28+
29+
/** @var \OpenStack\Compute\v2\Models\Server[] $servers */
30+
$servers = $openstack->computeV2()->listServers();
31+
32+

0 commit comments

Comments
 (0)