Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
688bb3e
fix index links
k0ka Jan 17, 2024
ebf3ad6
check adding index to toc
k0ka Jan 17, 2024
179be75
check adding index to toc
k0ka Jan 17, 2024
ef5df8a
playing with toc
k0ka Jan 17, 2024
807a13b
add OpenStack creation
k0ka Jan 17, 2024
23d1685
add OpenStack creation
k0ka Jan 17, 2024
692b514
fix OpenStack creation
k0ka Jan 17, 2024
ef887d4
fix OpenStack creation
k0ka Jan 17, 2024
09c629f
fix OpenStack creation
k0ka Jan 17, 2024
7cc793c
doc fixes
k0ka Jan 17, 2024
70f27c3
add collapsible auth code
k0ka Jan 17, 2024
dc8d9d6
add collapsible auth code
k0ka Jan 17, 2024
34b838e
add collapsible auth code
k0ka Jan 17, 2024
074efe4
add collapsible auth code
k0ka Jan 17, 2024
6e851df
fix styling
k0ka Jan 17, 2024
4773de8
Merge branch 'master' into rewrite-docs
k0ka Jan 17, 2024
b545ad3
typo
k0ka Jan 17, 2024
d23c1e4
add collapsible auth code
k0ka Jan 18, 2024
67a36de
add collapsible auth code
k0ka Jan 18, 2024
3971434
fix docs
k0ka Jan 18, 2024
200360e
fix docs
k0ka Jan 18, 2024
a8da1e0
fix docs
k0ka Jan 18, 2024
8b2f4e6
remove code example
k0ka Jan 18, 2024
e2da944
testing docs
k0ka Jan 18, 2024
51e45c7
testing docs
k0ka Jan 18, 2024
0f00809
testing docs
k0ka Jan 18, 2024
4287776
testing docs
k0ka Jan 18, 2024
8e9c1b5
testing docs
k0ka Jan 18, 2024
b12a1a0
show authentication samples
k0ka Jan 18, 2024
9cabf4c
fix link
k0ka Jan 18, 2024
92d48d2
credentials doc
k0ka Jan 18, 2024
ee326c7
- add osdoc
k0ka Jan 18, 2024
a313d7c
fix osdoc
k0ka Jan 18, 2024
9cc4929
check include
k0ka Jan 18, 2024
404f581
added service.rst
k0ka Jan 18, 2024
933bf4b
fix documentation for identity v2 and v3
k0ka Jan 19, 2024
a3d2792
clarify auth docs
k0ka Jan 19, 2024
3572575
fix samples
k0ka Jan 19, 2024
090571a
- Block Storage
k0ka Jan 19, 2024
d349536
fix sample name
k0ka Jan 19, 2024
fdfd5b6
fix compute v2
k0ka Jan 19, 2024
a14ea62
Apply php-cs-fixer changes
k0ka Jan 19, 2024
d22523e
images service doc
k0ka Jan 19, 2024
fa2bcd9
unify create-service docs
k0ka Jan 20, 2024
7af31ed
upgrade object store docs
k0ka Jan 21, 2024
52df2be
Merge branch 'master' into rewrite-docs
k0ka Jan 27, 2024
8eba760
new docs for networking
k0ka Jan 30, 2024
e4fe49c
final fixes
k0ka Jan 30, 2024
6b4feae
run tests
k0ka Jan 30, 2024
c8b197e
fix test
k0ka Jan 30, 2024
2a0446c
fix test
k0ka Jan 30, 2024
82d75b5
fix tests
k0ka Jan 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
upgrade object store docs
  • Loading branch information
k0ka committed Jan 21, 2024
commit 7af31ed010f355577b6037c74a5490f29d496926
13 changes: 2 additions & 11 deletions doc/services/compute/v2/create.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
Create Service
==============
.. |method| replace:: objectStoreV1

In order to work with the service you have to :doc:`setup the client </setup>` first.

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

.. sample:: BlockStorage/v3/create.php

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

.. sample:: BlockStorage/v3/create_with_region.php
.. include:: /common/create-service.rst
19 changes: 13 additions & 6 deletions doc/services/object-store/v1/account.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
Account
=======

Show account details
--------------------
Account represents the top-level of the hierarchy. Your service provider creates your account and you own all resources
in that account. The account defines a namespace for containers. In the OpenStack environment, account is synonymous
with a project or tenant.

.. osdoc:: https://docs.openstack.org/api-ref/object-store/#accounts

.. |models| replace:: accounts

.. include:: /common/service.rst

Read
----

To work with an Object Store account, you must first retrieve an account object like so:

.. sample:: ObjectStore/v1/account/get.php
.. refdoc:: OpenStack/ObjectStore/v1/Service.html#method_getAccount
.. sample:: ObjectStore/v1/account/read.php

Get account metadata
--------------------

.. sample:: ObjectStore/v1/account/get_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Account.html#method_getMetadata

Replace all metadata with new values
------------------------------------
Expand Down Expand Up @@ -76,4 +84,3 @@ the metadata of the account will now be:
To reset metadata, you must run:

.. sample:: ObjectStore/v1/account/merge_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Account.html#method_mergeMetadata
47 changes: 21 additions & 26 deletions doc/services/object-store/v1/containers.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
Containers
==========

Show details for a container
----------------------------
Container defines a namespace for objects. An object with the same name in two different containers represents
two different objects.

.. sample:: ObjectStore/v1/containers/get.php
.. refdoc:: OpenStack/ObjectStore/v1/Service.html#method_getContainer
.. osdoc:: https://docs.openstack.org/api-ref/object-store/#containers

At this point, the object returned is *empty* because we did not execute a HTTP request to receive the state of the
container from the API. This is in accordance with one of the SDK's general policies of not assuming too much at the
expense of performance.
.. |models| replace:: containers

To synchronize the local object's state with the remote API, you can run:
.. include:: /common/service.rst

.. code-block:: php
Read
----

.. sample:: ObjectStore/v1/containers/read.php

$container->retrieve();
You can read the content of a container:

.. code-block:: php

printf("%s container has %d objects and %d bytes",
$container->name, $container->objectCount, $container->bytesUsed);

and all of the local properties will match those of the remote resource.
Delete
------

List containers
---------------
.. sample:: ObjectStore/v1/containers/delete.php

The API will only accept DELETE requests on containers when they are empty. If you have a container with any objects
inside, the operation will fail.

List
----

.. sample:: ObjectStore/v1/containers/list.php
.. refdoc:: OpenStack/ObjectStore/v1/Service.html#method_listContainers

When listing containers, you must be aware that not *all* information about a container is returned in a collection.
Very often only the object count, bytes used and container name will be exposed. If you would like to
Expand All @@ -43,20 +50,10 @@ container.

.. include:: /common/generators.rst

Delete container
----------------

.. sample:: ObjectStore/v1/containers/delete.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_delete

The API will only accept DELETE requests on containers when they are empty. If you have a container with any objects
inside, the operation will fail.

Get metadata
------------

.. sample:: ObjectStore/v1/containers/get_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_getMetadata

The returned value will be a standard associative array, or hash, containing arbitrary key/value pairs. These will
correspond to the values set either when the container was created, or when a previous ``mergeMetadata`` or
Expand All @@ -66,7 +63,6 @@ Replace all metadata with new values
------------------------------------

.. sample:: ObjectStore/v1/containers/reset_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_resetMetadata

In order to replace all existing metadata with a set of new values, you can use this operation. Any existing metadata
items which not specified in the new set will be removed. For example, say an account has the following metadata
Expand Down Expand Up @@ -96,7 +92,6 @@ Merge new metadata values with existing
---------------------------------------

.. sample:: ObjectStore/v1/containers/merge_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_mergeMetadata

In order to merge a set of new metadata values with the existing metadata set, you can use this operation. Any existing
metadata items which are not specified in the new set will be preserved. For example, say an account has the following
Expand Down
3 changes: 3 additions & 0 deletions doc/services/object-store/v1/create.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. |method| replace::

.. include:: /common/create-service.rst
9 changes: 5 additions & 4 deletions doc/services/object-store/v1/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Object Store v1
===============

.. toctree::
:maxdepth: 3
:maxdepth: 3

account
containers
objects
create
account
containers
objects
107 changes: 49 additions & 58 deletions doc/services/object-store/v1/objects.rst
Original file line number Diff line number Diff line change
@@ -1,48 +1,61 @@
Objects
=======

Show details for an object
--------------------------
Object stores data content, such as documents, images, and so on. You can also store custom metadata with an object.

.. sample:: ObjectStore/v1/objects/get.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_getObject
.. osdoc:: https://docs.openstack.org/api-ref/object-store/#objects

At this point, the object returned is *empty* because we did not execute a HTTP request to receive the state of the
container from the API. This is in accordance with one of the SDK's general policies of not assuming too much at the
expense of performance.
.. |models| replace:: objects

To synchronize the local object's state with the remote API, you can run:
.. include:: /common/service.rst

.. code-block:: php
Create
------

$object->retrieve();
When creating an object, you can upload its content according to a string representation:

printf("%s/%s is %d bytes long and was last modified on %s",
$object->containerName, $object->name, $object->contentLength, $object->lastModified);
.. sample:: ObjectStore/v1/objects/create.php

and all of the local properties will match those of the remote resource. The ``retrieve`` call, although fetching all
of the object's metadata, will not download the object's content. To do this, see the next section.
If that is not optimal or convenient, you can use a stream instead. Any instance of ``\Psr\Http\Message\StreamInterface``
is acceptable. For example, to use a normal Guzzle stream:

Download an object
------------------
.. sample:: ObjectStore/v1/objects/create_from_stream.php

.. sample:: ObjectStore/v1/objects/download.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_download
Create a large object (over 5GB)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As you will notice, a Stream_ object is returned by this call. For more information about dealing with streams, please
consult `Guzzle's docs`_.
For large objects (those over 5GB), you will need to use a concept in Swift called Dynamic Large Objects (DLO). When
uploading, this is what happens under the hood:

By default, the whole body of the object is fetched before the function returns, set the ``'requestOptions'`` key of
parameter ``$data`` to ``['stream' => true]`` to get the stream before the end of download.
1. The large file is separated into smaller segments
2. Each segment is uploaded
3. A manifest file is created which, when requested by clients, will concatenate all the segments as a single file

.. _Stream: https://github.com/guzzle/streams/blob/master/src/Stream.php
.. _Guzzle's docs: https://guzzle.readthedocs.org/en/5.3/streams.html
To upload a DLO, you need to call:

List objects
------------
.. sample:: ObjectStore/v1/objects/create_large_object.php

Read
----

.. sample:: ObjectStore/v1/objects/read.php

You can read properties of an object:

.. code-block:: php

printf("%s/%s is %d bytes long and was last modified on %s",
$object->containerName, $object->name, $object->contentLength, $object->lastModified);

Delete
------

.. sample:: ObjectStore/v1/objects/delete.php

List
----

.. sample:: ObjectStore/v1/objects/list.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_listObjects

When listing objects, you must be aware that not *all* information about a container is returned in a collection.
Very often only the MD5 hash, last modified date, bytes used, content type and object name will be
Expand All @@ -59,51 +72,29 @@ If you have a large collection of $object, this will slow things down because yo

.. include:: /common/generators.rst

Create an object
----------------

When creating an object, you can upload its content according to a string representation:

.. sample:: ObjectStore/v1/objects/create.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_createObject

If that is not optimal or convenient, you can use a stream instead. Any instance of ``\Psr\Http\Message\StreamInterface``
is acceptable. For example, to use a normal Guzzle stream:

.. sample:: ObjectStore/v1/objects/create_from_stream.php

Create a large object (over 5GB)
--------------------------------
Download an object
------------------

For large objects (those over 5GB), you will need to use a concept in Swift called Dynamic Large Objects (DLO). When
uploading, this is what happens under the hood:
.. sample:: ObjectStore/v1/objects/download.php

1. The large file is separated into smaller segments
2. Each segment is uploaded
3. A manifest file is created which, when requested by clients, will concatenate all the segments as a single file
As you will notice, a Stream_ object is returned by this call. For more information about dealing with streams, please
consult `Guzzle's docs`_.

To upload a DLO, you need to call:
By default, the whole body of the object is fetched before the function returns, set the ``'requestOptions'`` key of
parameter ``$data`` to ``['stream' => true]`` to get the stream before the end of download.

.. sample:: ObjectStore/v1/objects/create_large_object.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/Container.html#method_createLargeObject
.. _Stream: https://github.com/guzzle/streams/blob/master/src/Stream.php
.. _Guzzle's docs: https://guzzle.readthedocs.org/en/5.3/streams.html

Copy object
-----------

.. sample:: ObjectStore/v1/objects/copy.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_copy

Delete object
-------------

.. sample:: ObjectStore/v1/objects/delete.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_delete

Get metadata
------------

.. sample:: ObjectStore/v1/objects/get_metadata.php
.. refdoc:: OpenStack/ObjectStore/v1/Models/StorageObject.html#method_getMetadata

The returned value will be a standard associative array, or hash, containing arbitrary key/value pairs. These will
correspond to the values set either when the object was created, or when a previous ``mergeMetadata`` or
Expand Down
1 change: 0 additions & 1 deletion samples/ObjectStore/v1/account/get_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->objectStoreV1();
Expand Down
1 change: 0 additions & 1 deletion samples/ObjectStore/v1/account/merge_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->objectStoreV1();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$account = $openstack->objectStoreV1()
->getAccount();
$service = $openstack->objectStoreV1();
$account = $service->getAccount();
2 changes: 0 additions & 2 deletions samples/ObjectStore/v1/account/reset_metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->objectStoreV1();

$account = $service->getAccount();

$account->resetMetadata([
Expand Down
5 changes: 2 additions & 3 deletions samples/ObjectStore/v1/containers/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
'password' => '{password}',
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->objectStoreV1();

$container = $service->createContainer([
'name' => '{containerName}'
'name' => '{containerName}',
]);
10 changes: 5 additions & 5 deletions samples/ObjectStore/v1/containers/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
'password' => '{password}',
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$openstack->objectStoreV1()
->getContainer('{containerName}')
->delete();
$service = $openstack->objectStoreV1();
$container = $service->getContainer('{containerName}');

$container->delete();
Loading