Skip to content

Commit

Permalink
testing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka committed Jan 18, 2024
1 parent 0f00809 commit 4287776
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 69 deletions.
2 changes: 1 addition & 1 deletion doc/services/identity/v3/application-credentials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ they have on that project, and then stores the application credential identifier

More information can be found in the `official documentation <https://docs.openstack.org/keystone/latest/user/application_credentials.html>`_.

In order to work with application credentials you have to :doc:`create the service </services/v3/identity/create>`_ first.
In order to work with application credentials you have to :doc:`create the service </services/v3/identity/create>` first.

Create
------
Expand Down
6 changes: 3 additions & 3 deletions doc/services/identity/v3/create.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Create Service
==============

Service can be created via ``identityV3()`` method of the ``OpenStack`` object:
In order to work with the service you have to :doc:`setup the client </setup>` first.

Service can be created via ``identityV3()`` method of the ``OpenStack`` object.

.. sample:: Identity/v3/create.php

A list of additional options can be passed to the method. For example, to change the region:

.. sample:: Identity/v3/create_with_region.php

See :doc:`/setup`_ for list of available authentication options.
5 changes: 5 additions & 0 deletions doc/services/identity/v3/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ OpenStack Identity API v3. It is used to manage the `OpenStack Keystone service

More information can be found in the `official documentation <https://docs.openstack.org/api-ref/identity/v3/index.html>`_.

.. toctree::
:maxdepth: 3

create

Resources
=========

Expand Down
61 changes: 8 additions & 53 deletions doc/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,62 +32,17 @@ Authenticate application credential ID

.. sample:: Setup/application_credential_id.php

Generate token from ID
~~~~~~~~~~~~~~~~~~~~~~
Authenticate from ID
~~~~~~~~~~~~~~~~~~~~

.. sample:: Setup/from_id.php

Generate token scoped to project ID
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scope to project ID
~~~~~~~~~~~~~~~~~~~

.. sample:: Identity/v3/tokens/generate_token_scoped_to_project_id.php
.. sample:: Setup/scoped_to_project_id.php

Generate token scoped to project name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Scope to project name
~~~~~~~~~~~~~~~~~~~~~

.. sample:: Identity/v3/tokens/generate_token_scoped_to_project_name.php


Here is an example of how to create a client with a user id and password:

.. code-block:: php
$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
]);
Here is an example of how to create a client with application credentials:

.. code-block:: php
$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'application_credential' => [
'id' => '{applicationCredentialId}',
'secret' => '{secret}'
]
]);
You can specify the scope of the token:

.. code-block:: php
$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => [
'project' => [
'id' => '{projectId}'
],
],
]);
.. sample:: Setup/scoped_to_project_name.php
2 changes: 1 addition & 1 deletion samples/Identity/v3/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
],
]);

$identity = $openstack->identityV3(['region' => '{region}']);
$identity = $openstack->identityV3();
2 changes: 1 addition & 1 deletion samples/Identity/v3/create_with_region.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
],
]);

$identity = $openstack->identityV3();
$identity = $openstack->identityV3(['region' => '{region}']);
11 changes: 1 addition & 10 deletions samples/Setup/user_id.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,4 @@
'id' => '{userId}',
'password' => '{password}'
]
]);

$identity = $openstack->identityV3();

$token = $identity->generateToken([
'user' => [
'id' => '{userId}',
'password' => '{password}'
]
]);
]);

0 comments on commit 4287776

Please sign in to comment.