From 857fcc82a0eaffff11044bca6d39c0c21eeb1c97 Mon Sep 17 00:00:00 2001 From: Konstantin Babushkin Date: Tue, 30 Jan 2024 14:00:18 +0100 Subject: [PATCH] Clarify docs (#389) * Rewrite most of documentation. * Make creating the `$openstack` object more clear. * Rename and rearrange main operations as CRUDL (Create, Read, Update, Delete, List) --- doc/_exts/osdoc.py | 31 +++++ doc/_exts/samples.py | 46 ++++---- doc/_static/css/custom.css | 4 + doc/common/create-service.rst | 18 +++ doc/common/service.rst | 1 + doc/conf.py | 20 +++- doc/index.rst | 40 ++----- doc/install.rst | 35 ++++++ doc/requirements.txt | 4 +- doc/services/block-storage/v2/index.rst | 4 +- doc/services/block-storage/v3/create.rst | 3 + doc/services/block-storage/v3/index.rst | 14 ++- doc/services/block-storage/v3/snapshots.rst | 18 ++- .../block-storage/v3/volume-types.rst | 58 ++++------ doc/services/block-storage/v3/volumes.rst | 75 ++++++------ doc/services/compute/v2/create.rst | 3 + doc/services/compute/v2/flavors.rst | 46 +++----- doc/services/compute/v2/images.rst | 18 +-- doc/services/compute/v2/index.rst | 6 + doc/services/compute/v2/servers.rst | 75 ++++-------- doc/services/compute/v2/states.rst | 2 +- doc/services/identity/v2/authentication.rst | 12 -- doc/services/identity/v2/index.rst | 8 +- .../identity/v3/application-credentials.rst | 31 +++-- doc/services/identity/v3/create.rst | 3 + doc/services/identity/v3/credentials.rst | 49 ++++---- doc/services/identity/v3/domains.rst | 51 ++++----- doc/services/identity/v3/endpoints.rst | 47 ++++---- doc/services/identity/v3/groups.rst | 44 +++---- doc/services/identity/v3/index.rst | 5 + doc/services/identity/v3/policies.rst | 27 +---- doc/services/identity/v3/projects.rst | 46 ++++---- doc/services/identity/v3/roles.rst | 26 +++-- doc/services/identity/v3/services.rst | 41 ++++--- doc/services/identity/v3/tokens.rst | 20 +++- doc/services/identity/v3/users.rst | 46 ++++---- doc/services/images/v2/create.rst | 3 + doc/services/images/v2/images.rst | 67 +++++------ doc/services/images/v2/index.rst | 6 + doc/services/images/v2/members.rst | 41 +++---- doc/services/networking/v2/create.rst | 3 + doc/services/networking/v2/index.rst | 6 + .../v2/loadbalancer-healthmonitors.rst | 40 ++++--- .../networking/v2/loadbalancer-listeners.rst | 39 ++++--- .../networking/v2/loadbalancer-pools.rst | 37 +++--- doc/services/networking/v2/loadbalancers.rst | 59 +++++----- doc/services/networking/v2/networks.rst | 36 +++--- doc/services/networking/v2/ports.rst | 38 ++++--- doc/services/networking/v2/subnets.rst | 38 ++++--- doc/services/object-store/v1/account.rst | 19 +++- doc/services/object-store/v1/containers.rst | 47 ++++---- doc/services/object-store/v1/create.rst | 3 + doc/services/object-store/v1/index.rst | 14 ++- doc/services/object-store/v1/objects.rst | 107 ++++++++---------- doc/setup.rst | 43 +++++++ .../get.php => BlockStorage/v2/create.php} | 5 +- samples/BlockStorage/v2/create_service.php | 12 -- .../BlockStorage/v3/volume_types/create.php | 6 +- .../BlockStorage/v3/volume_types/delete.php | 6 +- samples/BlockStorage/v3/volume_types/list.php | 6 +- .../v3/volume_types/{get.php => read.php} | 7 +- .../BlockStorage/v3/volume_types/update.php | 6 +- samples/BlockStorage/v3/volumes/create.php | 16 +-- .../v3/volumes/create_from_image.php | 14 ++- .../v3/volumes/create_from_snapshot.php | 6 +- .../v3/volumes/create_from_source_volume.php | 19 ---- .../v3/volumes/create_from_volume.php | 21 ++++ samples/BlockStorage/v3/volumes/delete.php | 6 +- samples/BlockStorage/v3/volumes/list.php | 6 +- .../BlockStorage/v3/volumes/list_detail.php | 6 +- .../v3/volumes/{get.php => read.php} | 7 +- samples/BlockStorage/v3/volumes/update.php | 6 +- .../flavors/{create_flavor.php => create.php} | 5 +- .../flavors/{delete_flavor.php => delete.php} | 4 +- samples/Compute/v2/flavors/get_flavor.php | 24 ---- .../v2/flavors/{list_flavors.php => list.php} | 5 +- .../get.php => Compute/v2/flavors/read.php} | 7 +- .../servers/{create_server.php => create.php} | 3 +- .../servers/{delete_server.php => delete.php} | 3 +- samples/Compute/v2/servers/get_server.php | 24 ---- .../v2/servers/{list_servers.php => list.php} | 5 +- .../get.php => Compute/v2/servers/read.php} | 8 +- .../servers/{update_server.php => update.php} | 9 +- samples/Identity/v2/authentication.php | 2 - ..._application_credential.php => create.php} | 7 +- ..._application_credential.php => delete.php} | 7 +- ...ow_application_credential.php => read.php} | 7 +- .../credentials/{add_cred.php => create.php} | 3 +- .../{delete_cred.php => delete.php} | 3 +- samples/Identity/v3/credentials/get_cred.php | 18 --- .../credentials/{list_creds.php => list.php} | 3 +- samples/Identity/v3/credentials/read.php | 17 +++ samples/Identity/v3/credentials/update.php | 21 ++++ .../Identity/v3/credentials/update_cred.php | 22 ---- .../Identity/v3/domains/check_group_role.php | 7 +- .../Identity/v3/domains/check_user_role.php | 7 +- .../v3/domains/{add_domain.php => create.php} | 7 +- .../domains/{delete_domain.php => delete.php} | 7 +- .../Identity/v3/domains/grant_group_role.php | 7 +- .../Identity/v3/domains/grant_user_role.php | 7 +- .../v3/domains/{list_domains.php => list.php} | 7 +- .../Identity/v3/domains/list_group_roles.php | 7 +- .../Identity/v3/domains/list_user_roles.php | 7 +- .../v3/domains/{show_domain.php => read.php} | 7 +- .../Identity/v3/domains/revoke_group_role.php | 7 +- .../Identity/v3/domains/revoke_user_role.php | 7 +- .../domains/{update_domain.php => update.php} | 7 +- .../{add_endpoint.php => create.php} | 7 +- .../{delete_endpoint.php => delete.php} | 7 +- .../{list_endpoints.php => list.php} | 7 +- .../endpoints/{get_endpoint.php => read.php} | 8 +- .../{update_endpoint.php => update.php} | 7 +- samples/Identity/v3/groups/add_user.php | 7 +- .../v3/groups/check_user_membership.php | 12 +- .../v3/groups/{add_group.php => create.php} | 7 +- .../groups/{delete_group.php => delete.php} | 7 +- .../v3/groups/{list_groups.php => list.php} | 7 +- samples/Identity/v3/groups/list_users.php | 7 +- .../v3/groups/{get_group.php => read.php} | 7 +- samples/Identity/v3/groups/remove_user.php | 7 +- .../groups/{update_group.php => update.php} | 7 +- .../Identity/v3/projects/check_group_role.php | 7 +- .../Identity/v3/projects/check_user_role.php | 7 +- .../projects/{add_project.php => create.php} | 7 +- .../{delete_project.php => delete.php} | 7 +- .../Identity/v3/projects/grant_group_role.php | 7 +- .../Identity/v3/projects/grant_user_role.php | 7 +- .../projects/{list_projects.php => list.php} | 7 +- .../Identity/v3/projects/list_group_roles.php | 7 +- .../Identity/v3/projects/list_user_roles.php | 7 +- .../v3/projects/{get_project.php => read.php} | 7 +- .../v3/projects/revoke_group_role.php | 7 +- .../Identity/v3/projects/revoke_user_role.php | 7 +- .../{update_project.php => update.php} | 7 +- .../v3/roles/{add_role.php => create.php} | 5 - .../v3/roles/{list_roles.php => list.php} | 5 - .../Identity/v3/roles/list_assignments.php | 5 - .../services/{add_service.php => create.php} | 7 +- .../{delete_service.php => delete.php} | 7 +- .../services/{list_services.php => list.php} | 7 +- .../v3/services/{get_service.php => read.php} | 7 +- .../{update_service.php => update.php} | 7 +- .../v3/tokens/export_authentication_token.php | 3 - .../v3/tokens/generate_token_from_id.php | 5 - .../generate_token_scoped_to_project_id.php | 3 - .../generate_token_scoped_to_project_name.php | 7 -- ...e_token_with_application_credential_id.php | 3 - .../v3/tokens/generate_token_with_user_id.php | 3 - .../tokens/generate_token_with_username.php | 6 - samples/Identity/v3/tokens/revoke_token.php | 5 +- .../use_cached_authentication_token.php | 3 - samples/Identity/v3/tokens/validate_token.php | 5 +- .../v3/users/{add_user.php => create.php} | 1 - .../v3/users/{delete_user.php => delete.php} | 5 - .../v3/users/{list_users.php => list.php} | 5 - samples/Identity/v3/users/list_groups.php | 5 - samples/Identity/v3/users/list_projects.php | 5 - .../v3/users/{get_user.php => read.php} | 5 - .../v3/users/{update_user.php => update.php} | 5 - samples/Images/v2/create.php | 14 +++ samples/Images/v2/create_with_region.php | 13 +++ samples/Images/v2/images/create.php | 6 +- samples/Images/v2/images/deactivate.php | 6 +- samples/Images/v2/images/delete.php | 13 ++- .../Images/v2/images/download_binary_data.php | 7 +- samples/Images/v2/images/list.php | 11 +- samples/Images/v2/images/list_sorted.php | 10 +- samples/Images/v2/images/reactivate.php | 6 +- .../Images/v2/images/{get.php => read.php} | 6 +- samples/Images/v2/images/update.php | 6 +- .../Images/v2/images/upload_binary_data.php | 6 +- samples/Images/v2/members/add.php | 14 --- samples/Images/v2/members/create.php | 16 +++ samples/Images/v2/members/delete.php | 14 ++- samples/Images/v2/members/get.php | 14 --- samples/Images/v2/members/list.php | 10 +- samples/Images/v2/members/read.php | 17 +++ samples/Images/v2/members/update_status.php | 15 ++- .../v2/lbaas/healthmonitors/get.php | 23 ---- .../v2/lbaas/healthmonitors/read.php | 17 +++ samples/Networking/v2/lbaas/listeners/get.php | 23 ---- .../Networking/v2/lbaas/listeners/read.php | 17 +++ .../v2/lbaas/loadbalancers/get_statuses.php | 3 +- .../lbaas/loadbalancers/{get.php => read.php} | 0 .../v2/lbaas/pools/{get.php => read.php} | 9 +- samples/Networking/v2/networks/create.php | 17 +-- .../Networking/v2/networks/create_batch.php | 20 +--- samples/Networking/v2/networks/delete.php | 10 +- samples/Networking/v2/networks/get.php | 28 ----- samples/Networking/v2/networks/read.php | 17 +++ samples/Networking/v2/networks/update.php | 10 +- samples/Networking/v2/ports/create.php | 12 +- samples/Networking/v2/ports/create_batch.php | 14 ++- .../v2/ports/create_with_fixed_ips.php | 10 +- samples/Networking/v2/ports/delete.php | 10 +- samples/Networking/v2/ports/list.php | 10 +- .../Networking/v2/ports/{get.php => read.php} | 9 +- samples/Networking/v2/ports/update.php | 10 +- .../Networking/v2/securityGroups/create.php | 3 +- .../Networking/v2/subnets/create_batch.php | 31 ++--- .../v2/subnets/create_with_gateway_ip.php | 18 +-- .../v2/subnets/create_with_host_routes.php | 14 +-- samples/Networking/v2/subnets/delete.php | 10 +- samples/Networking/v2/subnets/get.php | 28 ----- samples/Networking/v2/subnets/read.php | 17 +++ samples/Networking/v2/subnets/update.php | 12 +- .../ObjectStore/v1/account/get_metadata.php | 1 - .../ObjectStore/v1/account/merge_metadata.php | 1 - samples/ObjectStore/v1/account/read.php | 17 +++ .../ObjectStore/v1/account/reset_metadata.php | 2 - samples/ObjectStore/v1/containers/create.php | 5 +- samples/ObjectStore/v1/containers/delete.php | 10 +- .../v1/containers/get_metadata.php | 9 +- samples/ObjectStore/v1/containers/list.php | 1 - .../v1/containers/merge_metadata.php | 1 - samples/ObjectStore/v1/containers/read.php | 17 +++ .../v1/containers/reset_metadata.php | 2 - .../ObjectStore/v1/objects/check_exists.php | 8 +- samples/ObjectStore/v1/objects/copy.php | 15 +-- samples/ObjectStore/v1/objects/create.php | 14 +-- .../v1/objects/create_from_stream.php | 18 ++- .../v1/objects/create_large_object.php | 27 ++--- samples/ObjectStore/v1/objects/delete.php | 10 +- samples/ObjectStore/v1/objects/download.php | 10 +- .../v1/objects/download_stream.php | 10 +- .../ObjectStore/v1/objects/get_metadata.php | 10 +- samples/ObjectStore/v1/objects/list.php | 5 +- .../ObjectStore/v1/objects/merge_metadata.php | 18 +-- samples/ObjectStore/v1/objects/read.php | 18 +++ .../ObjectStore/v1/objects/reset_metadata.php | 18 +-- samples/Setup/application_credential_id.php | 12 ++ samples/Setup/token_id.php | 9 ++ samples/Setup/user_id.php | 12 ++ samples/Setup/username.php | 15 +++ src/Compute/v2/Service.php | 8 +- src/ObjectStore/v1/Models/Container.php | 2 + tests/sample/BlockStorage/v3/VolumeTest.php | 8 +- .../sample/BlockStorage/v3/VolumeTypeTest.php | 8 +- tests/sample/Compute/v2/FlavorTest.php | 10 +- tests/sample/Compute/v2/ServerTest.php | 9 +- .../Identity/v3/ApplicationCredentialTest.php | 16 +-- tests/sample/Identity/v3/DomainTest.php | 12 +- tests/sample/Identity/v3/EndpointTest.php | 16 +-- tests/sample/Identity/v3/GroupTest.php | 34 +++--- tests/sample/Identity/v3/ProjectTest.php | 34 +++--- tests/sample/Identity/v3/RoleTest.php | 10 +- tests/sample/Identity/v3/ServiceTest.php | 20 ++-- tests/sample/Identity/v3/UserTest.php | 26 ++--- tests/sample/Images/v2/ImageTest.php | 5 +- tests/sample/Images/v2/MemberTest.php | 8 +- tests/sample/Networking/v2/NetworkTest.php | 4 +- tests/sample/Networking/v2/PortTest.php | 7 +- tests/sample/Networking/v2/SubnetTest.php | 4 +- tests/sample/ObjectStore/v1/ContainerTest.php | 5 +- tests/sample/ObjectStore/v1/ObjectTest.php | 11 +- tests/sample/SampleManager.php | 3 +- 256 files changed, 1709 insertions(+), 1847 deletions(-) create mode 100644 doc/_exts/osdoc.py create mode 100644 doc/_static/css/custom.css create mode 100644 doc/common/create-service.rst create mode 100644 doc/common/service.rst create mode 100644 doc/install.rst create mode 100644 doc/services/block-storage/v3/create.rst create mode 100644 doc/services/compute/v2/create.rst delete mode 100644 doc/services/identity/v2/authentication.rst create mode 100644 doc/services/identity/v3/create.rst create mode 100644 doc/services/images/v2/create.rst create mode 100644 doc/services/networking/v2/create.rst create mode 100644 doc/services/object-store/v1/create.rst create mode 100644 doc/setup.rst rename samples/{ObjectStore/v1/containers/get.php => BlockStorage/v2/create.php} (59%) delete mode 100644 samples/BlockStorage/v2/create_service.php rename samples/BlockStorage/v3/volume_types/{get.php => read.php} (66%) delete mode 100644 samples/BlockStorage/v3/volumes/create_from_source_volume.php create mode 100644 samples/BlockStorage/v3/volumes/create_from_volume.php rename samples/BlockStorage/v3/volumes/{get.php => read.php} (65%) rename samples/Compute/v2/flavors/{create_flavor.php => create.php} (69%) rename samples/Compute/v2/flavors/{delete_flavor.php => delete.php} (78%) delete mode 100644 samples/Compute/v2/flavors/get_flavor.php rename samples/Compute/v2/flavors/{list_flavors.php => list.php} (68%) rename samples/{ObjectStore/v1/account/get.php => Compute/v2/flavors/read.php} (64%) rename samples/Compute/v2/servers/{create_server.php => create.php} (85%) rename samples/Compute/v2/servers/{delete_server.php => delete.php} (72%) delete mode 100644 samples/Compute/v2/servers/get_server.php rename samples/Compute/v2/servers/{list_servers.php => list.php} (60%) rename samples/{ObjectStore/v1/objects/get.php => Compute/v2/servers/read.php} (58%) rename samples/Compute/v2/servers/{update_server.php => update.php} (54%) rename samples/Identity/v3/application_credentials/{add_application_credential.php => create.php} (73%) rename samples/Identity/v3/application_credentials/{delete_application_credential.php => delete.php} (72%) rename samples/Identity/v3/application_credentials/{show_application_credential.php => read.php} (72%) rename samples/Identity/v3/credentials/{add_cred.php => create.php} (77%) rename samples/Identity/v3/credentials/{delete_cred.php => delete.php} (72%) delete mode 100644 samples/Identity/v3/credentials/get_cred.php rename samples/Identity/v3/credentials/{list_creds.php => list.php} (75%) create mode 100644 samples/Identity/v3/credentials/read.php create mode 100644 samples/Identity/v3/credentials/update.php delete mode 100644 samples/Identity/v3/credentials/update_cred.php rename samples/Identity/v3/domains/{add_domain.php => create.php} (71%) rename samples/Identity/v3/domains/{delete_domain.php => delete.php} (66%) rename samples/Identity/v3/domains/{list_domains.php => list.php} (69%) rename samples/Identity/v3/domains/{show_domain.php => read.php} (66%) rename samples/Identity/v3/domains/{update_domain.php => update.php} (68%) rename samples/Identity/v3/endpoints/{add_endpoint.php => create.php} (76%) rename samples/Identity/v3/endpoints/{delete_endpoint.php => delete.php} (67%) rename samples/Identity/v3/endpoints/{list_endpoints.php => list.php} (70%) rename samples/Identity/v3/endpoints/{get_endpoint.php => read.php} (65%) rename samples/Identity/v3/endpoints/{update_endpoint.php => update.php} (71%) rename samples/Identity/v3/groups/{add_group.php => create.php} (69%) rename samples/Identity/v3/groups/{delete_group.php => delete.php} (66%) rename samples/Identity/v3/groups/{list_groups.php => list.php} (69%) rename samples/Identity/v3/groups/{get_group.php => read.php} (66%) rename samples/Identity/v3/groups/{update_group.php => update.php} (70%) rename samples/Identity/v3/projects/{add_project.php => create.php} (71%) rename samples/Identity/v3/projects/{delete_project.php => delete.php} (66%) rename samples/Identity/v3/projects/{list_projects.php => list.php} (65%) rename samples/Identity/v3/projects/{get_project.php => read.php} (66%) rename samples/Identity/v3/projects/{update_project.php => update.php} (68%) rename samples/Identity/v3/roles/{add_role.php => create.php} (78%) rename samples/Identity/v3/roles/{list_roles.php => list.php} (80%) rename samples/Identity/v3/services/{add_service.php => create.php} (69%) rename samples/Identity/v3/services/{delete_service.php => delete.php} (66%) rename samples/Identity/v3/services/{list_services.php => list.php} (69%) rename samples/Identity/v3/services/{get_service.php => read.php} (67%) rename samples/Identity/v3/services/{update_service.php => update.php} (69%) rename samples/Identity/v3/users/{add_user.php => create.php} (91%) rename samples/Identity/v3/users/{delete_user.php => delete.php} (78%) rename samples/Identity/v3/users/{list_users.php => list.php} (80%) rename samples/Identity/v3/users/{get_user.php => read.php} (78%) rename samples/Identity/v3/users/{update_user.php => update.php} (81%) create mode 100644 samples/Images/v2/create.php create mode 100644 samples/Images/v2/create_with_region.php rename samples/Images/v2/images/{get.php => read.php} (66%) delete mode 100644 samples/Images/v2/members/add.php create mode 100644 samples/Images/v2/members/create.php delete mode 100644 samples/Images/v2/members/get.php create mode 100644 samples/Images/v2/members/read.php delete mode 100644 samples/Networking/v2/lbaas/healthmonitors/get.php create mode 100644 samples/Networking/v2/lbaas/healthmonitors/read.php delete mode 100644 samples/Networking/v2/lbaas/listeners/get.php create mode 100644 samples/Networking/v2/lbaas/listeners/read.php rename samples/Networking/v2/lbaas/loadbalancers/{get.php => read.php} (100%) rename samples/Networking/v2/lbaas/pools/{get.php => read.php} (59%) delete mode 100644 samples/Networking/v2/networks/get.php create mode 100644 samples/Networking/v2/networks/read.php rename samples/Networking/v2/ports/{get.php => read.php} (64%) delete mode 100644 samples/Networking/v2/subnets/get.php create mode 100644 samples/Networking/v2/subnets/read.php create mode 100644 samples/ObjectStore/v1/account/read.php create mode 100644 samples/ObjectStore/v1/containers/read.php create mode 100644 samples/ObjectStore/v1/objects/read.php create mode 100644 samples/Setup/application_credential_id.php create mode 100644 samples/Setup/token_id.php create mode 100644 samples/Setup/user_id.php create mode 100644 samples/Setup/username.php diff --git a/doc/_exts/osdoc.py b/doc/_exts/osdoc.py new file mode 100644 index 000000000..73d7f88c5 --- /dev/null +++ b/doc/_exts/osdoc.py @@ -0,0 +1,31 @@ +from docutils.parsers.rst import Directive +from docutils import nodes + + +class OsDoc(Directive): + required_arguments = 1 + has_content = True + + def run(self): + full_url = self.arguments[0] + title = 'official documentation' + + text = [] + text.extend([ + nodes.Text('More information can be found in the '), + nodes.reference(title, title, internal=False, refuri=self.arguments[0]), + nodes.Text('.') + ]) + + return [nodes.paragraph( + '', + '', + nodes.Text('More information can be found in the '), + nodes.reference(title, title, internal=False, refuri=full_url), + nodes.Text('.') + )] + + +def setup(app): + app.add_directive('osdoc', OsDoc) + return {'version': '0.1'} diff --git a/doc/_exts/samples.py b/doc/_exts/samples.py index bb11d3ebf..7c3910a0d 100644 --- a/doc/_exts/samples.py +++ b/doc/_exts/samples.py @@ -1,33 +1,41 @@ from docutils import nodes -from sphinx.addnodes import download_reference +from docutils.parsers.rst import directives from sphinx.directives.code import LiteralInclude import re +from sphinx.util.typing import OptionSpec + + class Sample(LiteralInclude): + option_spec: OptionSpec = { + 'full': directives.flag, + } + + def run(self): + self.arguments[0] = "/../samples/" + self.arguments[0] + self.options['language'] = 'php' - def run(self): - self.arguments[0] = "/../samples/" + self.arguments[0] - self.options['language'] = 'php' + pattern = r"[\s+]?(\<\?php.*?]\);)" - pattern = r"[\s+]?(\<\?php.*?]\);)" + code_block = super(Sample, self).run()[0] + if 'full' in self.options: + return [code_block] - code_block = super(Sample, self).run()[0] - string = str(code_block[0]) + string = str(code_block[0]) - match = re.match(pattern, string, re.S) - if match is None: - return [code_block] + match = re.match(pattern, string, re.S) + if match is None: + return [code_block] - auth_str = match.group(1).strip() - main_str = re.sub(pattern, "", string, 0, re.S).strip() + main_str = re.sub(pattern, "", string, 0, re.S).strip() + if main_str == '': + return [code_block] - show_hide_btn = download_reference(reftarget=self.arguments[0]) + return [ + nodes.literal_block(main_str, main_str, language="php") + ] - return [ - show_hide_btn, - nodes.literal_block(auth_str, auth_str, language="php"), - nodes.literal_block(main_str, main_str, language="php")] def setup(app): - app.add_directive('sample', Sample) - return {'version': '0.1'} + app.add_directive('sample', Sample) + return {'version': '0.1'} diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css new file mode 100644 index 000000000..33e75d969 --- /dev/null +++ b/doc/_static/css/custom.css @@ -0,0 +1,4 @@ +summary { + margin-bottom: 1rem; + cursor: pointer; +} \ No newline at end of file diff --git a/doc/common/create-service.rst b/doc/common/create-service.rst new file mode 100644 index 000000000..799043ddf --- /dev/null +++ b/doc/common/create-service.rst @@ -0,0 +1,18 @@ +Create Service +============== + +In order to work with the service you have to :doc:`setup the client ` first. + +Service can be created via :substitution-code:`|method|()` method of the ``OpenStack`` object. + +.. code-block:: php + :substitutions: + + $service = $openstack->|method|(); + +A list of additional options can be passed to the method. For example, to change the region: + +.. code-block:: php + :substitutions: + + $service = $openstack->|method|(['region' => '{region}']); diff --git a/doc/common/service.rst b/doc/common/service.rst new file mode 100644 index 000000000..ce86944a9 --- /dev/null +++ b/doc/common/service.rst @@ -0,0 +1 @@ +In order to work with |models| you have to :doc:`create the service ` first. \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 16f6c857b..14803257a 100755 --- a/doc/conf.py +++ b/doc/conf.py @@ -23,14 +23,23 @@ lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) primary_domain = 'php' -extensions = ['samples', 'refdoc', 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinxcontrib.phpdomain'] +extensions = [ + 'samples', + 'refdoc', + 'osdoc', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinxcontrib.phpdomain', + 'sphinx_toolbox.collapse', + 'sphinx_substitution_extensions', +] source_suffix = '.rst' master_doc = 'index' project = u'php-opencloud' copyright = u'2015-2023, PHP OpenCloud & contributors' version = '1.12' release = '1.12.1' -exclude_patterns = ['_build'] +exclude_patterns = ['_build', 'common'] pygments_style = 'sphinx' html_theme = 'sphinx_rtd_theme' @@ -39,6 +48,13 @@ # Output file base name for HTML help builder. htmlhelp_basename = 'php-openclouddoc' +# These folders are copied to the documentation's HTML output +html_static_path = ['_static'] + +html_css_files = [ + 'css/custom.css', +] + latex_documents = [ ('index', 'php-opencloud.tex', u'php-opencloud Documentation', u'Jamie Hannaford', 'manual'), diff --git a/doc/index.rst b/doc/index.rst index 0feb0b934..ae2b00097 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,40 +1,23 @@ Welcome to the OpenStack SDK for PHP! ===================================== -Requirements ------------- - -* PHP >= 7, < 9 -* cURL extension - -Installation ------------- - -You must install this library through Composer: - -.. code-block:: bash +About +----- - composer require php-opencloud/openstack +OpenStack SDK allows PHP developers to easily connect to OpenStack APIs in a simple and idiomatic way. +This binding is specifically designed for OpenStack APIs, but other provider SDKs are available. +Multiple OpenStack services, and versions of services, are supported. -If you do not have Composer installed, please read the `Composer installation instructions`_. - -Once you have installed the SDK as a dependency of your project, you will need to load Composer’s autoloader -(which registers all the required namespaces). To do this, place the following line of PHP code at the top of your -application’s PHP files: - -.. code-block:: php - - require 'vendor/autoload.php'; - -This assumes your application's PHP files are located in the same folder as ``vendor/``. If your files are located -elsewhere, please supply the path to vendor/autoload.php in the require statement above. +.. toctree:: + install + setup Supported services ------------------ .. toctree:: :glob: - :maxdepth: 1 + :maxdepth: 0 services/**/index @@ -49,6 +32,5 @@ Contributing If you'd like to contribute to the project, or require help running the unit/integration tests, please view the `contributing guidelines`_. -.. _Composer installation instructions: `https://getcomposer.org/doc/00-intro.md` -.. _Github repo: `https://github.com/php-opencloud/openstack` -.. _contributing guidelines: `https://github.com/php-opencloud/openstack/blob/master/CONTRIBUTING.md` +.. _Github repo: https://github.com/php-opencloud/openstack +.. _contributing guidelines: https://github.com/php-opencloud/openstack/blob/master/CONTRIBUTING.md diff --git a/doc/install.rst b/doc/install.rst new file mode 100644 index 000000000..fa2868e8e --- /dev/null +++ b/doc/install.rst @@ -0,0 +1,35 @@ +Installation +============ + +Requirements +------------ + +* PHP >= 7, < 9 +* cURL extension + +Install via composer +-------------------- + +You must install this library through Composer: + +.. code-block:: bash + + composer require php-opencloud/openstack + +If you do not have Composer installed, please read the `Composer installation instructions`_. + +Include autoloader +------------------ + +Once you have installed the SDK as a dependency of your project, you will need to load Composer’s autoloader +(which registers all the required namespaces). To do this, place the following line of PHP code at the top of your +application’s PHP files: + +.. code-block:: php + + require 'vendor/autoload.php'; + +This assumes your application's PHP files are located in the same folder as ``vendor/``. If your files are located +elsewhere, please supply the path to vendor/autoload.php in the require statement above. + +.. _Composer installation instructions: https://getcomposer.org/doc/00-intro.md diff --git a/doc/requirements.txt b/doc/requirements.txt index 6c439f25b..505737dde 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,2 +1,4 @@ sphinxcontrib-phpdomain>=0.11.0 -sphinx-rtd-theme>=0.5.1 \ No newline at end of file +sphinx-rtd-theme>=0.5.1 +sphinx-toolbox>=3.5.0 +sphinx-substitution-extensions \ No newline at end of file diff --git a/doc/services/block-storage/v2/index.rst b/doc/services/block-storage/v2/index.rst index 9e046e319..e67c6a426 100644 --- a/doc/services/block-storage/v2/index.rst +++ b/doc/services/block-storage/v2/index.rst @@ -3,7 +3,7 @@ Block Storage v2 Block Storage v2 API is deprecated since Pike release and was removed in the Xena release. It is recommended to use Block Storage v3 API instead. However most of endpoints are identical, so if you still need -to use Block Storage v2 API, you can use the change `$openstack->blockStorageV3()` to `$openstack->blockStorageV2()` in examples. +to use Block Storage v2 API, you can use the change ``$openstack->blockStorageV3()`` to ``$openstack->blockStorageV2()`` in examples. In most cases it will work without any other changes. -.. sample:: BlockStorage/v2/create_service.php +.. sample:: BlockStorage/v2/create.php diff --git a/doc/services/block-storage/v3/create.rst b/doc/services/block-storage/v3/create.rst new file mode 100644 index 000000000..80998dcc1 --- /dev/null +++ b/doc/services/block-storage/v3/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: blockStorageV3 + +.. include:: /common/create-service.rst \ No newline at end of file diff --git a/doc/services/block-storage/v3/index.rst b/doc/services/block-storage/v3/index.rst index d012ed563..7c8acfbd4 100644 --- a/doc/services/block-storage/v3/index.rst +++ b/doc/services/block-storage/v3/index.rst @@ -1,9 +1,15 @@ Block Storage v3 ================ +OpenStack Block Storage API v3 (Cinder). Cinder is the OpenStack Block Storage service for providing volumes +to Nova virtual machines, Ironic bare metal hosts, containers and more. + +.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/ + .. toctree:: - :maxdepth: 3 + :maxdepth: 3 - volumes - volume-types - snapshots + create + volumes + volume-types + snapshots diff --git a/doc/services/block-storage/v3/snapshots.rst b/doc/services/block-storage/v3/snapshots.rst index e3aea5f58..c2cfa83d8 100644 --- a/doc/services/block-storage/v3/snapshots.rst +++ b/doc/services/block-storage/v3/snapshots.rst @@ -1,18 +1,26 @@ Snapshots ========= -List volumes ------------- +A snapshot is read-only point in time copy of a volume. The snapshot can be created from a volume that is currently in use +or in an available state. The snapshot can then be used to create a new volume. + +.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/#volume-snapshots-snapshots + +.. |models| replace:: snapshots + +.. include:: /common/service.rst + +List +---- .. sample:: BlockStorage/v3/snapshots/list.php -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listSnapshots Each iteration will return a php:class:`Snapshot` instance . .. include:: /common/generators.rst -List volumes sorted -~~~~~~~~~~~~~~~~~~~ +List sorted +~~~~~~~~~~~ Possible values for sort_key are: diff --git a/doc/services/block-storage/v3/volume-types.rst b/doc/services/block-storage/v3/volume-types.rst index b89d0222b..e052e0107 100644 --- a/doc/services/block-storage/v3/volume-types.rst +++ b/doc/services/block-storage/v3/volume-types.rst @@ -1,59 +1,45 @@ Volume Types ============ -Listing volume types --------------------- -.. sample:: BlockStorage/v3/volume_types/list.php -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumeTypes +Volume type is a group of volume policies. They can be used to specify which driver must be used on volume creation. -Each iteration will return a :php:class:`VolumeType` instance . +.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/#volumes-volumes -.. include:: /common/generators.rst +.. |models| replace:: volume types +.. include:: /common/service.rst -Create volume type ------------------- +Create +------ -The only attributes that are required when creating a volume are a name. The simplest example -would therefore be this: +The only attributes that are required when creating a volume are a name. .. sample:: BlockStorage/v3/volume_types/create.php -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_createVolumeType - - -Retrieve details of a volume type ---------------------------------- - -When retrieving a volume type, sometimes you only want to operate on it - say to update or delete it. If this is the -case, then there is no need to perform an initial GET request to the API: - -.. sample:: BlockStorage/v3/volume_types/get.php - -If, however, you *do* want to retrieve all the details of a remote volume type from the API, you just call: -.. code-block:: php - $volumeType->retrieve(); +Read +---- -which will update the state of the local object. This gives you an element of control over your app's performance. +.. sample:: BlockStorage/v3/volume_types/read.php -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_getVolumeType - -Update a volume type --------------------- - -The first step when updating a volume type is modifying the attributes you want updated. By default, only a volume -type's name can be edited. +Update +------ .. sample:: BlockStorage/v3/volume_types/update.php -.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_update -Delete volume type ------------------- +Delete +------ To permanently delete a volume type: .. sample:: BlockStorage/v3/volume_types/delete.php -.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_delete \ No newline at end of file + +List +---- +.. sample:: BlockStorage/v3/volume_types/list.php + +Each iteration will return a :php:class:`VolumeType` instance . + +.. include:: /common/generators.rst diff --git a/doc/services/block-storage/v3/volumes.rst b/doc/services/block-storage/v3/volumes.rst index 82843b6cd..9805616f7 100644 --- a/doc/services/block-storage/v3/volumes.rst +++ b/doc/services/block-storage/v3/volumes.rst @@ -1,26 +1,17 @@ Volumes ======= -List volumes ------------- +A volume is a detachable block storage device similar to a USB hard drive. You can attach a volume to an instance, and +if the volume is of an appropriate volume type, a volume can be attached to multiple instances. -.. sample:: BlockStorage/v3/volumes/list.php -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumes - -Each iteration will return a php:class:`Volume` instance . - -.. include:: /common/generators.rst - -Detailed information -~~~~~~~~~~~~~~~~~~~~ +.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/#volumes-volumes -By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information -for a flavor, you must enable detailed information, like so: +.. |models| replace:: volumes -.. sample:: BlockStorage/v3/volumes/list_detail.php +.. include:: /common/service.rst -Create volume -------------- +Create +------ The only attributes that are required when creating a volume are a size in GiB. The simplest example would therefore be this: @@ -30,8 +21,6 @@ would therefore be this: You can further configure your new volume, however, by following the below sections, which instruct you how to add specific functionality. -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_createVolume - Create from image ~~~~~~~~~~~~~~~~~ @@ -42,44 +31,46 @@ Create from snapshot .. sample:: BlockStorage/v3/volumes/create_from_snapshot.php -Create from source volume -~~~~~~~~~~~~~~~~~~~~~~~~~ +Create from volume +~~~~~~~~~~~~~~~~~~ -.. sample:: BlockStorage/v3/volumes/create_from_source_volume.php +.. sample:: BlockStorage/v3/volumes/create_from_volume.php -Retrieve volume details ------------------------ +Read +---- -When retrieving a volume, sometimes you only want to operate on it - say to update or delete it. If this is the case, -then there is no need to perform an initial GET request to the API: +.. sample:: BlockStorage/v3/volumes/read.php -.. sample:: BlockStorage/v3/volumes/get.php -If, however, you *do* want to retrieve all the details of a remote volume from the API, you just call: +Update +------ -.. code-block:: php +The first step when updating a volume is modifying the attributes you want updated. Only a volume's name +and description can be edited. - $volume->retrieve(); +.. sample:: BlockStorage/v3/volumes/update.php -which will update the state of the local object. This gives you an element of control over your app's performance. +Delete +------ -.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_getVolume +To permanently delete a volume: +.. sample:: BlockStorage/v3/volumes/delete.php -Update volume -------------- +List +---- -The first step when updating a volume is modifying the attributes you want updated. By default, only a volume's name -and description can be edited. +.. sample:: BlockStorage/v3/volumes/list.php -.. sample:: BlockStorage/v3/volumes/update.php -.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_update +Each iteration will return a php:class:`Volume` instance . -Delete volume -------------- +.. include:: /common/generators.rst -To permanently delete a volume: +Detailed information +~~~~~~~~~~~~~~~~~~~~ -.. sample:: BlockStorage/v3/volumes/delete.php -.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_delete \ No newline at end of file +By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information +for a flavor, you must enable detailed information: + +.. sample:: BlockStorage/v3/volumes/list_detail.php diff --git a/doc/services/compute/v2/create.rst b/doc/services/compute/v2/create.rst new file mode 100644 index 000000000..07800c766 --- /dev/null +++ b/doc/services/compute/v2/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: objectStoreV1 + +.. include:: /common/create-service.rst diff --git a/doc/services/compute/v2/flavors.rst b/doc/services/compute/v2/flavors.rst index 6d71b734c..7fb2409a6 100644 --- a/doc/services/compute/v2/flavors.rst +++ b/doc/services/compute/v2/flavors.rst @@ -1,46 +1,36 @@ Flavors ======= -List flavors ------------- +Flavors define the compute, memory, and storage capacity of nova computing instances. To put it simply, a flavor is +an available hardware configuration for a server. It defines the size of a virtual server that can be launched. -.. sample:: Compute/v2/flavors/list_flavors.php -.. refdoc:: OpenStack/Compute/v2/Service.html#method_listFlavors +.. osdoc:: https://docs.openstack.org/nova/latest/user/flavors.html -Each iteration will return a :php:class:`Flavor` instance . - -.. include:: /common/generators.rst - -Detailed information -~~~~~~~~~~~~~~~~~~~~ +.. |models| replace:: flavors -By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information -for a flavor, you must pass ``true`` as the last parameter, like so: +.. include:: /common/service.rst -.. code-block:: php +Read +---- - $flavors = $service->listFlavors([], function ($flavor) { - return $flavor; - }, true); +.. sample:: Compute/v2/flavors/read.php -Retrieve a flavor ------------------ +List +---- -.. sample:: Compute/v2/flavors/get_flavor.php -.. refdoc:: OpenStack/Compute/v2/Service.html#method_getFlavor +.. sample:: Compute/v2/flavors/list.php -When retrieving a flavor, sometimes you only want to operate on it. If this is the case, -then there is no need to perform an initial ``GET`` request to the server: +Each iteration will return a :php:class:`Flavor` instance . -.. code-block:: php +.. include:: /common/generators.rst - // Get an unpopulated object - $flavor = $service->getFlavor(['id' => '{flavorId}']); +Detailed information +~~~~~~~~~~~~~~~~~~~~ -If, however, you *do* want to retrieve all the details of a remote flavor from the API, you just call: +By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information +for a flavor, you must pass ``true`` as the last parameter, like so: .. code-block:: php - $flavor->retrieve(); + $flavors = $service->listFlavors([], null, true); -which will update the state of the local object. This gives you an element of control over your app's performance. diff --git a/doc/services/compute/v2/images.rst b/doc/services/compute/v2/images.rst index 6a2ce6e7a..9ca8e4b7f 100644 --- a/doc/services/compute/v2/images.rst +++ b/doc/services/compute/v2/images.rst @@ -1,6 +1,12 @@ Images ====== +.. warning:: + These APIs are proxy calls to the :doc:`/services/images/v2/index` Image service. + Nova has deprecated all the proxy APIs and users should use the native APIs instead. + +.. osdoc:: https://docs.openstack.org/api-ref/compute/#images-deprecated + List images ----------- @@ -9,7 +15,6 @@ List images Each iteration will return an :apiref:Image instance _. .. include:: /common/generators.rst -.. refdoc:: OpenStack/Compute/v2/Service.html#method_listImages Detailed information ~~~~~~~~~~~~~~~~~~~~ @@ -28,7 +33,6 @@ When retrieving an image, sometimes you only want to operate on it - say to upda then there is no need to perform an initial GET request to the server: .. sample:: Compute/v2/images/get_image.php -.. refdoc:: OpenStack/Compute/v2/Service.html#method_getImage If, however, you *do* want to retrieve all the details of a remote image from the API, you just call: @@ -42,7 +46,6 @@ Delete an image --------------- .. sample:: Compute/v2/images/delete_image.php -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_delete Retrieve metadata ----------------- @@ -53,8 +56,6 @@ This operation will retrieve the existing metadata for an image: $metadata = $image->getMetadata(); -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_getMetadata - Reset metadata -------------- @@ -63,8 +64,6 @@ Reset metadata This operation will _replace_ all existing metadata with whatever is provided in the request. Any existing metadata not specified in the request will be deleted. -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_resetMetadata - Merge metadata -------------- @@ -77,8 +76,6 @@ will be added. Any existing keys that are not specified in the request will rema 'foo' => 'bar', ]); -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_mergeMetadata - Retrieve image metadata item ---------------------------- @@ -88,12 +85,9 @@ This operation allows you to retrieve the value for a specific metadata item: $itemValue = $image->getMetadataItem('key'); -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_getMetadataItem - Delete image metadata item -------------------------- This operation allows you to remove a specific metadata item: .. sample:: Compute/v2/images/delete_image_metadata_item.php -.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_deleteMetadataItem \ No newline at end of file diff --git a/doc/services/compute/v2/index.rst b/doc/services/compute/v2/index.rst index cd9b4fd4a..26190cdaf 100644 --- a/doc/services/compute/v2/index.rst +++ b/doc/services/compute/v2/index.rst @@ -1,9 +1,15 @@ Compute v2 ========== +OpenStack Compute (Nova) API Version 2. Nova is the OpenStack project that provides a way to provision compute instances +(aka virtual servers). + +.. osdoc:: https://docs.openstack.org/api-ref/compute/ + .. toctree:: :maxdepth: 3 + create servers flavors images diff --git a/doc/services/compute/v2/servers.rst b/doc/services/compute/v2/servers.rst index eb6ed7ea9..4865771da 100644 --- a/doc/services/compute/v2/servers.rst +++ b/doc/services/compute/v2/servers.rst @@ -1,17 +1,24 @@ Servers ======= -Listing servers ---------------- +Server is the main resource in the Compute API. It represents a virtual machine. + +.. osdoc:: https://docs.openstack.org/api-ref/compute/#servers-servers + +.. |models| replace:: servers + +.. include:: /common/service.rst + +List +---- To list a collection of servers, you run: -.. sample:: Compute/v2/servers/list_servers.php +.. sample:: Compute/v2/servers/list.php Each iteration will return a :apiref:Server instance . .. include:: /common/generators.rst -.. refdoc:: OpenStack/Compute/v2/Service.html#method_listServers Detailed information ~~~~~~~~~~~~~~~~~~~~ @@ -38,19 +45,17 @@ parameters which are documented in the reference documentation. 'flavorId' => 'performance1-1', ]); -Create a server ---------------- +Create +------ The only attributes that are required when creating a server are a name, flavor ID and image ID. The simplest example would therefore be this: -.. sample:: Compute/v2/servers/create_server.php +.. sample:: Compute/v2/servers/create.php You can further configure your new server, however, by following the below sections, which instruct you how to add specific functionality. They are interoperable and can work together. -.. refdoc:: OpenStack/Compute/v2/Service.html#method_createServer - Security groups ~~~~~~~~~~~~~~~ @@ -133,40 +138,25 @@ when the server is launched, use this option: 'baz' => 'bar', ]; -Retrieve a server ------------------ - -When retrieving a server, sometimes you only want to operate on it - say to update or delete it. If this is the case, -then there is no need to perform an initial GET request to the server: - -.. sample:: Compute/v2/servers/get_server.php +Read +---- -If, however, you *do* want to retrieve all the details of a remote server from the API, you just call: +.. sample:: Compute/v2/servers/read.php -.. code-block:: php - - $server->retrieve(); - -which will update the state of the local object. This gives you an element of control over your app's performance. - -.. refdoc:: OpenStack/Compute/v2/Service.html#method_getServer - -Update a server ---------------- +Update +------ The first step when updating a server is modifying the attributes you want updated. By default, only a server's name, IPv4 and IPv6 IPs, and its auto disk config attributes can be edited. -.. sample:: Compute/v2/servers/update_server.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_update +.. sample:: Compute/v2/servers/update.php -Delete a server +Delete --------------- To permanently delete a server: -.. sample:: Compute/v2/servers/delete_server.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_delete +.. sample:: Compute/v2/servers/delete.php Retrieve metadata ----------------- @@ -174,7 +164,6 @@ Retrieve metadata This operation will retrieve the existing metadata for a server: .. sample:: Compute/v2/servers/get_server_metadata.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_getMetadata Reset metadata -------------- @@ -183,7 +172,6 @@ This operation will _replace_ all existing metadata with whatever is provided in not specified in the request will be deleted. .. sample:: Compute/v2/servers/reset_server_metadata.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_resetMetadata Merge metadata -------------- @@ -192,7 +180,6 @@ This operation will _merge_ specified metadata with what already exists. Existin will be added. Any existing keys that are not specified in the request will remain unaffected. .. sample:: Compute/v2/servers/merge_server_metadata.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_mergeMetadata Retrieve metadata item ---------------------- @@ -200,7 +187,6 @@ Retrieve metadata item This operation allows you to retrieve the value for a specific metadata item: .. sample:: Compute/v2/servers/get_server_metadata_item.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_getMetadataItem Delete metadata item -------------------- @@ -208,7 +194,6 @@ Delete metadata item This operation allows you to remove a specific metadata item: .. sample:: Compute/v2/servers/delete_server_metadata_item.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_deleteMetadataItem Change root password -------------------- @@ -216,7 +201,6 @@ Change root password This operation will replace the root password for a server. .. sample:: Compute/v2/servers/change_server_password.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_changePassword Reset server state ------------------ @@ -224,7 +208,6 @@ Reset server state This operation will reset the state of the server. .. sample:: Compute/v2/servers/reset_server_state.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_resetState Reboot server ------------- @@ -233,7 +216,6 @@ This operation will reboot a server. You can specify HARD reboot by passing argu Otherwise, the default is a SOFT reboot. .. sample:: Compute/v2/servers/reboot_server.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_reboot Rebuild server -------------- @@ -243,7 +225,6 @@ system. It will shutdown, re-image and then reboot your instance. Any data saved the rebuild is performed. .. sample:: Compute/v2/servers/rebuild_server.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_rebuild Resize server ------------- @@ -253,7 +234,6 @@ transition to a VERIFY_RESIZE state and a VM status of RESIZED. You will either resize in order to continue. .. sample:: Compute/v2/servers/resize_server.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_resize Confirm server resize --------------------- @@ -263,7 +243,6 @@ VERIFY_RESIZE and a VM status of RESIZED. Once this operation completes, the ser ACTIVE state and a migration status of confirmed. .. sample:: Compute/v2/servers/confirm_server_resize.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_confirmResize Revert server resize -------------------- @@ -273,7 +252,6 @@ VERIFY_RESIZE and a VM status of RESIZED. Once this operation completes, the ser ACTIVE state and a migration status of reverted. .. sample:: Compute/v2/servers/revert_server_resize.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_revertResize Create server image ------------------- @@ -282,7 +260,6 @@ This operation will create a new server image. The only required option is the n additional metadata: .. sample:: Compute/v2/images/create_server_image.php -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_createImage List server IP addresses ------------------------ @@ -303,11 +280,3 @@ You can also refine by network label: $ipAddresses = $server->listAddresses([ 'networkLabel' => '{networkLabel}', ]); - -.. refdoc:: OpenStack/Compute/v2/Models/Server.html#method_listAddresses - -Further links -------------- - -* Reference docs for Server class -* API docs diff --git a/doc/services/compute/v2/states.rst b/doc/services/compute/v2/states.rst index 5a1106f0b..ac75810c9 100644 --- a/doc/services/compute/v2/states.rst +++ b/doc/services/compute/v2/states.rst @@ -1,5 +1,5 @@ Server states -------------- +============= Servers contain a status attribute that indicates the current server state. You can filter on the server status when you complete a list servers request. The server status is returned in the response body. The server status is one of diff --git a/doc/services/identity/v2/authentication.rst b/doc/services/identity/v2/authentication.rst deleted file mode 100644 index 6f5d515fd..000000000 --- a/doc/services/identity/v2/authentication.rst +++ /dev/null @@ -1,12 +0,0 @@ -Authentication -============== - -Identity v2.0 -------------- - -We recommend users to use identity v3 when possible. - -RackSpace cloud and OVH cloud, however, are still using Keystone v2.0. This following code will work for such providers. - - -.. sample:: Identity/v2/authentication.php diff --git a/doc/services/identity/v2/index.rst b/doc/services/identity/v2/index.rst index d4f39ac1e..b0000411b 100644 --- a/doc/services/identity/v2/index.rst +++ b/doc/services/identity/v2/index.rst @@ -1,7 +1,9 @@ Identity v2 =========== -.. toctree:: - :maxdepth: 3 +We recommend users to use Identity v3 when possible. - authentication \ No newline at end of file +Some public clouds, however, might still use Keystone v2. This following code will work for such providers. + +.. sample:: Identity/v2/authentication.php + :full: diff --git a/doc/services/identity/v3/application-credentials.rst b/doc/services/identity/v3/application-credentials.rst index c45b393fe..ad8009fde 100644 --- a/doc/services/identity/v3/application-credentials.rst +++ b/doc/services/identity/v3/application-credentials.rst @@ -1,17 +1,30 @@ Application Credentials ======================= -Add application credential --------------------------- +Application credentials provide a way to delegate a user’s authorization to an application without sharing the user’s +password authentication. This is a useful security measure, especially for situations where the user’s identification +is provided by an external source, such as LDAP or a single-sign-on service. Instead of storing user passwords in +config files, a user creates an application credential for a specific project, with all or a subset of the role assignments +they have on that project, and then stores the application credential identifier and secret in the config file. -.. sample:: Identity/v3/application_credentials/add_application_credential.php +.. osdoc:: https://docs.openstack.org/keystone/latest/user/application_credentials.html -Show application credential details ------------------------------------ +.. |models| replace:: application credentials -.. sample:: Identity/v3/application_credentials/show_application_credential.php +.. include:: /common/service.rst -Delete application credential ------------------------------ +Create +------ + +.. sample:: Identity/v3/application_credentials/create.php + +Read +---- + +.. sample:: Identity/v3/application_credentials/read.php + +Delete +------ + +.. sample:: Identity/v3/application_credentials/delete.php -.. sample:: Identity/v3/application_credentials/delete_application_credential.php diff --git a/doc/services/identity/v3/create.rst b/doc/services/identity/v3/create.rst new file mode 100644 index 000000000..9f0c6d3a6 --- /dev/null +++ b/doc/services/identity/v3/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: identityV3 + +.. include:: /common/create-service.rst diff --git a/doc/services/identity/v3/credentials.rst b/doc/services/identity/v3/credentials.rst index 56a1e55ea..23a753c6f 100644 --- a/doc/services/identity/v3/credentials.rst +++ b/doc/services/identity/v3/credentials.rst @@ -1,41 +1,44 @@ Credentials =========== -Add credential --------------- +In exchange for a set of authentication credentials that the user submits, the Identity service generates and returns +a token. A token represents the authenticated identity of a user and, optionally, grants authorization on a specific +project or domain. -Create a secret/access pair for use with ec2 style auth. This operation will generates a new set of credentials that -map the user/tenant pair. +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#credentials -.. sample:: Identity/v3/credentials/add_cred.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createCredential +.. |models| replace:: credentials -List credentials ----------------- +.. include:: /common/service.rst -List all credentials for a given user. +Create +------ -.. sample:: Identity/v3/credentials/list_creds.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listCredentials +Create a secret/access pair for use with ec2 style auth. This operation will generates a new set of credentials that +map the user/tenant pair. -Show credential details ------------------------ +.. sample:: Identity/v3/credentials/create.php + +Read +---- Retrieve a user's access/secret pair by the access key. -.. sample:: Identity/v3/credentials/get_cred.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getCredential +.. sample:: Identity/v3/credentials/read.php -Update credential ------------------ +Update +------ -.. sample:: Identity/v3/credentials/update_cred.php -.. refdoc:: OpenStack/Identity/v3/Models/Credential.html#method_update +.. sample:: Identity/v3/credentials/update.php -Delete credential ------------------ +Delete +------ Delete a user's access/secret pair. -.. sample:: Identity/v3/credentials/delete_cred.php -.. refdoc:: OpenStack/Identity/v3/Models/Credential.html#method_delete +.. sample:: Identity/v3/credentials/delete.php + +List +---- + +.. sample:: Identity/v3/credentials/list.php diff --git a/doc/services/identity/v3/domains.rst b/doc/services/identity/v3/domains.rst index 409059d94..c5ddb653c 100644 --- a/doc/services/identity/v3/domains.rst +++ b/doc/services/identity/v3/domains.rst @@ -1,80 +1,75 @@ Domains ======= -Add domain ----------- +A domain is a collection of users, groups, and projects. Each group and project is owned by exactly one domain. -.. sample:: Identity/v3/domains/add_domain.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createDomain +.. osdoc:: https://docs.openstack.org/keystone/latest/getting-started/architecture.html#domains -List domains ------------- +.. |models| replace:: domains -.. sample:: Identity/v3/domains/list_domains.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listDomains +.. include:: /common/service.rst -Show domain details -------------------- +Create +------ -.. sample:: Identity/v3/domains/show_domain.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getDomain +.. sample:: Identity/v3/domains/create.php -Update domain -------------- +Read +---- -.. sample:: Identity/v3/domains/update_domain.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_update +.. sample:: Identity/v3/domains/read.php -Delete domain -------------- +Update +------ -.. sample:: Identity/v3/domains/delete_domain.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_delete +.. sample:: Identity/v3/domains/update.php + +Delete +------ + +.. sample:: Identity/v3/domains/delete.php + +List +---- + +.. sample:: Identity/v3/domains/list.php List roles for domain user -------------------------- .. sample:: Identity/v3/domains/list_user_roles.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_listUserRoles Grant role to domain user ------------------------- .. sample:: Identity/v3/domains/grant_user_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_grantUserRole Check role for domain user -------------------------- .. sample:: Identity/v3/domains/check_user_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_checkUserRole Revoke role for domain user --------------------------- .. sample:: Identity/v3/domains/revoke_user_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_revokeUserRole List roles for domain group --------------------------- .. sample:: Identity/v3/domains/list_group_roles.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_listGroupRoles Grant role to domain group -------------------------- .. sample:: Identity/v3/domains/grant_group_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_grantGroupRole Check role for domain group --------------------------- .. sample:: Identity/v3/domains/check_group_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_checkGroupRole Revoke role for domain group ---------------------------- .. sample:: Identity/v3/domains/revoke_group_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Domain.html#method_revokeGroupRole diff --git a/doc/services/identity/v3/endpoints.rst b/doc/services/identity/v3/endpoints.rst index d5d99e6af..252b07719 100644 --- a/doc/services/identity/v3/endpoints.rst +++ b/doc/services/identity/v3/endpoints.rst @@ -1,32 +1,39 @@ Endpoints ========= -Add endpoints -------------- +Each service should have one or more related endpoints. An endpoint is essentially a base URL for +an API, along with some metadata about the endpoint itself and represents a set of URL endpoints for +OpenStack web services. -.. sample:: Identity/v3/endpoints/add_endpoint.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createEndpoint +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#service-catalog-and-endpoints -Get endpoint ------------- +.. |models| replace:: endpoints -.. sample:: Identity/v3/endpoints/get_endpoint.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getEndpoint +.. include:: /common/service.rst -List endpoints --------------- -.. sample:: Identity/v3/endpoints/list_endpoints.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listEndpoints +Create +------ + +.. sample:: Identity/v3/endpoints/create.php + +Read +---- + +.. sample:: Identity/v3/endpoints/read.php -Update endpoint ---------------- -.. sample:: Identity/v3/endpoints/update_endpoint.php -.. refdoc:: OpenStack/Identity/v3/Models/Endpoint.html#method_update +Update +------ -Delete endpoint ---------------- +.. sample:: Identity/v3/endpoints/update.php + +Delete +------ + +.. sample:: Identity/v3/endpoints/delete.php + +List +-------------- -.. sample:: Identity/v3/endpoints/delete_endpoint.php -.. refdoc:: OpenStack/Identity/v3/Models/Endpoint.html#method_delete +.. sample:: Identity/v3/endpoints/list.php diff --git a/doc/services/identity/v3/groups.rst b/doc/services/identity/v3/groups.rst index 4fc037754..62cb75f00 100644 --- a/doc/services/identity/v3/groups.rst +++ b/doc/services/identity/v3/groups.rst @@ -1,35 +1,39 @@ Groups ====== -Add group ---------- +Groups are a container representing a collection of users. A group itself must be owned by a specific domain, +and hence all group names are not globally unique, but only unique to their domain. -.. sample:: Identity/v3/groups/add_group.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createGroup +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#groups -List groups ------------ +.. |models| replace:: groups -.. sample:: Identity/v3/groups/list_groups.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listGroups +.. include:: /common/service.rst -Show group details ------------------- +Create +------ -.. sample:: Identity/v3/groups/get_group.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getGroup +.. sample:: Identity/v3/groups/create.php -Update group ------------- +Read +---- -.. sample:: Identity/v3/groups/update_group.php -.. refdoc:: OpenStack/Identity/v3/Models/Group.html#method_update +.. sample:: Identity/v3/groups/read.php -Delete group ------------- +Update +------ -.. sample:: Identity/v3/groups/delete_group.php -.. refdoc:: OpenStack/Identity/v3/Models/Group.html#method_delete +.. sample:: Identity/v3/groups/update.php + +Delete +------ + +.. sample:: Identity/v3/groups/delete.php + +List +---- + +.. sample:: Identity/v3/groups/list.php List users in a group --------------------- diff --git a/doc/services/identity/v3/index.rst b/doc/services/identity/v3/index.rst index 6520cc7ba..be1cebdfc 100644 --- a/doc/services/identity/v3/index.rst +++ b/doc/services/identity/v3/index.rst @@ -1,9 +1,14 @@ Identity v3 =========== +OpenStack Identity API v3. It is used to manage the `OpenStack Keystone service `_. + +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html + .. toctree:: :maxdepth: 3 + create application-credentials credentials domains diff --git a/doc/services/identity/v3/policies.rst b/doc/services/identity/v3/policies.rst index 6900ff011..4202951b1 100644 --- a/doc/services/identity/v3/policies.rst +++ b/doc/services/identity/v3/policies.rst @@ -1,29 +1,6 @@ Policies ======== -.. warning:: Due to lack of information in upstream documentation, we are unable to offer code samples for this resource yet. +.. warning:: The policies API is deprecated. Keystone is not a policy management service. Do not use this. -Add policy ----------- - -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createPolicy - -List policies -------------- - -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listPolicies - -Show policy details -------------------- - -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getPolicy - -Update policy -------------- - -.. refdoc:: OpenStack/Identity/v3/Models/Policy.html#method_update - -Delete policy -------------- - -.. refdoc:: OpenStack/Identity/v3/Models/Policy.html#method_delete +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#policies diff --git a/doc/services/identity/v3/projects.rst b/doc/services/identity/v3/projects.rst index 1de4f2ab8..5e25bbdfc 100644 --- a/doc/services/identity/v3/projects.rst +++ b/doc/services/identity/v3/projects.rst @@ -1,35 +1,41 @@ Projects ======== -Add project ------------ +Projects represent the base unit of ownership in OpenStack, in that all resources in OpenStack should be owned +by a specific project. A project itself must be owned by a specific domain, and hence all project names +are not globally unique, but unique to their domain. If the domain for a project is not specified, then it is added +to the default domain. -.. sample:: Identity/v3/projects/add_project.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createProject +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#projects -List projects -------------- +.. |models| replace:: projects -.. sample:: Identity/v3/projects/list_projects.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listProjects +.. include:: /common/service.rst -Show project details --------------------- +Create +------ -.. sample:: Identity/v3/projects/get_project.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getProject +.. sample:: Identity/v3/projects/create.php -Update project --------------- +Read +---- -.. sample:: Identity/v3/projects/update_project.php -.. refdoc:: OpenStack/Identity/v3/Models/Project.html#method_update +.. sample:: Identity/v3/projects/read.php -Delete project --------------- +Update +------ -.. sample:: Identity/v3/projects/delete_project.php -.. refdoc:: OpenStack/Identity/v3/Models/Project.html#method_delete +.. sample:: Identity/v3/projects/update.php + +Delete +------ + +.. sample:: Identity/v3/projects/delete.php + +List +---- + +.. sample:: Identity/v3/projects/list.php List roles for project user --------------------------- diff --git a/doc/services/identity/v3/roles.rst b/doc/services/identity/v3/roles.rst index 143dabee3..2a60f1f4a 100644 --- a/doc/services/identity/v3/roles.rst +++ b/doc/services/identity/v3/roles.rst @@ -1,20 +1,28 @@ Roles ===== -Add role --------- +OpenStack services typically determine whether a user’s API request should be allowed using Role Based Access Control (RBAC). +For OpenStack this means the service compares the roles that user has on the project (as indicated by the roles in the token), +against the roles required for the API in question (as defined in the service’s policy file). A user obtains roles +on a project by having these assigned to them via the Identity service API. -.. sample:: Identity/v3/roles/add_role.php -.. refdoc:: OpenStack/Identity/v3/Models/Project.html#method_createRole +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#roles -List roles ----------- +.. |models| replace:: roles -.. sample:: Identity/v3/roles/list_roles.php -.. refdoc:: OpenStack/Identity/v3/Models/Project.html#method_listRoles +.. include:: /common/service.rst + +Create +------ + +.. sample:: Identity/v3/roles/create.php + +List +---- + +.. sample:: Identity/v3/roles/list.php List role assignments --------------------- .. sample:: Identity/v3/roles/list_assignments.php -.. refdoc:: OpenStack/Identity/v3/Models/Project.html#method_listRoleAssignments diff --git a/doc/services/identity/v3/services.rst b/doc/services/identity/v3/services.rst index 39276162e..338ce18fb 100644 --- a/doc/services/identity/v3/services.rst +++ b/doc/services/identity/v3/services.rst @@ -1,26 +1,35 @@ Services ======== -Add service ------------ +A service is an OpenStack web service that you can access through a URL, i.e. an endpoint. -.. sample:: Identity/v3/services/add_service.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createService +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#roles -List services -------------- +.. |models| replace:: services -.. sample:: Identity/v3/services/list_services.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listServices +.. include:: /common/service.rst -Show service details --------------------- +Create +------ -.. sample:: Identity/v3/services/get_service.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getService +.. sample:: Identity/v3/services/create.php -Delete service --------------- +Read +---- -.. sample:: Identity/v3/services/delete_service.php -.. refdoc:: OpenStack/Identity/v3/Models/Service.html#method_delete \ No newline at end of file +.. sample:: Identity/v3/services/read.php + +Update +------ + +.. sample:: Identity/v3/services/update.php + +Delete +------ + +.. sample:: Identity/v3/services/delete.php + +List +---- + +.. sample:: Identity/v3/services/list.php diff --git a/doc/services/identity/v3/tokens.rst b/doc/services/identity/v3/tokens.rst index 4802065a0..26cde921b 100644 --- a/doc/services/identity/v3/tokens.rst +++ b/doc/services/identity/v3/tokens.rst @@ -1,11 +1,15 @@ Tokens ====== -Authenticate (generate) token ------------------------------ +Tokens are used to authenticate and authorize your interactions with OpenStack APIs. Tokens come in many scopes, +representing various authorization and sources of identity. -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createService +.. osdoc:: https://docs.openstack.org/keystone/latest/admin/tokens-overview.html +Generate token +-------------- + +Token is generated when you create the ``OpenStack`` object. You can also generate another token using the following methods. Generate token with user ID ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -15,6 +19,9 @@ Generate token with user ID Generate token with username ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Since usernames will not be unique across an entire OpenStack installation, when authenticating with them, +you must also provide your domain ID. You do not have to do this if you authenticate with a user ID. + .. sample:: Identity/v3/tokens/generate_token_with_username.php Generate token with application credential ID @@ -36,19 +43,20 @@ Generate token scoped to project ID Generate token scoped to project name ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Since project names will not be unique across an entire OpenStack installation, when authenticating with them you must +also provide your domain ID. You do not have to do this if you authenticate with a project ID. + .. sample:: Identity/v3/tokens/generate_token_scoped_to_project_name.php Validate token -------------- .. sample:: Identity/v3/tokens/validate_token.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_validateToken Revoke token ------------ .. sample:: Identity/v3/tokens/revoke_token.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_revokeToken Cache authentication token -------------------------- @@ -73,6 +81,7 @@ Generate token and persist to file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. sample:: Identity/v3/tokens/export_authentication_token.php + :full: For scalability, it is recommended that cached tokens are stored in persistent storage such as memcache or redis instead @@ -82,3 +91,4 @@ Initialize Open Stack using cached authentication token ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. sample:: Identity/v3/tokens/use_cached_authentication_token.php + :full: diff --git a/doc/services/identity/v3/users.rst b/doc/services/identity/v3/users.rst index 3453c3dc9..c11f7ee3a 100644 --- a/doc/services/identity/v3/users.rst +++ b/doc/services/identity/v3/users.rst @@ -1,44 +1,46 @@ Users ===== -Add user --------- +A user is an individual API consumer that is owned by a domain. A role explicitly associates a user with projects +or domains. A user with no assigned roles has no access to OpenStack resources. -.. sample:: Identity/v3/users/add_user.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_createUser +.. osdoc:: https://docs.openstack.org/api-ref/identity/v3/index.html#users -List users ----------- +.. |models| replace:: users -.. sample:: Identity/v3/users/list_users.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_listUsers +.. include:: /common/service.rst -Show user details ------------------ +Create +------ -.. sample:: Identity/v3/users/get_user.php -.. refdoc:: OpenStack/Identity/v3/Service.html#method_getUser +.. sample:: Identity/v3/users/create.php -Update user ------------ +Read +---- -.. sample:: Identity/v3/users/update_user.php -.. refdoc:: OpenStack/Identity/v3/Models/User.html#method_update +.. sample:: Identity/v3/users/read.php -Delete user ------------ +Update +------ -.. sample:: Identity/v3/users/delete_user.php -.. refdoc:: OpenStack/Identity/v3/Models/User.html#method_delete +.. sample:: Identity/v3/users/update.php + +Delete +------ + +.. sample:: Identity/v3/users/delete.php + +List +---- + +.. sample:: Identity/v3/users/list.php List groups for user -------------------- .. sample:: Identity/v3/users/list_groups.php -.. refdoc:: OpenStack/Identity/v3/Models/User.html#method_listGroups List projects for user ---------------------- .. sample:: Identity/v3/users/list_projects.php -.. refdoc:: OpenStack/Identity/v3/Models/User.html#method_listProjects diff --git a/doc/services/images/v2/create.rst b/doc/services/images/v2/create.rst new file mode 100644 index 000000000..b54151077 --- /dev/null +++ b/doc/services/images/v2/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: imagesV2 + +.. include:: /common/create-service.rst diff --git a/doc/services/images/v2/images.rst b/doc/services/images/v2/images.rst index d01af0195..746f44fad 100644 --- a/doc/services/images/v2/images.rst +++ b/doc/services/images/v2/images.rst @@ -1,24 +1,47 @@ Images ====== -Create image ------------- +A collection of files for a specific operating system (OS) that you use to create or rebuild a server. +OpenStack provides pre-built images. You can also create custom images, or snapshots, from servers +that you have launched. Custom images can be used for data backups or as “gold” images for additional servers. + +.. osdoc:: https://docs.openstack.org/api-ref/image/v2/index.html#images + +.. |models| replace:: images + +.. include:: /common/service.rst + +Create +------ The only required attribute when creating a new image is ``name``. .. sample:: Images/v2/images/create.php -.. refdoc:: OpenStack/Images/v2/Service.html#method_createImage -List images ------------ +Read +---- + +.. sample:: Images/v2/images/read.php + +Update +------ + +.. sample:: Images/v2/images/update.php + +Delete +------ + +.. sample:: Images/v2/images/delete.php + +List +---- .. sample:: Images/v2/images/list.php -.. refdoc:: OpenStack/Images/v2/Service.html#method_listImages .. include:: /common/generators.rst List images sorted ------------ +~~~~~~~~~~~~~~~~~~ Possible values for sort_key are: @@ -31,37 +54,17 @@ Possible values for sort_dir are: .. sample:: Images/v2/images/list_sorted.php -Show image details ------------------- - -.. sample:: Images/v2/images/get.php -.. refdoc:: OpenStack/Images/v2/Service.html#method_getImage - -Update image ------------- - -.. sample:: Images/v2/images/update.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_update - -Delete image ------------- - -.. sample:: Images/v2/images/delete.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_delete - -Reactivate image ----------------- +Reactivate +---------- .. sample:: Images/v2/images/reactivate.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_reactivate -Deactivate image ----------------- +Deactivate +---------- If you try to download a deactivated image, a Forbidden error is returned. .. sample:: Images/v2/images/deactivate.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_deactivate Upload binary data ------------------ @@ -76,10 +79,8 @@ Before you can store binary image data, you must meet the following precondition The size of the data that you want to store must not exceed the size that the Image service allows. .. sample:: Images/v2/images/upload_binary_data.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_uploadData Download binary data -------------------- .. sample:: Images/v2/images/download_binary_data.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_downloadData \ No newline at end of file diff --git a/doc/services/images/v2/index.rst b/doc/services/images/v2/index.rst index de7b32845..ef059e983 100644 --- a/doc/services/images/v2/index.rst +++ b/doc/services/images/v2/index.rst @@ -1,8 +1,14 @@ Images v2 ========= +OpenStack Image (Glance) API Version 2. The project provides a service where users can upload and discover +data assets that are meant to be used with other services. + +.. osdoc:: https://docs.openstack.org/api-ref/image/v2/index.html + .. toctree:: :maxdepth: 3 + create images members \ No newline at end of file diff --git a/doc/services/images/v2/members.rst b/doc/services/images/v2/members.rst index 08abc547c..87f8f2f06 100644 --- a/doc/services/images/v2/members.rst +++ b/doc/services/images/v2/members.rst @@ -1,34 +1,37 @@ Image Members ============= -Add member to image -------------------- +Image member is a project which can access a given VM image within Image service. -.. sample:: Images/v2/members/add.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_addMember +.. osdoc:: https://docs.openstack.org/api-ref/image/v2/index.html#sharing -List image members ------------------- +.. |models| replace:: image members -.. sample:: Images/v2/members/list.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_listMembers +.. include:: /common/service.rst -.. include:: /common/generators.rst +Create +------ -Show member details -------------------- +.. sample:: Images/v2/members/create.php -.. sample:: Images/v2/members/get.php -.. refdoc:: OpenStack/Images/v2/Models/Image.html#method_getMember +Read +---- -Remove member from image ------------------------- +.. sample:: Images/v2/members/read.php + +Delete +------ .. sample:: Images/v2/members/delete.php -.. refdoc:: OpenStack/Images/v2/Models/Member.html#method_delete -Update status of image member ------------------------------ +List +---- + +.. sample:: Images/v2/members/list.php + +.. include:: /common/generators.rst + +Update Status +------------- .. sample:: Images/v2/members/update_status.php -.. refdoc:: OpenStack/Images/v2/Models/Member.html#method_updateStatus \ No newline at end of file diff --git a/doc/services/networking/v2/create.rst b/doc/services/networking/v2/create.rst new file mode 100644 index 000000000..05f45843c --- /dev/null +++ b/doc/services/networking/v2/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: networkingV2 + +.. include:: /common/create-service.rst diff --git a/doc/services/networking/v2/index.rst b/doc/services/networking/v2/index.rst index 2b5456447..0eafffd9b 100644 --- a/doc/services/networking/v2/index.rst +++ b/doc/services/networking/v2/index.rst @@ -1,9 +1,15 @@ Networking v2 ============= +OpenStack Networking (Neutron) API Version 2. The project provides “network connectivity as a service” between +interface devices (e.g., vNICs) managed by other OpenStack services (e.g., nova). + +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html + .. toctree:: :maxdepth: 3 + create networks subnets ports diff --git a/doc/services/networking/v2/loadbalancer-healthmonitors.rst b/doc/services/networking/v2/loadbalancer-healthmonitors.rst index e383a2ff9..c177f6f46 100644 --- a/doc/services/networking/v2/loadbalancer-healthmonitors.rst +++ b/doc/services/networking/v2/loadbalancer-healthmonitors.rst @@ -1,32 +1,36 @@ LoadBalancer HealthMonitors =========================== -Create HealthMonitor --------------------- +.. warning:: + Load balancing functions accessed via the neutron endpoint are deprecated and will be removed in a future release. + Users are strongly encouraged to migrate to using the octavia endpoint. + This library does not support the octavia endpoint yet. + Consider `helping `_ us to implement it . -.. sample:: Networking/v2/lbaas/healthmonitors/create.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_createLoadBalancerHealthMonitor +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#load-balancer-as-a-service-2-0-deprecated -Get HealthMonitor ------------------ +Create +------ -.. sample:: Networking/v2/lbaas/healthmonitors/get.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_getLoadBalancerHealthMonitor +.. sample:: Networking/v2/lbaas/healthmonitors/create.php -List HealthMonitors -------------------- +Read +---- -.. sample:: Networking/v2/lbaas/healthmonitors/list.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_listLoadBalancerHealthMonitors +.. sample:: Networking/v2/lbaas/healthmonitors/read.php -Update HealthMonitor --------------------- +Update +------ .. sample:: Networking/v2/lbaas/healthmonitors/update.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerHealthMonitor.html#method_update -Delete HealthMonitor --------------------- +Delete +------ .. sample:: Networking/v2/lbaas/healthmonitors/delete.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerHealthMonitor.html#method_delete + +List +---- + +.. sample:: Networking/v2/lbaas/healthmonitors/list.php + diff --git a/doc/services/networking/v2/loadbalancer-listeners.rst b/doc/services/networking/v2/loadbalancer-listeners.rst index a99a1df53..1cc5624f5 100644 --- a/doc/services/networking/v2/loadbalancer-listeners.rst +++ b/doc/services/networking/v2/loadbalancer-listeners.rst @@ -1,32 +1,35 @@ LoadBalancer Listeners ====================== -Create Listener ---------------- +.. warning:: + Load balancing functions accessed via the neutron endpoint are deprecated and will be removed in a future release. + Users are strongly encouraged to migrate to using the octavia endpoint. + This library does not support the octavia endpoint yet. + Consider `helping `_ us to implement it . -.. sample:: Networking/v2/lbaas/listeners/create.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_createLoadBalancerListener +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#load-balancer-as-a-service-2-0-deprecated -Get Listener ------------- +Create +------ -.. sample:: Networking/v2/lbaas/listeners/get.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_getLoadBalancerListener +.. sample:: Networking/v2/lbaas/listeners/create.php -List Listeners --------------- +Read +---- -.. sample:: Networking/v2/lbaas/listeners/list.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_listLoadBalancerListeners +.. sample:: Networking/v2/lbaas/listeners/read.php -Update Listener ---------------- +Update +------ .. sample:: Networking/v2/lbaas/listeners/update.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerListener.html#method_update -Delete Listener ---------------- +Delete +------ .. sample:: Networking/v2/lbaas/listeners/delete.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerListener.html#method_delete + +List +---- + +.. sample:: Networking/v2/lbaas/listeners/list.php diff --git a/doc/services/networking/v2/loadbalancer-pools.rst b/doc/services/networking/v2/loadbalancer-pools.rst index 891b487da..7100b55ed 100644 --- a/doc/services/networking/v2/loadbalancer-pools.rst +++ b/doc/services/networking/v2/loadbalancer-pools.rst @@ -1,56 +1,55 @@ LoadBalancer Pools ================== -Create Pool ------------ +.. warning:: + Load balancing functions accessed via the neutron endpoint are deprecated and will be removed in a future release. + Users are strongly encouraged to migrate to using the octavia endpoint. + This library does not support the octavia endpoint yet. + Consider `helping `_ us to implement it . + +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#load-balancer-as-a-service-2-0-deprecated + +Create +------ .. sample:: Networking/v2/lbaas/pools/create.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_createLoadBalancerPool -Get Pool --------- +Read +---- -.. sample:: Networking/v2/lbaas/pools/get.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_getLoadBalancerPool +.. sample:: Networking/v2/lbaas/pools/read.php -List Pools ----------- +List +---- .. sample:: Networking/v2/lbaas/pools/list.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_listLoadBalancerPools -Update Pool +Update ----------- .. sample:: Networking/v2/lbaas/pools/update.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_update -Delete Pool ------------ +Delete +------ .. sample:: Networking/v2/lbaas/pools/delete.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_delete Add Member ---------- .. sample:: Networking/v2/lbaas/pools/add-member.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_addMember Get Member ---------- .. sample:: Networking/v2/lbaas/pools/get-member.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_getMember Delete Member ------------- .. sample:: Networking/v2/lbaas/pools/delete-member.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_deleteMember Add Health Monitor ------------------ .. sample:: Networking/v2/lbaas/pools/add-healthmonitor.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancerPool.html#method_addHealthMonitor diff --git a/doc/services/networking/v2/loadbalancers.rst b/doc/services/networking/v2/loadbalancers.rst index a04ae8152..7185b39f4 100644 --- a/doc/services/networking/v2/loadbalancers.rst +++ b/doc/services/networking/v2/loadbalancers.rst @@ -1,47 +1,54 @@ LoadBalancers ============= -Create LoadBalancer -------------------- +.. warning:: + Load balancing functions accessed via the neutron endpoint are deprecated and will be removed in a future release. + Users are strongly encouraged to migrate to using the octavia endpoint. + This library does not support the octavia endpoint yet. + Consider `helping `_ us to implement it . -.. sample:: Networking/v2/lbaas/loadbalancers/create.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_createLoadBalancer +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#load-balancer-as-a-service-2-0-deprecated -Get LoadBalancer ----------------- +.. |models| replace:: load balancers -.. sample:: Networking/v2/lbaas/loadbalancers/get.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_getLoadBalancer +.. include:: /common/service.rst -List LoadBalancers ------------------- +Create +------ -.. sample:: Networking/v2/lbaas/loadbalancers/list.php -.. refdoc:: OpenStack/Networking/v2/Service.html#method_listLoadBalancers +.. sample:: Networking/v2/lbaas/loadbalancers/create.php -Update LoadBalancer -------------------- +Read +---- + +.. sample:: Networking/v2/lbaas/loadbalancers/read.php + +Update +------ .. sample:: Networking/v2/lbaas/loadbalancers/update.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancer.html#method_update -Delete LoadBalancer -------------------- +Delete +------ .. sample:: Networking/v2/lbaas/loadbalancers/delete.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancer.html#method_delete -Add Listener to LoadBalancer ----------------------------- +List +---- + +.. sample:: Networking/v2/lbaas/loadbalancers/list.php + +Add Listener +------------ + .. sample:: Networking/v2/lbaas/loadbalancers/add_listener.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancer.html#method_addListener -Get Stats for LoadBalancer --------------------------- +Get Stats +--------- + .. sample:: Networking/v2/lbaas/loadbalancers/get_stats.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancer.html#method_getStats -Get Status Tree for LoadBalancer +Get Status Tree -------------------------------- + .. sample:: Networking/v2/lbaas/loadbalancers/get_statuses.php -.. refdoc:: OpenStack/Networking/v2/Models/LoadBalancer.html#method_getStatuses diff --git a/doc/services/networking/v2/networks.rst b/doc/services/networking/v2/networks.rst index 27719c397..f066427ab 100644 --- a/doc/services/networking/v2/networks.rst +++ b/doc/services/networking/v2/networks.rst @@ -1,32 +1,38 @@ Networks ======== -Create network +Network represents an isolated Layer-2 networking segment within the cloud. It can be shared across tenants, +or isolated to a single tenant. + +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#layer-2-networking + +.. |models| replace:: networks + +.. include:: /common/service.rst + +Create -------------- .. sample:: Networking/v2/networks/create.php -.. refdoc:: OpenStack/Networking/v2/networks/Service.html#method_createNetwork -Create networks ---------------- +Batch +~~~~~ + +To create multiple networks in a single request, use the following code: .. sample:: Networking/v2/networks/create_batch.php -.. refdoc:: OpenStack/Networking/v2/networks/Service.html#method_createNetworks -Get network ------------ +Read +---- -.. sample:: Networking/v2/networks/get.php -.. refdoc:: OpenStack/Networking/v2/networks/Service.html#method_getNetwork +.. sample:: Networking/v2/networks/read.php -Update network --------------- +Update +------ .. sample:: Networking/v2/networks/update.php -.. refdoc:: OpenStack/Networking/v2/networks/Models/Network.html#method_update -Delete network --------------- +Delete +------ .. sample:: Networking/v2/networks/delete.php -.. refdoc:: OpenStack/Networking/v2/networks/Models/Network.html#method_delete \ No newline at end of file diff --git a/doc/services/networking/v2/ports.rst b/doc/services/networking/v2/ports.rst index 7efc7e909..34011301c 100644 --- a/doc/services/networking/v2/ports.rst +++ b/doc/services/networking/v2/ports.rst @@ -1,32 +1,38 @@ Ports ===== -Create port ------------ +A port is a connection point for attaching a single device, such as the NIC of a virtual server, to a virtual network. +The port also describes the associated network configuration, such as the MAC and IP addresses to be used on that port. + +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#ports + +.. |models| replace:: ports + +.. include:: /common/service.rst + +Create +------ .. sample:: Networking/v2/ports/create.php -.. refdoc:: OpenStack/Networking/v2/ports/Service.html#method_createPort -Create ports ------------- +Batch +~~~~~ + +To create multiple ports in a single request, use the following code: .. sample:: Networking/v2/ports/create_batch.php -.. refdoc:: OpenStack/Networking/v2/ports/Service.html#method_createPorts -Get port --------- +Read +---- -.. sample:: Networking/v2/ports/get.php -.. refdoc:: OpenStack/Networking/v2/ports/Service.html#method_getPort +.. sample:: Networking/v2/ports/read.php -Update port ------------ +Update +------ .. sample:: Networking/v2/ports/update.php -.. refdoc:: OpenStack/Networking/v2/ports/Models/Port.html#method_update -Delete port ------------ +Delete +------ .. sample:: Networking/v2/ports/delete.php -.. refdoc:: OpenStack/Networking/v2/ports/Models/Port.html#method_delete \ No newline at end of file diff --git a/doc/services/networking/v2/subnets.rst b/doc/services/networking/v2/subnets.rst index 39b50901e..bbd92196d 100644 --- a/doc/services/networking/v2/subnets.rst +++ b/doc/services/networking/v2/subnets.rst @@ -1,34 +1,42 @@ Subnets ======= -Create subnet -------------- +A block of IP addresses and associated configuration state. This is also known as the native IPAM (IP Address Management) +provided by the networking service for both project and provider networks. Subnets are used to allocate IP addresses +when new ports are created on a network. + +.. osdoc:: https://docs.openstack.org/api-ref/network/v2/index.html#subnets + +.. |models| replace:: subnets + +.. include:: /common/service.rst + +Create +------ .. sample:: Networking/v2/subnets/create.php -.. refdoc:: OpenStack/Networking/v2/subnets/Service.html#method_createSubnet -To create a subnet with gateway IP: +With gateway IP +~~~~~~~~~~~~~~~ .. sample:: Networking/v2/subnets/create_with_gateway_ip.php -To create a subnet with host routes: +With host routes +~~~~~~~~~~~~~~~~ .. sample:: Networking/v2/subnets/create_with_host_routes.php -Get subnet ----------- +Read +---- -.. sample:: Networking/v2/subnets/get.php -.. refdoc:: OpenStack/Networking/v2/subnets/Service.html#method_getSubnet +.. sample:: Networking/v2/subnets/read.php -Update subnet -------------- +Update +------ .. sample:: Networking/v2/subnets/update.php -.. refdoc:: OpenStack/Networking/v2/subnets/Models/Subnet.html#method_update -Delete subnet -------------- +Delete +------ .. sample:: Networking/v2/subnets/delete.php -.. refdoc:: OpenStack/Networking/v2/subnets/Models/Subnet.html#method_delete \ No newline at end of file diff --git a/doc/services/object-store/v1/account.rst b/doc/services/object-store/v1/account.rst index 12a4a31ed..bf33c1ce4 100644 --- a/doc/services/object-store/v1/account.rst +++ b/doc/services/object-store/v1/account.rst @@ -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 ------------------------------------ @@ -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 \ No newline at end of file diff --git a/doc/services/object-store/v1/containers.rst b/doc/services/object-store/v1/containers.rst index 18b2d6567..a1dbb384a 100644 --- a/doc/services/object-store/v1/containers.rst +++ b/doc/services/object-store/v1/containers.rst @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/doc/services/object-store/v1/create.rst b/doc/services/object-store/v1/create.rst new file mode 100644 index 000000000..07800c766 --- /dev/null +++ b/doc/services/object-store/v1/create.rst @@ -0,0 +1,3 @@ +.. |method| replace:: objectStoreV1 + +.. include:: /common/create-service.rst diff --git a/doc/services/object-store/v1/index.rst b/doc/services/object-store/v1/index.rst index a6637dbcc..5d699059a 100644 --- a/doc/services/object-store/v1/index.rst +++ b/doc/services/object-store/v1/index.rst @@ -1,9 +1,15 @@ Object Store v1 =============== +Object store (Swift) API Version 1. Swift is a highly available, distributed, eventually consistent object/blob store. +Organizations can use Swift to store lots of data efficiently, safely, and cheaply. + +.. osdoc:: https://docs.openstack.org/api-ref/object-store/ + .. toctree:: - :maxdepth: 3 + :maxdepth: 3 - account - containers - objects \ No newline at end of file + create + account + containers + objects \ No newline at end of file diff --git a/doc/services/object-store/v1/objects.rst b/doc/services/object-store/v1/objects.rst index 7b326b153..696869551 100644 --- a/doc/services/object-store/v1/objects.rst +++ b/doc/services/object-store/v1/objects.rst @@ -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 @@ -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 diff --git a/doc/setup.rst b/doc/setup.rst new file mode 100644 index 000000000..96fa29571 --- /dev/null +++ b/doc/setup.rst @@ -0,0 +1,43 @@ +Setup +===== + +In order to access services you have to create the client object. To do it, you will need to provide the +following information: + +* The identity service URL (``authUrl``) +* The region in which you want to operate (``region``) +* The credentials of the user you want to authenticate: ``user``, ``tokenId``, ``cachedToken`` + or ``application_credential`` + +Only the ``authUrl`` is mandatory to create the client. But you will have to provide the ``region`` and user +credentials to each service you create. So it is recommended to provide them when creating the client which +would propagate these options to each service. + +There are different ways to provide the authentication credentials. See the :doc:`services/identity/v3/tokens` +section for the full list of options. You should provide credentials to the ``OpenStack`` constructor as an array +the same way you provide options to ``generateToken`` method of the ``Identity`` service. + +Authenticate with username +-------------------------- + +The most common way to authenticate is using the username and password of the user. You should also provide the Domain ID +as usernames will not be unique across an entire OpenStack installation + +.. sample:: Setup/username.php + +Authenticate with user ID +------------------------- + +.. sample:: Setup/user_id.php + +Authenticate application credential ID +-------------------------------------- + +.. sample:: Setup/application_credential_id.php + +Authenticate using token ID +--------------------------- + +If you already have a valid token, you can use it to authenticate. + +.. sample:: Setup/token_id.php diff --git a/samples/ObjectStore/v1/containers/get.php b/samples/BlockStorage/v2/create.php similarity index 59% rename from samples/ObjectStore/v1/containers/get.php rename to samples/BlockStorage/v2/create.php index 8d764cd5d..eab4bfb9d 100644 --- a/samples/ObjectStore/v1/containers/get.php +++ b/samples/BlockStorage/v2/create.php @@ -9,9 +9,6 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$container = $openstack->objectStoreV1() - ->getContainer('{containerName}'); -$container->retrieve(); +$service = $openstack->blockStorageV2(); diff --git a/samples/BlockStorage/v2/create_service.php b/samples/BlockStorage/v2/create_service.php deleted file mode 100644 index fbed17dcf..000000000 --- a/samples/BlockStorage/v2/create_service.php +++ /dev/null @@ -1,12 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volume_types/create.php b/samples/BlockStorage/v3/volume_types/create.php index 92a8eb459..abed4941d 100644 --- a/samples/BlockStorage/v3/volume_types/create.php +++ b/samples/BlockStorage/v3/volume_types/create.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}'] + , ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volume_types/delete.php b/samples/BlockStorage/v3/volume_types/delete.php index c8a68b756..f0e9a2f7a 100644 --- a/samples/BlockStorage/v3/volume_types/delete.php +++ b/samples/BlockStorage/v3/volume_types/delete.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}'] + , ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volume_types/list.php b/samples/BlockStorage/v3/volume_types/list.php index 288a183ee..238572891 100644 --- a/samples/BlockStorage/v3/volume_types/list.php +++ b/samples/BlockStorage/v3/volume_types/list.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}'] + , ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volume_types/get.php b/samples/BlockStorage/v3/volume_types/read.php similarity index 66% rename from samples/BlockStorage/v3/volume_types/get.php rename to samples/BlockStorage/v3/volume_types/read.php index fc86ab574..b254c8eaf 100644 --- a/samples/BlockStorage/v3/volume_types/get.php +++ b/samples/BlockStorage/v3/volume_types/read.php @@ -5,10 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}'] + , ]); $service = $openstack->blockStorageV3(); $volumeType = $service->getVolumeType('{volumeTypeId}'); +$volumeType->retrieve(); \ No newline at end of file diff --git a/samples/BlockStorage/v3/volume_types/update.php b/samples/BlockStorage/v3/volume_types/update.php index edcd9dec4..bdd08ab5c 100644 --- a/samples/BlockStorage/v3/volume_types/update.php +++ b/samples/BlockStorage/v3/volume_types/update.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}'] + , ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volumes/create.php b/samples/BlockStorage/v3/volumes/create.php index b8fd93081..0af2293bd 100644 --- a/samples/BlockStorage/v3/volumes/create.php +++ b/samples/BlockStorage/v3/volumes/create.php @@ -5,16 +5,18 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); $volume = $service->createVolume([ - 'description' => '{description}', - 'size' => '{size}', - 'name' => '{name}', - 'volumeType' => '{volumeType}', - 'metadata' => ['{key1}' => '{val1}'], + 'description' => '{description}', + 'size' => '{size}', + 'name' => '{name}', + 'volumeType' => '{volumeType}', + 'metadata' => ['{key1}' => '{val1}'], ]); diff --git a/samples/BlockStorage/v3/volumes/create_from_image.php b/samples/BlockStorage/v3/volumes/create_from_image.php index 81d36d9ee..b561c353d 100644 --- a/samples/BlockStorage/v3/volumes/create_from_image.php +++ b/samples/BlockStorage/v3/volumes/create_from_image.php @@ -5,15 +5,17 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); $volume = $service->createVolume([ - 'description' => '{description}', - 'size' => '{size}', - 'name' => '{name}', - 'sourceVolumeId' => '{snapshotId}', + 'description' => '{description}', + 'size' => '{size}', + 'name' => '{name}', + 'imageId' => '{imageId}', ]); diff --git a/samples/BlockStorage/v3/volumes/create_from_snapshot.php b/samples/BlockStorage/v3/volumes/create_from_snapshot.php index a88c2d442..2c9de9c81 100644 --- a/samples/BlockStorage/v3/volumes/create_from_snapshot.php +++ b/samples/BlockStorage/v3/volumes/create_from_snapshot.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volumes/create_from_source_volume.php b/samples/BlockStorage/v3/volumes/create_from_source_volume.php deleted file mode 100644 index 571e12318..000000000 --- a/samples/BlockStorage/v3/volumes/create_from_source_volume.php +++ /dev/null @@ -1,19 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$service = $openstack->blockStorageV3(); - -$volume = $service->createVolume([ - 'description' => '{description}', - 'size' => '{size}', - 'name' => '{name}', - 'imageId' => '{snapshotId}', -]); diff --git a/samples/BlockStorage/v3/volumes/create_from_volume.php b/samples/BlockStorage/v3/volumes/create_from_volume.php new file mode 100644 index 000000000..a72ed00c5 --- /dev/null +++ b/samples/BlockStorage/v3/volumes/create_from_volume.php @@ -0,0 +1,21 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->blockStorageV3(); + +$volume = $service->createVolume([ + 'description' => '{description}', + 'size' => '{size}', + 'name' => '{name}', + 'sourceVolumeId' => '{volumeId}', +]); diff --git a/samples/BlockStorage/v3/volumes/delete.php b/samples/BlockStorage/v3/volumes/delete.php index 1821ca9e1..8776244f0 100644 --- a/samples/BlockStorage/v3/volumes/delete.php +++ b/samples/BlockStorage/v3/volumes/delete.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volumes/list.php b/samples/BlockStorage/v3/volumes/list.php index a067b304a..5f88fa843 100644 --- a/samples/BlockStorage/v3/volumes/list.php +++ b/samples/BlockStorage/v3/volumes/list.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volumes/list_detail.php b/samples/BlockStorage/v3/volumes/list_detail.php index e495fbc32..2029d32ce 100644 --- a/samples/BlockStorage/v3/volumes/list_detail.php +++ b/samples/BlockStorage/v3/volumes/list_detail.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); diff --git a/samples/BlockStorage/v3/volumes/get.php b/samples/BlockStorage/v3/volumes/read.php similarity index 65% rename from samples/BlockStorage/v3/volumes/get.php rename to samples/BlockStorage/v3/volumes/read.php index 184c02afd..d1de298e6 100644 --- a/samples/BlockStorage/v3/volumes/get.php +++ b/samples/BlockStorage/v3/volumes/read.php @@ -5,10 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); $volume = $service->getVolume('{volumeId}'); +$volume->retrieve(); \ No newline at end of file diff --git a/samples/BlockStorage/v3/volumes/update.php b/samples/BlockStorage/v3/volumes/update.php index 371d12e87..d2ead417b 100644 --- a/samples/BlockStorage/v3/volumes/update.php +++ b/samples/BlockStorage/v3/volumes/update.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']], + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->blockStorageV3(); diff --git a/samples/Compute/v2/flavors/create_flavor.php b/samples/Compute/v2/flavors/create.php similarity index 69% rename from samples/Compute/v2/flavors/create_flavor.php rename to samples/Compute/v2/flavors/create.php index ee88ba579..0dc5ff191 100644 --- a/samples/Compute/v2/flavors/create_flavor.php +++ b/samples/Compute/v2/flavors/create.php @@ -7,12 +7,11 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); $flavor = $compute->createFlavor([ 'name' => '{flavorName}', diff --git a/samples/Compute/v2/flavors/delete_flavor.php b/samples/Compute/v2/flavors/delete.php similarity index 78% rename from samples/Compute/v2/flavors/delete_flavor.php rename to samples/Compute/v2/flavors/delete.php index 53d201179..91828cde4 100644 --- a/samples/Compute/v2/flavors/delete_flavor.php +++ b/samples/Compute/v2/flavors/delete.php @@ -7,13 +7,11 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $compute = $openstack->computeV2(['region' => '{region}']); - $flavor = $compute->getFlavor(['id' => '{flavorId}']); $flavor->delete(); diff --git a/samples/Compute/v2/flavors/get_flavor.php b/samples/Compute/v2/flavors/get_flavor.php deleted file mode 100644 index acaa4dc24..000000000 --- a/samples/Compute/v2/flavors/get_flavor.php +++ /dev/null @@ -1,24 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$compute = $openstack->computeV2(['region' => '{region}']); - -$flavor = $compute->getFlavor(['id' => '{flavorId}']); - -// By default, this will return an empty Flavor object and NOT hit the API. -// This is convenient for when you want to use the object for operations -// that do not require an initial GET request. To retrieve the flavor's details, -// run the following, which *will* call the API with a GET request: - -$flavor->retrieve(); diff --git a/samples/Compute/v2/flavors/list_flavors.php b/samples/Compute/v2/flavors/list.php similarity index 68% rename from samples/Compute/v2/flavors/list_flavors.php rename to samples/Compute/v2/flavors/list.php index b14eaaeec..7b7730faf 100644 --- a/samples/Compute/v2/flavors/list_flavors.php +++ b/samples/Compute/v2/flavors/list.php @@ -7,12 +7,11 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); $flavors = $compute->listFlavors(); diff --git a/samples/ObjectStore/v1/account/get.php b/samples/Compute/v2/flavors/read.php similarity index 64% rename from samples/ObjectStore/v1/account/get.php rename to samples/Compute/v2/flavors/read.php index 0c4a1d681..9ce8edbda 100644 --- a/samples/ObjectStore/v1/account/get.php +++ b/samples/Compute/v2/flavors/read.php @@ -9,8 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$account = $openstack->objectStoreV1() - ->getAccount(); +$compute = $openstack->computeV2(); + +$flavor = $compute->getFlavor(['id' => '{flavorId}']); +$flavor->retrieve(); diff --git a/samples/Compute/v2/servers/create_server.php b/samples/Compute/v2/servers/create.php similarity index 85% rename from samples/Compute/v2/servers/create_server.php rename to samples/Compute/v2/servers/create.php index 73a9fc06a..e99355e03 100644 --- a/samples/Compute/v2/servers/create_server.php +++ b/samples/Compute/v2/servers/create.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); $options = [ // Required diff --git a/samples/Compute/v2/servers/delete_server.php b/samples/Compute/v2/servers/delete.php similarity index 72% rename from samples/Compute/v2/servers/delete_server.php rename to samples/Compute/v2/servers/delete.php index 48bf850f5..58cd4a3a1 100644 --- a/samples/Compute/v2/servers/delete_server.php +++ b/samples/Compute/v2/servers/delete.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); $server = $compute->getServer(['id' => '{serverId}']); diff --git a/samples/Compute/v2/servers/get_server.php b/samples/Compute/v2/servers/get_server.php deleted file mode 100644 index 7ba12d3c1..000000000 --- a/samples/Compute/v2/servers/get_server.php +++ /dev/null @@ -1,24 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$compute = $openstack->computeV2(['region' => '{region}']); - -$server = $compute->getServer(['id' => '{serverId}']); - -// By default, this will return an empty Server object and NOT hit the API. -// This is convenient for when you want to use the object for operations -// that do not require an initial GET request. To retrieve the server's details, -// run the following, which *will* call the API with a GET request: - -$server->retrieve(); diff --git a/samples/Compute/v2/servers/list_servers.php b/samples/Compute/v2/servers/list.php similarity index 60% rename from samples/Compute/v2/servers/list_servers.php rename to samples/Compute/v2/servers/list.php index f853af64a..f96bd4a46 100644 --- a/samples/Compute/v2/servers/list_servers.php +++ b/samples/Compute/v2/servers/list.php @@ -9,12 +9,11 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); -$servers = $compute->listServers(['imageId' => '{imageId}']); +$servers = $compute->listServers(); foreach ($servers as $server) { } diff --git a/samples/ObjectStore/v1/objects/get.php b/samples/Compute/v2/servers/read.php similarity index 58% rename from samples/ObjectStore/v1/objects/get.php rename to samples/Compute/v2/servers/read.php index aeae0ad7d..442086c6f 100644 --- a/samples/ObjectStore/v1/objects/get.php +++ b/samples/Compute/v2/servers/read.php @@ -9,9 +9,9 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$object = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}'); +$compute = $openstack->computeV2(); + +$server = $compute->getServer(['id' => '{serverId}']); +$server->retrieve(); diff --git a/samples/Compute/v2/servers/update_server.php b/samples/Compute/v2/servers/update.php similarity index 54% rename from samples/Compute/v2/servers/update_server.php rename to samples/Compute/v2/servers/update.php index 088d586fd..1ee83ed78 100644 --- a/samples/Compute/v2/servers/update_server.php +++ b/samples/Compute/v2/servers/update.php @@ -7,16 +7,13 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$compute = $openstack->computeV2(['region' => '{region}']); +$compute = $openstack->computeV2(); -$server = $compute->getServer([ - 'id' => '{serverId}', -]); +$server = $compute->getServer(['id' => '{serverId}']); $server->name = '{newName}'; $server->update(); diff --git a/samples/Identity/v2/authentication.php b/samples/Identity/v2/authentication.php index 89cd14d15..eb03c73d1 100644 --- a/samples/Identity/v2/authentication.php +++ b/samples/Identity/v2/authentication.php @@ -24,8 +24,6 @@ 'identityService' => Service::factory($httpClient), ]; -/** @var OpenStack $openstack */ $openstack = new OpenStack($options); -/** @var \OpenStack\Compute\v2\Models\Server[] $servers */ $servers = $openstack->computeV2()->listServers(); diff --git a/samples/Identity/v3/application_credentials/add_application_credential.php b/samples/Identity/v3/application_credentials/create.php similarity index 73% rename from samples/Identity/v3/application_credentials/add_application_credential.php rename to samples/Identity/v3/application_credentials/create.php index ae92e3766..be71f0427 100644 --- a/samples/Identity/v3/application_credentials/add_application_credential.php +++ b/samples/Identity/v3/application_credentials/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $user = $identity->getUser('{userId}'); $applicationCredential = $user->createApplicationCredential([ diff --git a/samples/Identity/v3/application_credentials/delete_application_credential.php b/samples/Identity/v3/application_credentials/delete.php similarity index 72% rename from samples/Identity/v3/application_credentials/delete_application_credential.php rename to samples/Identity/v3/application_credentials/delete.php index 23619cce2..5ce70855b 100644 --- a/samples/Identity/v3/application_credentials/delete_application_credential.php +++ b/samples/Identity/v3/application_credentials/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $user = $identity->getUser('{userId}'); $applicationCredential = $user->getApplicationCredential('{applicationCredentialId}'); diff --git a/samples/Identity/v3/application_credentials/show_application_credential.php b/samples/Identity/v3/application_credentials/read.php similarity index 72% rename from samples/Identity/v3/application_credentials/show_application_credential.php rename to samples/Identity/v3/application_credentials/read.php index 704c63d34..a7db5f800 100644 --- a/samples/Identity/v3/application_credentials/show_application_credential.php +++ b/samples/Identity/v3/application_credentials/read.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $user = $identity->getUser('{userId}'); $applicationCredential = $user->getApplicationCredential('{applicationCredentialId}'); diff --git a/samples/Identity/v3/credentials/add_cred.php b/samples/Identity/v3/credentials/create.php similarity index 77% rename from samples/Identity/v3/credentials/add_cred.php rename to samples/Identity/v3/credentials/create.php index 765638794..339f5d8bf 100644 --- a/samples/Identity/v3/credentials/add_cred.php +++ b/samples/Identity/v3/credentials/create.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $credential = $identity->createCredential([ 'blob' => '{blob}', diff --git a/samples/Identity/v3/credentials/delete_cred.php b/samples/Identity/v3/credentials/delete.php similarity index 72% rename from samples/Identity/v3/credentials/delete_cred.php rename to samples/Identity/v3/credentials/delete.php index 6b5bfef34..09b6fe433 100644 --- a/samples/Identity/v3/credentials/delete_cred.php +++ b/samples/Identity/v3/credentials/delete.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $credential = $identity->getCredential('credentialId'); $credential->delete(); diff --git a/samples/Identity/v3/credentials/get_cred.php b/samples/Identity/v3/credentials/get_cred.php deleted file mode 100644 index b06ba11c4..000000000 --- a/samples/Identity/v3/credentials/get_cred.php +++ /dev/null @@ -1,18 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$identity = $openstack->identityV3(['region' => '{region}']); - -$credential = $identity->getCredential('credentialId'); -$credential->retrieve(); diff --git a/samples/Identity/v3/credentials/list_creds.php b/samples/Identity/v3/credentials/list.php similarity index 75% rename from samples/Identity/v3/credentials/list_creds.php rename to samples/Identity/v3/credentials/list.php index 6ed4a38e8..8f8041f9a 100644 --- a/samples/Identity/v3/credentials/list_creds.php +++ b/samples/Identity/v3/credentials/list.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listCredentials() as $credential) { /** @var $credential \OpenStack\Identity\v3\Models\Credential */ diff --git a/samples/Identity/v3/credentials/read.php b/samples/Identity/v3/credentials/read.php new file mode 100644 index 000000000..c03e8de04 --- /dev/null +++ b/samples/Identity/v3/credentials/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$identity = $openstack->identityV3(); + +$credential = $identity->getCredential('{credentialId}'); +$credential->retrieve(); diff --git a/samples/Identity/v3/credentials/update.php b/samples/Identity/v3/credentials/update.php new file mode 100644 index 000000000..c0b603f48 --- /dev/null +++ b/samples/Identity/v3/credentials/update.php @@ -0,0 +1,21 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$identity = $openstack->identityV3(); + +$credential = $identity->getCredential('{credentialId}'); + +$credential->type = '{type}'; +$credential->blob = '{blob}'; + +$credential->update(); diff --git a/samples/Identity/v3/credentials/update_cred.php b/samples/Identity/v3/credentials/update_cred.php deleted file mode 100644 index e8fa51b38..000000000 --- a/samples/Identity/v3/credentials/update_cred.php +++ /dev/null @@ -1,22 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$identity = $openstack->identityV3(['region' => '{region}']); - -$credential = $identity->getCredential('credentialId'); - -$credential->type = 'foo'; -$credential->blob = 'bar'; - -$credential->update(); diff --git a/samples/Identity/v3/domains/check_group_role.php b/samples/Identity/v3/domains/check_group_role.php index 1c96160da..50ca6dd6c 100644 --- a/samples/Identity/v3/domains/check_group_role.php +++ b/samples/Identity/v3/domains/check_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/check_user_role.php b/samples/Identity/v3/domains/check_user_role.php index 4f4b31522..e2bf42009 100644 --- a/samples/Identity/v3/domains/check_user_role.php +++ b/samples/Identity/v3/domains/check_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/add_domain.php b/samples/Identity/v3/domains/create.php similarity index 71% rename from samples/Identity/v3/domains/add_domain.php rename to samples/Identity/v3/domains/create.php index bd8b52392..4ff25cfef 100644 --- a/samples/Identity/v3/domains/add_domain.php +++ b/samples/Identity/v3/domains/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->createDomain([ 'description' => '{description}', diff --git a/samples/Identity/v3/domains/delete_domain.php b/samples/Identity/v3/domains/delete.php similarity index 66% rename from samples/Identity/v3/domains/delete_domain.php rename to samples/Identity/v3/domains/delete.php index 590aa36d0..fd99463b6 100644 --- a/samples/Identity/v3/domains/delete_domain.php +++ b/samples/Identity/v3/domains/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); $domain->delete(); diff --git a/samples/Identity/v3/domains/grant_group_role.php b/samples/Identity/v3/domains/grant_group_role.php index af1bc176a..24f0e6b92 100644 --- a/samples/Identity/v3/domains/grant_group_role.php +++ b/samples/Identity/v3/domains/grant_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/grant_user_role.php b/samples/Identity/v3/domains/grant_user_role.php index c305759ed..65592911e 100644 --- a/samples/Identity/v3/domains/grant_user_role.php +++ b/samples/Identity/v3/domains/grant_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/list_domains.php b/samples/Identity/v3/domains/list.php similarity index 69% rename from samples/Identity/v3/domains/list_domains.php rename to samples/Identity/v3/domains/list.php index d08cc1c83..817c6b263 100644 --- a/samples/Identity/v3/domains/list_domains.php +++ b/samples/Identity/v3/domains/list.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listDomains() as $domain) { /** @var $domain \OpenStack\Identity\v3\Models\Domain */ diff --git a/samples/Identity/v3/domains/list_group_roles.php b/samples/Identity/v3/domains/list_group_roles.php index 1b7b89c3d..58a360ca4 100644 --- a/samples/Identity/v3/domains/list_group_roles.php +++ b/samples/Identity/v3/domains/list_group_roles.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/list_user_roles.php b/samples/Identity/v3/domains/list_user_roles.php index d9a7cfb17..c19d61f71 100644 --- a/samples/Identity/v3/domains/list_user_roles.php +++ b/samples/Identity/v3/domains/list_user_roles.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/show_domain.php b/samples/Identity/v3/domains/read.php similarity index 66% rename from samples/Identity/v3/domains/show_domain.php rename to samples/Identity/v3/domains/read.php index c84b29d56..ebd9431eb 100644 --- a/samples/Identity/v3/domains/show_domain.php +++ b/samples/Identity/v3/domains/read.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); $domain->retrieve(); diff --git a/samples/Identity/v3/domains/revoke_group_role.php b/samples/Identity/v3/domains/revoke_group_role.php index decb28fb1..394834a29 100644 --- a/samples/Identity/v3/domains/revoke_group_role.php +++ b/samples/Identity/v3/domains/revoke_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/revoke_user_role.php b/samples/Identity/v3/domains/revoke_user_role.php index fcc6ca93d..c109927ae 100644 --- a/samples/Identity/v3/domains/revoke_user_role.php +++ b/samples/Identity/v3/domains/revoke_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/domains/update_domain.php b/samples/Identity/v3/domains/update.php similarity index 68% rename from samples/Identity/v3/domains/update_domain.php rename to samples/Identity/v3/domains/update.php index 97208e19f..b3633d9b4 100644 --- a/samples/Identity/v3/domains/update_domain.php +++ b/samples/Identity/v3/domains/update.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $domain = $identity->getDomain('{domainId}'); diff --git a/samples/Identity/v3/endpoints/add_endpoint.php b/samples/Identity/v3/endpoints/create.php similarity index 76% rename from samples/Identity/v3/endpoints/add_endpoint.php rename to samples/Identity/v3/endpoints/create.php index b123bf3fd..1e774e620 100644 --- a/samples/Identity/v3/endpoints/add_endpoint.php +++ b/samples/Identity/v3/endpoints/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $endpoint = $identity->createEndpoint([ 'interface' => \OpenStack\Identity\v3\Enum::INTERFACE_INTERNAL, diff --git a/samples/Identity/v3/endpoints/delete_endpoint.php b/samples/Identity/v3/endpoints/delete.php similarity index 67% rename from samples/Identity/v3/endpoints/delete_endpoint.php rename to samples/Identity/v3/endpoints/delete.php index 56cafda7c..b25e469d7 100644 --- a/samples/Identity/v3/endpoints/delete_endpoint.php +++ b/samples/Identity/v3/endpoints/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $endpoint = $identity->getEndpoint('{endpointId}'); $endpoint->delete(); diff --git a/samples/Identity/v3/endpoints/list_endpoints.php b/samples/Identity/v3/endpoints/list.php similarity index 70% rename from samples/Identity/v3/endpoints/list_endpoints.php rename to samples/Identity/v3/endpoints/list.php index 24d39a0e4..f53612eb7 100644 --- a/samples/Identity/v3/endpoints/list_endpoints.php +++ b/samples/Identity/v3/endpoints/list.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listEndpoints() as $endpoint) { /** @var $endpoint \OpenStack\Identity\v3\Models\Endpoint */ diff --git a/samples/Identity/v3/endpoints/get_endpoint.php b/samples/Identity/v3/endpoints/read.php similarity index 65% rename from samples/Identity/v3/endpoints/get_endpoint.php rename to samples/Identity/v3/endpoints/read.php index 9d8693607..05bbc2362 100644 --- a/samples/Identity/v3/endpoints/get_endpoint.php +++ b/samples/Identity/v3/endpoints/read.php @@ -9,13 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $endpoint = $identity->getEndpoint('{endpointId}'); +$endpoint->retrieve(); diff --git a/samples/Identity/v3/endpoints/update_endpoint.php b/samples/Identity/v3/endpoints/update.php similarity index 71% rename from samples/Identity/v3/endpoints/update_endpoint.php rename to samples/Identity/v3/endpoints/update.php index c77a0d8aa..e2fdf73a0 100644 --- a/samples/Identity/v3/endpoints/update_endpoint.php +++ b/samples/Identity/v3/endpoints/update.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $endpoint = $identity->getEndpoint('{endpointId}'); diff --git a/samples/Identity/v3/groups/add_user.php b/samples/Identity/v3/groups/add_user.php index 01c28c71d..3d8edabb8 100644 --- a/samples/Identity/v3/groups/add_user.php +++ b/samples/Identity/v3/groups/add_user.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); diff --git a/samples/Identity/v3/groups/check_user_membership.php b/samples/Identity/v3/groups/check_user_membership.php index 64caabab0..ba6d76a21 100644 --- a/samples/Identity/v3/groups/check_user_membership.php +++ b/samples/Identity/v3/groups/check_user_membership.php @@ -9,18 +9,10 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); -$result = $group->checkMembership(['userId' => '{groupUserId}']); - -if (true === $result) { -} +$hasMembership = $group->checkMembership(['userId' => '{groupUserId}']); diff --git a/samples/Identity/v3/groups/add_group.php b/samples/Identity/v3/groups/create.php similarity index 69% rename from samples/Identity/v3/groups/add_group.php rename to samples/Identity/v3/groups/create.php index b389a5b6b..66455bdbd 100644 --- a/samples/Identity/v3/groups/add_group.php +++ b/samples/Identity/v3/groups/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->createGroup([ 'description' => '{description}', diff --git a/samples/Identity/v3/groups/delete_group.php b/samples/Identity/v3/groups/delete.php similarity index 66% rename from samples/Identity/v3/groups/delete_group.php rename to samples/Identity/v3/groups/delete.php index be29565c6..d29e2012c 100644 --- a/samples/Identity/v3/groups/delete_group.php +++ b/samples/Identity/v3/groups/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); diff --git a/samples/Identity/v3/groups/list_groups.php b/samples/Identity/v3/groups/list.php similarity index 69% rename from samples/Identity/v3/groups/list_groups.php rename to samples/Identity/v3/groups/list.php index cee3577e1..5d1e038ff 100644 --- a/samples/Identity/v3/groups/list_groups.php +++ b/samples/Identity/v3/groups/list.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listGroups() as $group) { /** @var $group \OpenStack\Identity\v3\Models\Group */ diff --git a/samples/Identity/v3/groups/list_users.php b/samples/Identity/v3/groups/list_users.php index 40dc45c03..d1652b2b1 100644 --- a/samples/Identity/v3/groups/list_users.php +++ b/samples/Identity/v3/groups/list_users.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); diff --git a/samples/Identity/v3/groups/get_group.php b/samples/Identity/v3/groups/read.php similarity index 66% rename from samples/Identity/v3/groups/get_group.php rename to samples/Identity/v3/groups/read.php index da4d8f0fa..b2b3c6539 100644 --- a/samples/Identity/v3/groups/get_group.php +++ b/samples/Identity/v3/groups/read.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); $group->retrieve(); diff --git a/samples/Identity/v3/groups/remove_user.php b/samples/Identity/v3/groups/remove_user.php index 7a975c0c9..b7210ba9c 100644 --- a/samples/Identity/v3/groups/remove_user.php +++ b/samples/Identity/v3/groups/remove_user.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); diff --git a/samples/Identity/v3/groups/update_group.php b/samples/Identity/v3/groups/update.php similarity index 70% rename from samples/Identity/v3/groups/update_group.php rename to samples/Identity/v3/groups/update.php index 71f8234de..9cfabdfee 100644 --- a/samples/Identity/v3/groups/update_group.php +++ b/samples/Identity/v3/groups/update.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $group = $identity->getGroup('{groupId}'); diff --git a/samples/Identity/v3/projects/check_group_role.php b/samples/Identity/v3/projects/check_group_role.php index 0fc01cd40..1f38cd3bb 100644 --- a/samples/Identity/v3/projects/check_group_role.php +++ b/samples/Identity/v3/projects/check_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/check_user_role.php b/samples/Identity/v3/projects/check_user_role.php index 2704b4061..2d5736ae6 100644 --- a/samples/Identity/v3/projects/check_user_role.php +++ b/samples/Identity/v3/projects/check_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/add_project.php b/samples/Identity/v3/projects/create.php similarity index 71% rename from samples/Identity/v3/projects/add_project.php rename to samples/Identity/v3/projects/create.php index 0dcd0d256..f6debd3f1 100644 --- a/samples/Identity/v3/projects/add_project.php +++ b/samples/Identity/v3/projects/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->createProject([ 'description' => '{description}', diff --git a/samples/Identity/v3/projects/delete_project.php b/samples/Identity/v3/projects/delete.php similarity index 66% rename from samples/Identity/v3/projects/delete_project.php rename to samples/Identity/v3/projects/delete.php index 2ce0c3872..1401a2421 100644 --- a/samples/Identity/v3/projects/delete_project.php +++ b/samples/Identity/v3/projects/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/grant_group_role.php b/samples/Identity/v3/projects/grant_group_role.php index 8bec285cf..8fd69fde2 100644 --- a/samples/Identity/v3/projects/grant_group_role.php +++ b/samples/Identity/v3/projects/grant_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/grant_user_role.php b/samples/Identity/v3/projects/grant_user_role.php index 6acb4b74b..be3721f0e 100644 --- a/samples/Identity/v3/projects/grant_user_role.php +++ b/samples/Identity/v3/projects/grant_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/list_projects.php b/samples/Identity/v3/projects/list.php similarity index 65% rename from samples/Identity/v3/projects/list_projects.php rename to samples/Identity/v3/projects/list.php index 07890bdfc..3fc190bf8 100644 --- a/samples/Identity/v3/projects/list_projects.php +++ b/samples/Identity/v3/projects/list.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listProjects() as $project) { } diff --git a/samples/Identity/v3/projects/list_group_roles.php b/samples/Identity/v3/projects/list_group_roles.php index b678e0a78..ef64004d8 100644 --- a/samples/Identity/v3/projects/list_group_roles.php +++ b/samples/Identity/v3/projects/list_group_roles.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/list_user_roles.php b/samples/Identity/v3/projects/list_user_roles.php index 11d96f495..d943d978a 100644 --- a/samples/Identity/v3/projects/list_user_roles.php +++ b/samples/Identity/v3/projects/list_user_roles.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/get_project.php b/samples/Identity/v3/projects/read.php similarity index 66% rename from samples/Identity/v3/projects/get_project.php rename to samples/Identity/v3/projects/read.php index 8e548ade2..50d993eac 100644 --- a/samples/Identity/v3/projects/get_project.php +++ b/samples/Identity/v3/projects/read.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); $project->retrieve(); diff --git a/samples/Identity/v3/projects/revoke_group_role.php b/samples/Identity/v3/projects/revoke_group_role.php index 8011a3e5c..85e13597c 100644 --- a/samples/Identity/v3/projects/revoke_group_role.php +++ b/samples/Identity/v3/projects/revoke_group_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/revoke_user_role.php b/samples/Identity/v3/projects/revoke_user_role.php index cd9105623..b8d4c3907 100644 --- a/samples/Identity/v3/projects/revoke_user_role.php +++ b/samples/Identity/v3/projects/revoke_user_role.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/projects/update_project.php b/samples/Identity/v3/projects/update.php similarity index 68% rename from samples/Identity/v3/projects/update_project.php rename to samples/Identity/v3/projects/update.php index 862185bb3..d35b9de6e 100644 --- a/samples/Identity/v3/projects/update_project.php +++ b/samples/Identity/v3/projects/update.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $project = $identity->getProject('{id}'); diff --git a/samples/Identity/v3/roles/add_role.php b/samples/Identity/v3/roles/create.php similarity index 78% rename from samples/Identity/v3/roles/add_role.php rename to samples/Identity/v3/roles/create.php index 41a759d10..bf82ec08a 100644 --- a/samples/Identity/v3/roles/add_role.php +++ b/samples/Identity/v3/roles/create.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/roles/list_roles.php b/samples/Identity/v3/roles/list.php similarity index 80% rename from samples/Identity/v3/roles/list_roles.php rename to samples/Identity/v3/roles/list.php index a5388a36f..22e650c89 100644 --- a/samples/Identity/v3/roles/list_roles.php +++ b/samples/Identity/v3/roles/list.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/roles/list_assignments.php b/samples/Identity/v3/roles/list_assignments.php index b39543b01..9b929804a 100644 --- a/samples/Identity/v3/roles/list_assignments.php +++ b/samples/Identity/v3/roles/list_assignments.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/services/add_service.php b/samples/Identity/v3/services/create.php similarity index 69% rename from samples/Identity/v3/services/add_service.php rename to samples/Identity/v3/services/create.php index ac4a5c367..f4d24a69e 100644 --- a/samples/Identity/v3/services/add_service.php +++ b/samples/Identity/v3/services/create.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $service = $identity->createService([ 'name' => '{serviceName}', diff --git a/samples/Identity/v3/services/delete_service.php b/samples/Identity/v3/services/delete.php similarity index 66% rename from samples/Identity/v3/services/delete_service.php rename to samples/Identity/v3/services/delete.php index cdd62f457..d5c01a1de 100644 --- a/samples/Identity/v3/services/delete_service.php +++ b/samples/Identity/v3/services/delete.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $service = $identity->getService('{serviceId}'); $service->delete(); diff --git a/samples/Identity/v3/services/list_services.php b/samples/Identity/v3/services/list.php similarity index 69% rename from samples/Identity/v3/services/list_services.php rename to samples/Identity/v3/services/list.php index 8b501e1a7..e506411ff 100644 --- a/samples/Identity/v3/services/list_services.php +++ b/samples/Identity/v3/services/list.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); foreach ($identity->listServices() as $service) { /** @var $service \OpenStack\Identity\v3\Models\Service */ diff --git a/samples/Identity/v3/services/get_service.php b/samples/Identity/v3/services/read.php similarity index 67% rename from samples/Identity/v3/services/get_service.php rename to samples/Identity/v3/services/read.php index f8cf19499..65d594934 100644 --- a/samples/Identity/v3/services/get_service.php +++ b/samples/Identity/v3/services/read.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $service = $identity->getService('{serviceId}'); $service->retrieve(); diff --git a/samples/Identity/v3/services/update_service.php b/samples/Identity/v3/services/update.php similarity index 69% rename from samples/Identity/v3/services/update_service.php rename to samples/Identity/v3/services/update.php index 600c80fd6..26af68f07 100644 --- a/samples/Identity/v3/services/update_service.php +++ b/samples/Identity/v3/services/update.php @@ -9,14 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $service = $identity->getService('{serviceId}'); diff --git a/samples/Identity/v3/tokens/export_authentication_token.php b/samples/Identity/v3/tokens/export_authentication_token.php index 995a64301..818152ed3 100644 --- a/samples/Identity/v3/tokens/export_authentication_token.php +++ b/samples/Identity/v3/tokens/export_authentication_token.php @@ -10,9 +10,6 @@ 'password' => '{password}', 'domain' => ['id' => '{domainId}'] ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]; $openstack = new OpenStack\OpenStack($params); diff --git a/samples/Identity/v3/tokens/generate_token_from_id.php b/samples/Identity/v3/tokens/generate_token_from_id.php index 38821c687..b25096f2e 100644 --- a/samples/Identity/v3/tokens/generate_token_from_id.php +++ b/samples/Identity/v3/tokens/generate_token_from_id.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/tokens/generate_token_scoped_to_project_id.php b/samples/Identity/v3/tokens/generate_token_scoped_to_project_id.php index 7cfed1d2d..15960c8ae 100644 --- a/samples/Identity/v3/tokens/generate_token_scoped_to_project_id.php +++ b/samples/Identity/v3/tokens/generate_token_scoped_to_project_id.php @@ -9,9 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/tokens/generate_token_scoped_to_project_name.php b/samples/Identity/v3/tokens/generate_token_scoped_to_project_name.php index 5b84a1b16..784769412 100644 --- a/samples/Identity/v3/tokens/generate_token_scoped_to_project_name.php +++ b/samples/Identity/v3/tokens/generate_token_scoped_to_project_name.php @@ -9,17 +9,10 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); $identity = $openstack->identityV3(); -// Since project names will not be unique across an entire OpenStack installation, -// when authenticating with them you must also provide your domain ID. You do -// not have to do this if you authenticate with a project ID. - $token = $identity->generateToken([ 'user' => [ 'id' => '{userId}', diff --git a/samples/Identity/v3/tokens/generate_token_with_application_credential_id.php b/samples/Identity/v3/tokens/generate_token_with_application_credential_id.php index b64e8a288..408dba475 100644 --- a/samples/Identity/v3/tokens/generate_token_with_application_credential_id.php +++ b/samples/Identity/v3/tokens/generate_token_with_application_credential_id.php @@ -9,9 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/tokens/generate_token_with_user_id.php b/samples/Identity/v3/tokens/generate_token_with_user_id.php index 0a0b475ce..719697417 100644 --- a/samples/Identity/v3/tokens/generate_token_with_user_id.php +++ b/samples/Identity/v3/tokens/generate_token_with_user_id.php @@ -9,9 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/tokens/generate_token_with_username.php b/samples/Identity/v3/tokens/generate_token_with_username.php index 632de7363..ceb071430 100644 --- a/samples/Identity/v3/tokens/generate_token_with_username.php +++ b/samples/Identity/v3/tokens/generate_token_with_username.php @@ -10,16 +10,10 @@ 'password' => '{password}', 'domain' => ['id' => '{domainId}'] ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); $identity = $openstack->identityV3(); -// Since usernames will not be unique across an entire OpenStack installation, -// when authenticating with them, you must also provide your domain ID. You do -// not have to do this if you authenticate with a user ID. $token = $identity->generateToken([ 'user' => [ 'name' => '{username}', diff --git a/samples/Identity/v3/tokens/revoke_token.php b/samples/Identity/v3/tokens/revoke_token.php index e25882c95..de8f96753 100644 --- a/samples/Identity/v3/tokens/revoke_token.php +++ b/samples/Identity/v3/tokens/revoke_token.php @@ -10,11 +10,8 @@ 'password' => '{password}', 'domain' => ['id' => '{domainId}'] ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $identity->revokeToken('{tokenId}'); diff --git a/samples/Identity/v3/tokens/use_cached_authentication_token.php b/samples/Identity/v3/tokens/use_cached_authentication_token.php index ddc40a737..464d476dd 100644 --- a/samples/Identity/v3/tokens/use_cached_authentication_token.php +++ b/samples/Identity/v3/tokens/use_cached_authentication_token.php @@ -10,9 +10,6 @@ 'password' => '{password}', 'domain' => ['id' => '{domainId}'] ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]; $token = json_decode(file_get_contents('token.json'), true); diff --git a/samples/Identity/v3/tokens/validate_token.php b/samples/Identity/v3/tokens/validate_token.php index 7302d9655..ef9dcb59c 100644 --- a/samples/Identity/v3/tokens/validate_token.php +++ b/samples/Identity/v3/tokens/validate_token.php @@ -10,12 +10,9 @@ 'password' => '{password}', 'domain' => ['id' => '{domainId}'] ], - 'scope' => [ - 'project' => ['id' => '{projectId}'] - ] ]); -$identity = $openstack->identityV3(['region' => '{region}']); +$identity = $openstack->identityV3(); $result = $identity->validateToken('{tokenId}'); diff --git a/samples/Identity/v3/users/add_user.php b/samples/Identity/v3/users/create.php similarity index 91% rename from samples/Identity/v3/users/add_user.php rename to samples/Identity/v3/users/create.php index 892e67c71..38a066e0f 100644 --- a/samples/Identity/v3/users/add_user.php +++ b/samples/Identity/v3/users/create.php @@ -9,7 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/delete_user.php b/samples/Identity/v3/users/delete.php similarity index 78% rename from samples/Identity/v3/users/delete_user.php rename to samples/Identity/v3/users/delete.php index 3dc90d202..715a7a098 100644 --- a/samples/Identity/v3/users/delete_user.php +++ b/samples/Identity/v3/users/delete.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/list_users.php b/samples/Identity/v3/users/list.php similarity index 80% rename from samples/Identity/v3/users/list_users.php rename to samples/Identity/v3/users/list.php index b03b3a736..a52becd91 100644 --- a/samples/Identity/v3/users/list_users.php +++ b/samples/Identity/v3/users/list.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/list_groups.php b/samples/Identity/v3/users/list_groups.php index af554436c..f2156d8e1 100644 --- a/samples/Identity/v3/users/list_groups.php +++ b/samples/Identity/v3/users/list_groups.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/list_projects.php b/samples/Identity/v3/users/list_projects.php index 9e36f21eb..edae2e9d5 100644 --- a/samples/Identity/v3/users/list_projects.php +++ b/samples/Identity/v3/users/list_projects.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/get_user.php b/samples/Identity/v3/users/read.php similarity index 78% rename from samples/Identity/v3/users/get_user.php rename to samples/Identity/v3/users/read.php index df4924b4d..432da3674 100644 --- a/samples/Identity/v3/users/get_user.php +++ b/samples/Identity/v3/users/read.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Identity/v3/users/update_user.php b/samples/Identity/v3/users/update.php similarity index 81% rename from samples/Identity/v3/users/update_user.php rename to samples/Identity/v3/users/update.php index 2c4dc2b52..0bb3af762 100644 --- a/samples/Identity/v3/users/update_user.php +++ b/samples/Identity/v3/users/update.php @@ -9,11 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); $identity = $openstack->identityV3(); diff --git a/samples/Images/v2/create.php b/samples/Images/v2/create.php new file mode 100644 index 000000000..b0a98a8c8 --- /dev/null +++ b/samples/Images/v2/create.php @@ -0,0 +1,14 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->imagesV2(); diff --git a/samples/Images/v2/create_with_region.php b/samples/Images/v2/create_with_region.php new file mode 100644 index 000000000..91c5e21b7 --- /dev/null +++ b/samples/Images/v2/create_with_region.php @@ -0,0 +1,13 @@ + '{authUrl}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$service = $openstack->imagesV2(['region' => '{region}']); \ No newline at end of file diff --git a/samples/Images/v2/images/create.php b/samples/Images/v2/images/create.php index e2fec9bd3..501760a10 100644 --- a/samples/Images/v2/images/create.php +++ b/samples/Images/v2/images/create.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/images/deactivate.php b/samples/Images/v2/images/deactivate.php index fd604d64c..6b9735516 100644 --- a/samples/Images/v2/images/deactivate.php +++ b/samples/Images/v2/images/deactivate.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/images/delete.php b/samples/Images/v2/images/delete.php index 69b48eb65..8a2f31c8a 100644 --- a/samples/Images/v2/images/delete.php +++ b/samples/Images/v2/images/delete.php @@ -5,10 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$openstack->imagesV2() - ->getImage('{imageId}') - ->delete(); +$service = $openstack->imagesV2(); + +$image = $service->getImage('{imageId}'); +$image->delete(); diff --git a/samples/Images/v2/images/download_binary_data.php b/samples/Images/v2/images/download_binary_data.php index 74f434ef0..20a4a69d5 100644 --- a/samples/Images/v2/images/download_binary_data.php +++ b/samples/Images/v2/images/download_binary_data.php @@ -5,13 +5,14 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); $image = $service->getImage('{imageId}'); -/** @var \GuzzleHttp\Psr7\Stream $stream */ $stream = $image->downloadData(); diff --git a/samples/Images/v2/images/list.php b/samples/Images/v2/images/list.php index 42a714c6b..8574678b5 100644 --- a/samples/Images/v2/images/list.php +++ b/samples/Images/v2/images/list.php @@ -5,12 +5,15 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$images = $openstack->imagesV2() - ->listImages(); +$service = $openstack->imagesV2(); + +$images = $service->listImages(); foreach ($images as $image) { /** @var \OpenStack\Images\v2\Models\Image $image */ diff --git a/samples/Images/v2/images/list_sorted.php b/samples/Images/v2/images/list_sorted.php index 07f85f621..2b0f80444 100644 --- a/samples/Images/v2/images/list_sorted.php +++ b/samples/Images/v2/images/list_sorted.php @@ -5,11 +5,15 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$images = $openstack->imagesV2()->listImages(['sortKey' => '{sortKey}', 'sortDir' => '{sortDir}']); +$service = $openstack->imagesV2(); + +$images = $service->listImages(['sortKey' => '{sortKey}', 'sortDir' => '{sortDir}']); foreach ($images as $image) { /** @var \OpenStack\Images\v2\Models\Image $image */ diff --git a/samples/Images/v2/images/reactivate.php b/samples/Images/v2/images/reactivate.php index 3b7730c10..f37c3e93d 100644 --- a/samples/Images/v2/images/reactivate.php +++ b/samples/Images/v2/images/reactivate.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/images/get.php b/samples/Images/v2/images/read.php similarity index 66% rename from samples/Images/v2/images/get.php rename to samples/Images/v2/images/read.php index 680dc80b9..83c7240af 100644 --- a/samples/Images/v2/images/get.php +++ b/samples/Images/v2/images/read.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/images/update.php b/samples/Images/v2/images/update.php index 0778bcae2..dcb865375 100644 --- a/samples/Images/v2/images/update.php +++ b/samples/Images/v2/images/update.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/images/upload_binary_data.php b/samples/Images/v2/images/upload_binary_data.php index 152f55a05..ef5018a18 100644 --- a/samples/Images/v2/images/upload_binary_data.php +++ b/samples/Images/v2/images/upload_binary_data.php @@ -5,8 +5,10 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $service = $openstack->imagesV2(); diff --git a/samples/Images/v2/members/add.php b/samples/Images/v2/members/add.php deleted file mode 100644 index 092fdbba3..000000000 --- a/samples/Images/v2/members/add.php +++ /dev/null @@ -1,14 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']], -]); - -$member = $openstack->imagesV2() - ->getImage('{imageId}') - ->addMember('{projectId}'); diff --git a/samples/Images/v2/members/create.php b/samples/Images/v2/members/create.php new file mode 100644 index 000000000..dc387eeb9 --- /dev/null +++ b/samples/Images/v2/members/create.php @@ -0,0 +1,16 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->imagesV2(); +$image = $service->getImage('{imageId}'); +$member = $image->addMember('{projectId}'); diff --git a/samples/Images/v2/members/delete.php b/samples/Images/v2/members/delete.php index 6040895ad..4f3fcfa79 100644 --- a/samples/Images/v2/members/delete.php +++ b/samples/Images/v2/members/delete.php @@ -5,11 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$openstack->imagesV2() - ->getImage('{imageId}') - ->getMember('{projectId}') - ->delete(); +$service = $openstack->imagesV2(); +$image = $service->getImage('{imageId}'); +$member = $image->getMember('{projectId}'); +$member->delete(); diff --git a/samples/Images/v2/members/get.php b/samples/Images/v2/members/get.php deleted file mode 100644 index f824ead0c..000000000 --- a/samples/Images/v2/members/get.php +++ /dev/null @@ -1,14 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] -]); - -$member = $openstack->imagesV2() - ->getImage('{imageId}') - ->getMember('{tenantId}'); diff --git a/samples/Images/v2/members/list.php b/samples/Images/v2/members/list.php index fb14aa8e2..4e19cef1e 100644 --- a/samples/Images/v2/members/list.php +++ b/samples/Images/v2/members/list.php @@ -5,12 +5,14 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$image = $openstack->imagesV2() - ->getImage('{imageId}'); +$service = $openstack->imagesV2(); +$image = $service->getImage('{imageId}'); foreach ($image->listMembers() as $member) { } diff --git a/samples/Images/v2/members/read.php b/samples/Images/v2/members/read.php new file mode 100644 index 000000000..33456add2 --- /dev/null +++ b/samples/Images/v2/members/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->imagesV2(); +$image = $service->getImage('{imageId}'); +$member = $image->getMember('{projectId}'); +$member->retrieve(); diff --git a/samples/Images/v2/members/update_status.php b/samples/Images/v2/members/update_status.php index 30f33e93e..cb830df80 100644 --- a/samples/Images/v2/members/update_status.php +++ b/samples/Images/v2/members/update_status.php @@ -7,11 +7,14 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$openstack->imagesV2() - ->getImage('{imageId}') - ->getMember('{projectId}') - ->updateStatus(Member::STATUS_ACCEPTED); +$service = $openstack->imagesV2(); + +$image = $service->getImage('{imageId}'); +$member = $image->getMember('{projectId}'); +$member->updateStatus(Member::STATUS_ACCEPTED); diff --git a/samples/Networking/v2/lbaas/healthmonitors/get.php b/samples/Networking/v2/lbaas/healthmonitors/get.php deleted file mode 100644 index 1b8480621..000000000 --- a/samples/Networking/v2/lbaas/healthmonitors/get.php +++ /dev/null @@ -1,23 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] -]); - -$networking = $openstack->networkingV2(); - -// Get the health monitor -$healthmonitor = $networking->getLoadBalancerHealthMonitor('{healthmonitorId}'); -$healthmonitor->retrieve(); diff --git a/samples/Networking/v2/lbaas/healthmonitors/read.php b/samples/Networking/v2/lbaas/healthmonitors/read.php new file mode 100644 index 000000000..58ce81082 --- /dev/null +++ b/samples/Networking/v2/lbaas/healthmonitors/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$service = $openstack->networkingV2(); +$healthMonitor = $service->getLoadBalancerHealthMonitor('{healthMonitorId}'); + +$healthMonitor->retrieve(); diff --git a/samples/Networking/v2/lbaas/listeners/get.php b/samples/Networking/v2/lbaas/listeners/get.php deleted file mode 100644 index 7c9b4305a..000000000 --- a/samples/Networking/v2/lbaas/listeners/get.php +++ /dev/null @@ -1,23 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] -]); - -$networking = $openstack->networkingV2(); - -// Get the listener -$listener = $networking->getLoadBalancerListener('{listenerId}'); -$listener->retrieve(); diff --git a/samples/Networking/v2/lbaas/listeners/read.php b/samples/Networking/v2/lbaas/listeners/read.php new file mode 100644 index 000000000..cba83f946 --- /dev/null +++ b/samples/Networking/v2/lbaas/listeners/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$service = $openstack->networkingV2(); +$listener = $service->getLoadBalancerListener('{listenerId}'); + +$listener->retrieve(); diff --git a/samples/Networking/v2/lbaas/loadbalancers/get_statuses.php b/samples/Networking/v2/lbaas/loadbalancers/get_statuses.php index cd4c165dd..40e3132ed 100644 --- a/samples/Networking/v2/lbaas/loadbalancers/get_statuses.php +++ b/samples/Networking/v2/lbaas/loadbalancers/get_statuses.php @@ -18,7 +18,6 @@ $networking = $openstack->networkingV2(); -// Get the loadbalancer $lb = $networking->getLoadBalancer('{loadbalancerId}'); -$stats = $lb->getStats(); +$status = $lb->getStatuses(); diff --git a/samples/Networking/v2/lbaas/loadbalancers/get.php b/samples/Networking/v2/lbaas/loadbalancers/read.php similarity index 100% rename from samples/Networking/v2/lbaas/loadbalancers/get.php rename to samples/Networking/v2/lbaas/loadbalancers/read.php diff --git a/samples/Networking/v2/lbaas/pools/get.php b/samples/Networking/v2/lbaas/pools/read.php similarity index 59% rename from samples/Networking/v2/lbaas/pools/get.php rename to samples/Networking/v2/lbaas/pools/read.php index 734336a8b..8c48db7f8 100644 --- a/samples/Networking/v2/lbaas/pools/get.php +++ b/samples/Networking/v2/lbaas/pools/read.php @@ -9,15 +9,10 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); +$read = $openstack->networkingV2(); // Get the pool -$pool = $networking->getLoadBalancerPool('{poolId}'); +$pool = $read->getLoadBalancerPool('{poolId}'); $pool->retrieve(); diff --git a/samples/Networking/v2/networks/create.php b/samples/Networking/v2/networks/create.php index 5b7948220..e6632053d 100644 --- a/samples/Networking/v2/networks/create.php +++ b/samples/Networking/v2/networks/create.php @@ -7,21 +7,12 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$options = [ +$service = $openstack->networkingV2(); +$network = $service->createNetwork([ 'name' => '{networkName}', 'adminStateUp' => true, -]; - -// Create the network -$network = $networking->createNetwork($options); +]); diff --git a/samples/Networking/v2/networks/create_batch.php b/samples/Networking/v2/networks/create_batch.php index 4f499f8bf..07395cdda 100644 --- a/samples/Networking/v2/networks/create_batch.php +++ b/samples/Networking/v2/networks/create_batch.php @@ -7,24 +7,16 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$options = [ +$service = $openstack->networkingV2(); +$networks = $service->createNetworks([ [ - 'name' => '{networkName1}' + 'name' => '{networkName1}', ], [ - 'name' => '{networkName2}' + 'name' => '{networkName2}', ], -]; - -$networks = $networking->createNetworks($options); +]); diff --git a/samples/Networking/v2/networks/delete.php b/samples/Networking/v2/networks/delete.php index 87325d91a..3965aa15f 100644 --- a/samples/Networking/v2/networks/delete.php +++ b/samples/Networking/v2/networks/delete.php @@ -9,15 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$network = $networking->getNetwork('{networkId}'); +$service = $openstack->networkingV2(); +$network = $service->getNetwork('{networkId}'); $network->delete(); diff --git a/samples/Networking/v2/networks/get.php b/samples/Networking/v2/networks/get.php deleted file mode 100644 index bda39d2de..000000000 --- a/samples/Networking/v2/networks/get.php +++ /dev/null @@ -1,28 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] -]); - -$networking = $openstack->networkingV2(); - -$network = $networking->getNetwork('{networkId}'); - -// By default, this will return an empty Network object and NOT hit the API. -// This is convenient for when you want to use the object for operations -// that do not require an initial GET request. To retrieve the network's details, -// run the following, which *will* call the API with a GET request: - -$network->retrieve(); diff --git a/samples/Networking/v2/networks/read.php b/samples/Networking/v2/networks/read.php new file mode 100644 index 000000000..4b9dcee59 --- /dev/null +++ b/samples/Networking/v2/networks/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$service = $openstack->networkingV2(); +$network = $service->getNetwork('{networkId}'); + +$network->retrieve(); diff --git a/samples/Networking/v2/networks/update.php b/samples/Networking/v2/networks/update.php index 01e9422c9..06c03cbbd 100644 --- a/samples/Networking/v2/networks/update.php +++ b/samples/Networking/v2/networks/update.php @@ -9,16 +9,10 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$network = $networking->getNetwork('{networkId}'); +$service = $openstack->networkingV2(); +$network = $service->getNetwork('{networkId}'); $network->name = '{newName}'; $network->update(); diff --git a/samples/Networking/v2/ports/create.php b/samples/Networking/v2/ports/create.php index 285ed6522..9312d3f29 100644 --- a/samples/Networking/v2/ports/create.php +++ b/samples/Networking/v2/ports/create.php @@ -5,14 +5,16 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$port = $networking->createPort([ +$port = $service->createPort([ 'name' => '{portName}', 'networkId' => '{networkId}', - 'adminStateUp' => true + 'adminStateUp' => true, ]); diff --git a/samples/Networking/v2/ports/create_batch.php b/samples/Networking/v2/ports/create_batch.php index f5206a1e8..7c32b8114 100644 --- a/samples/Networking/v2/ports/create_batch.php +++ b/samples/Networking/v2/ports/create_batch.php @@ -5,21 +5,23 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$ports = $networking->createPorts([ +$ports = $service->createPorts([ [ 'name' => '{name1}', 'networkId' => '{networkId1}', - 'adminStateUp' => true + 'adminStateUp' => true, ], [ 'name' => '{name2}', 'networkId' => '{networkId2}', - 'adminStateUp' => true + 'adminStateUp' => true, ], ]); diff --git a/samples/Networking/v2/ports/create_with_fixed_ips.php b/samples/Networking/v2/ports/create_with_fixed_ips.php index ae28661ab..4d96884fa 100644 --- a/samples/Networking/v2/ports/create_with_fixed_ips.php +++ b/samples/Networking/v2/ports/create_with_fixed_ips.php @@ -5,13 +5,15 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$port = $networking->createPort([ +$port = $service->createPort([ 'name' => '{portName}', 'networkId' => '{networkId}', 'adminStateUp' => true, diff --git a/samples/Networking/v2/ports/delete.php b/samples/Networking/v2/ports/delete.php index 5c8f338df..2c6a8884c 100644 --- a/samples/Networking/v2/ports/delete.php +++ b/samples/Networking/v2/ports/delete.php @@ -5,11 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); +$port = $service->getPort('{portId}'); -$port = $networking->getPort('{portId}'); $port->delete(); diff --git a/samples/Networking/v2/ports/list.php b/samples/Networking/v2/ports/list.php index 0442d5662..19b8039cd 100644 --- a/samples/Networking/v2/ports/list.php +++ b/samples/Networking/v2/ports/list.php @@ -5,12 +5,14 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -foreach ($networking->listPorts() as $port) { +foreach ($service->listPorts() as $port) { /** @var \OpenStack\Networking\v2\Models\Port $port */ } diff --git a/samples/Networking/v2/ports/get.php b/samples/Networking/v2/ports/read.php similarity index 64% rename from samples/Networking/v2/ports/get.php rename to samples/Networking/v2/ports/read.php index 7e0d960c2..3e00a29e3 100644 --- a/samples/Networking/v2/ports/get.php +++ b/samples/Networking/v2/ports/read.php @@ -5,10 +5,13 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); $networking = $openstack->networkingV2(); - $port = $networking->getPort('{portId}'); + +$port->retrieve(); diff --git a/samples/Networking/v2/ports/update.php b/samples/Networking/v2/ports/update.php index a8f39e650..4d2682e35 100644 --- a/samples/Networking/v2/ports/update.php +++ b/samples/Networking/v2/ports/update.php @@ -5,12 +5,14 @@ $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', - 'user' => ['id' => '{userId}', 'password' => '{password}'], - 'scope' => ['project' => ['id' => '{projectId}']] + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); +$port = $service->getPort('{portId}'); -$port = $networking->getPort('{portId}'); $port->name = '{newName}'; $port->update(); diff --git a/samples/Networking/v2/securityGroups/create.php b/samples/Networking/v2/securityGroups/create.php index 572626d55..9da8dce0d 100644 --- a/samples/Networking/v2/securityGroups/create.php +++ b/samples/Networking/v2/securityGroups/create.php @@ -7,9 +7,8 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $networking = $openstack->networkingV2(); diff --git a/samples/Networking/v2/subnets/create_batch.php b/samples/Networking/v2/subnets/create_batch.php index 79c60aabe..5d4599c48 100644 --- a/samples/Networking/v2/subnets/create_batch.php +++ b/samples/Networking/v2/subnets/create_batch.php @@ -7,30 +7,23 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$options = [ +$subnets = $service->createSubnets([ [ - 'name' => '{subnetName1}', - 'networkId' => '{networkId1}', - 'ipVersion' => 4, - 'cidr' => '192.168.199.0/24', + 'name' => '{subnetName1}', + 'networkId' => '{networkId1}', + 'ipVersion' => 4, + 'cidr' => '192.168.199.0/24', ], [ - 'name' => '{subnetName2}', - 'networkId' => '{networkId2}', - 'ipVersion' => 4, - 'cidr' => '10.56.4.0/22', + 'name' => '{subnetName2}', + 'networkId' => '{networkId2}', + 'ipVersion' => 4, + 'cidr' => '10.56.4.0/22', ], -]; - -$subnets = $networking->createSubnets($options); +]); diff --git a/samples/Networking/v2/subnets/create_with_gateway_ip.php b/samples/Networking/v2/subnets/create_with_gateway_ip.php index 168837f34..8c07deeb2 100644 --- a/samples/Networking/v2/subnets/create_with_gateway_ip.php +++ b/samples/Networking/v2/subnets/create_with_gateway_ip.php @@ -7,24 +7,16 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$options = [ +$subnet = $service->createSubnet([ 'name' => '{subnetName}', 'networkId' => '{networkId}', 'ipVersion' => 4, 'cidr' => '192.168.199.0/25', - 'gatewayIp' => '192.168.199.128' -]; - -// Create the subnet -$subnet = $networking->createSubnet($options); + 'gatewayIp' => '192.168.199.128', +]); diff --git a/samples/Networking/v2/subnets/create_with_host_routes.php b/samples/Networking/v2/subnets/create_with_host_routes.php index a58ed79a4..5b4d53c1c 100644 --- a/samples/Networking/v2/subnets/create_with_host_routes.php +++ b/samples/Networking/v2/subnets/create_with_host_routes.php @@ -9,16 +9,11 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); +$service = $openstack->networkingV2(); -$options = [ +$subnet = $service->createSubnet([ 'name' => '{subnetName}', 'networkId' => '{networkId}', 'ipVersion' => 4, @@ -27,7 +22,4 @@ 'destination' => '1.1.1.0/24', 'nexthop' => '192.168.19.20' ]] -]; - -// Create the subnet -$subnet = $networking->createSubnet($options); +]); diff --git a/samples/Networking/v2/subnets/delete.php b/samples/Networking/v2/subnets/delete.php index ffc13f6c0..4d00eac78 100644 --- a/samples/Networking/v2/subnets/delete.php +++ b/samples/Networking/v2/subnets/delete.php @@ -9,15 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$subnet = $networking->getSubnet('{subnetId}'); +$service = $openstack->networkingV2(); +$subnet = $service->getSubnet('{subnetId}'); $subnet->delete(); diff --git a/samples/Networking/v2/subnets/get.php b/samples/Networking/v2/subnets/get.php deleted file mode 100644 index b519abceb..000000000 --- a/samples/Networking/v2/subnets/get.php +++ /dev/null @@ -1,28 +0,0 @@ - '{authUrl}', - 'region' => '{region}', - 'user' => [ - 'id' => '{userId}', - 'password' => '{password}' - ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] -]); - -$networking = $openstack->networkingV2(); - -$subnet = $networking->getSubnet('{subnetId}'); - -// By default, this will return an empty Subnet object and NOT hit the API. -// This is convenient for when you want to use the object for operations -// that do not require an initial GET request. To retrieve the subnet's details, -// run the following, which *will* call the API with a GET request: - -$subnet->retrieve(); diff --git a/samples/Networking/v2/subnets/read.php b/samples/Networking/v2/subnets/read.php new file mode 100644 index 000000000..4cc15fc97 --- /dev/null +++ b/samples/Networking/v2/subnets/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->networkingV2(); +$subnet = $service->getSubnet('{subnetId}'); + +$subnet->retrieve(); diff --git a/samples/Networking/v2/subnets/update.php b/samples/Networking/v2/subnets/update.php index cbff505f4..e0d35f10a 100644 --- a/samples/Networking/v2/subnets/update.php +++ b/samples/Networking/v2/subnets/update.php @@ -7,18 +7,12 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => [ - 'project' => [ - 'id' => '{projectId}' - ] - ] ]); -$networking = $openstack->networkingV2(); - -$subnet = $networking->getSubnet('{subnetId}'); +$service = $openstack->networkingV2(); +$subnet = $service->getSubnet('{subnetId}'); $subnet->name = '{newName}'; $subnet->update(); diff --git a/samples/ObjectStore/v1/account/get_metadata.php b/samples/ObjectStore/v1/account/get_metadata.php index af9e63c9d..196a0358f 100644 --- a/samples/ObjectStore/v1/account/get_metadata.php +++ b/samples/ObjectStore/v1/account/get_metadata.php @@ -9,7 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); diff --git a/samples/ObjectStore/v1/account/merge_metadata.php b/samples/ObjectStore/v1/account/merge_metadata.php index 77e77d169..e77a9e74f 100644 --- a/samples/ObjectStore/v1/account/merge_metadata.php +++ b/samples/ObjectStore/v1/account/merge_metadata.php @@ -9,7 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); diff --git a/samples/ObjectStore/v1/account/read.php b/samples/ObjectStore/v1/account/read.php new file mode 100644 index 000000000..824907975 --- /dev/null +++ b/samples/ObjectStore/v1/account/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ], +]); + +$service = $openstack->objectStoreV1(); +$account = $service->getAccount(); + +$account->retrieve(); \ No newline at end of file diff --git a/samples/ObjectStore/v1/account/reset_metadata.php b/samples/ObjectStore/v1/account/reset_metadata.php index 9d79c4b4d..33ae3520f 100644 --- a/samples/ObjectStore/v1/account/reset_metadata.php +++ b/samples/ObjectStore/v1/account/reset_metadata.php @@ -9,11 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); - $account = $service->getAccount(); $account->resetMetadata([ diff --git a/samples/ObjectStore/v1/containers/create.php b/samples/ObjectStore/v1/containers/create.php index 8e867604b..98435ce52 100644 --- a/samples/ObjectStore/v1/containers/create.php +++ b/samples/ObjectStore/v1/containers/create.php @@ -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}', ]); diff --git a/samples/ObjectStore/v1/containers/delete.php b/samples/ObjectStore/v1/containers/delete.php index 25ae38dfe..da5c06eda 100644 --- a/samples/ObjectStore/v1/containers/delete.php +++ b/samples/ObjectStore/v1/containers/delete.php @@ -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(); diff --git a/samples/ObjectStore/v1/containers/get_metadata.php b/samples/ObjectStore/v1/containers/get_metadata.php index aded49ae3..7d75d2fdb 100644 --- a/samples/ObjectStore/v1/containers/get_metadata.php +++ b/samples/ObjectStore/v1/containers/get_metadata.php @@ -9,10 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -/** @var array $metadata */ -$metadata = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getMetadata(); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); + +$metadata = $container->getMetadata(); diff --git a/samples/ObjectStore/v1/containers/list.php b/samples/ObjectStore/v1/containers/list.php index 2cf9d401c..2723be81a 100644 --- a/samples/ObjectStore/v1/containers/list.php +++ b/samples/ObjectStore/v1/containers/list.php @@ -9,7 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); diff --git a/samples/ObjectStore/v1/containers/merge_metadata.php b/samples/ObjectStore/v1/containers/merge_metadata.php index accf99237..d2a6e504b 100644 --- a/samples/ObjectStore/v1/containers/merge_metadata.php +++ b/samples/ObjectStore/v1/containers/merge_metadata.php @@ -9,7 +9,6 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); diff --git a/samples/ObjectStore/v1/containers/read.php b/samples/ObjectStore/v1/containers/read.php new file mode 100644 index 000000000..4f7b42066 --- /dev/null +++ b/samples/ObjectStore/v1/containers/read.php @@ -0,0 +1,17 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); + +$container->retrieve(); \ No newline at end of file diff --git a/samples/ObjectStore/v1/containers/reset_metadata.php b/samples/ObjectStore/v1/containers/reset_metadata.php index 7c1e056de..60329ce7f 100644 --- a/samples/ObjectStore/v1/containers/reset_metadata.php +++ b/samples/ObjectStore/v1/containers/reset_metadata.php @@ -9,11 +9,9 @@ 'id' => '{userId}', 'password' => '{password}' ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $service = $openstack->objectStoreV1(); - $container = $service->getContainer('{containerName}'); $container->resetMetadata([ diff --git a/samples/ObjectStore/v1/objects/check_exists.php b/samples/ObjectStore/v1/objects/check_exists.php index 50b3b65ea..0d6e72def 100644 --- a/samples/ObjectStore/v1/objects/check_exists.php +++ b/samples/ObjectStore/v1/objects/check_exists.php @@ -9,9 +9,9 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$exists = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->objectExists('{objectName}'); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); + +$exists = $container->objectExists('{objectName}'); \ No newline at end of file diff --git a/samples/ObjectStore/v1/objects/copy.php b/samples/ObjectStore/v1/objects/copy.php index 0790be82f..80bd233a1 100644 --- a/samples/ObjectStore/v1/objects/copy.php +++ b/samples/ObjectStore/v1/objects/copy.php @@ -9,12 +9,13 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->copy([ - 'destination' => '{newContainerName}/{newObjectName}', - ]); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$object->copy([ + 'destination' => '{newContainerName}/{newObjectName}', +]); + diff --git a/samples/ObjectStore/v1/objects/create.php b/samples/ObjectStore/v1/objects/create.php index 65be7f884..12d955abe 100644 --- a/samples/ObjectStore/v1/objects/create.php +++ b/samples/ObjectStore/v1/objects/create.php @@ -9,13 +9,11 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ -$object = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->createObject([ - 'name' => '{objectName}', - 'content' => '{objectContent}', - ]); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->createObject([ + 'name' => '{objectName}', + 'content' => '{objectContent}', +]); diff --git a/samples/ObjectStore/v1/objects/create_from_stream.php b/samples/ObjectStore/v1/objects/create_from_stream.php index eed9fa20e..461d4b205 100644 --- a/samples/ObjectStore/v1/objects/create_from_stream.php +++ b/samples/ObjectStore/v1/objects/create_from_stream.php @@ -2,27 +2,23 @@ require 'vendor/autoload.php'; -use GuzzleHttp\Psr7\Stream; - $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); // You can use any instance of \Psr\Http\Message\StreamInterface -$stream = new Stream(fopen('/path/to/object.txt', 'r')); +$stream = new \GuzzleHttp\Psr7\Stream(fopen('/path/to/object.txt', 'r')); + +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); -$options = [ +$object = $container->createObject([ 'name' => '{objectName}', 'stream' => $stream, -]; +]); -/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ -$object = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->createObject($options); diff --git a/samples/ObjectStore/v1/objects/create_large_object.php b/samples/ObjectStore/v1/objects/create_large_object.php index 52f03b3f5..8b99ca3bd 100644 --- a/samples/ObjectStore/v1/objects/create_large_object.php +++ b/samples/ObjectStore/v1/objects/create_large_object.php @@ -2,32 +2,29 @@ require 'vendor/autoload.php'; -use Guzzle\Stream\Stream; - $openstack = new OpenStack\OpenStack([ 'authUrl' => '{authUrl}', 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); $options = [ - 'name' => 'object_name.txt', - 'stream' => new Stream(fopen('/path/to/large_object.mov', 'r')), ]; -// optional: specify the size of each segment in bytes -$options['segmentSize'] = 1073741824; +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); -// optional: specify the container where the segments live. This does not necessarily have to be the -// same as the container which holds the manifest file -$options['segmentContainer'] = 'test_segments'; +$object = $container->createObject([ + 'name' => '{objectName}', + 'stream' => new \GuzzleHttp\Psr7\Stream(fopen('/path/to/large_object.mov', 'r')), + // optional: specify the size of each segment in bytes + 'segmentSize' => 1073741824, -/** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ -$object = $openstack->objectStoreV1() - ->getContainer('test') - ->createLargeObject($options); + // optional: specify the container where the segments live. This does not necessarily have to be the + // same as the container which holds the manifest file + 'segmentContainer' => 'test_segments', +]); diff --git a/samples/ObjectStore/v1/objects/delete.php b/samples/ObjectStore/v1/objects/delete.php index 548e53bd8..6392b4aa9 100644 --- a/samples/ObjectStore/v1/objects/delete.php +++ b/samples/ObjectStore/v1/objects/delete.php @@ -9,10 +9,10 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->delete(); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$object->delete(); diff --git a/samples/ObjectStore/v1/objects/download.php b/samples/ObjectStore/v1/objects/download.php index 158c096ae..97d033f96 100644 --- a/samples/ObjectStore/v1/objects/download.php +++ b/samples/ObjectStore/v1/objects/download.php @@ -9,10 +9,10 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$stream = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->download(); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$stream = $object->download(); diff --git a/samples/ObjectStore/v1/objects/download_stream.php b/samples/ObjectStore/v1/objects/download_stream.php index 3d235b24e..9d63366dd 100644 --- a/samples/ObjectStore/v1/objects/download_stream.php +++ b/samples/ObjectStore/v1/objects/download_stream.php @@ -9,10 +9,10 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$stream = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->download(['requestOptions' => ['stream' => true]]); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$stream = $object->download(['requestOptions' => ['stream' => true]]); diff --git a/samples/ObjectStore/v1/objects/get_metadata.php b/samples/ObjectStore/v1/objects/get_metadata.php index dbb871a5a..51d49c879 100644 --- a/samples/ObjectStore/v1/objects/get_metadata.php +++ b/samples/ObjectStore/v1/objects/get_metadata.php @@ -9,10 +9,10 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$metadata = $openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->getMetadata(); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$metadata = $object->getMetadata(); diff --git a/samples/ObjectStore/v1/objects/list.php b/samples/ObjectStore/v1/objects/list.php index 713cacec5..54475db0c 100644 --- a/samples/ObjectStore/v1/objects/list.php +++ b/samples/ObjectStore/v1/objects/list.php @@ -9,11 +9,10 @@ 'id' => '{userId}', 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']], ]); -$container = $openstack->objectStoreV1() - ->getContainer('{containerName}'); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); foreach ($container->listObjects() as $object) { /** @var \OpenStack\ObjectStore\v1\Models\StorageObject $object */ diff --git a/samples/ObjectStore/v1/objects/merge_metadata.php b/samples/ObjectStore/v1/objects/merge_metadata.php index 04c6c793c..f6c3b5001 100644 --- a/samples/ObjectStore/v1/objects/merge_metadata.php +++ b/samples/ObjectStore/v1/objects/merge_metadata.php @@ -7,15 +7,15 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->mergeMetadata([ - '{key_1}' => '{val_1}', - '{key_2}' => '{val_2}', - ]); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$object->mergeMetadata([ + '{key_1}' => '{val_1}', + '{key_2}' => '{val_2}', +]); diff --git a/samples/ObjectStore/v1/objects/read.php b/samples/ObjectStore/v1/objects/read.php new file mode 100644 index 000000000..21c11a5a9 --- /dev/null +++ b/samples/ObjectStore/v1/objects/read.php @@ -0,0 +1,18 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}', + ], +]); + +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$object->retrieve(); \ No newline at end of file diff --git a/samples/ObjectStore/v1/objects/reset_metadata.php b/samples/ObjectStore/v1/objects/reset_metadata.php index 6c83e6475..407298ebe 100644 --- a/samples/ObjectStore/v1/objects/reset_metadata.php +++ b/samples/ObjectStore/v1/objects/reset_metadata.php @@ -7,15 +7,15 @@ 'region' => '{region}', 'user' => [ 'id' => '{userId}', - 'password' => '{password}' + 'password' => '{password}', ], - 'scope' => ['project' => ['id' => '{projectId}']] ]); -$openstack->objectStoreV1() - ->getContainer('{containerName}') - ->getObject('{objectName}') - ->resetMetadata([ - '{key_1}' => '{val_1}', - '{key_2}' => '{val_2}', - ]); +$service = $openstack->objectStoreV1(); +$container = $service->getContainer('{containerName}'); +$object = $container->getObject('{objectName}'); + +$object->resetMetadata([ + '{key_1}' => '{val_1}', + '{key_2}' => '{val_2}', +]); diff --git a/samples/Setup/application_credential_id.php b/samples/Setup/application_credential_id.php new file mode 100644 index 000000000..64a6cd84f --- /dev/null +++ b/samples/Setup/application_credential_id.php @@ -0,0 +1,12 @@ + '{authUrl}', + 'region' => '{region}', + 'application_credential' => [ + 'id' => '{applicationCredentialId}', + 'secret' => '{secret}', + ], +]); \ No newline at end of file diff --git a/samples/Setup/token_id.php b/samples/Setup/token_id.php new file mode 100644 index 000000000..8727447fc --- /dev/null +++ b/samples/Setup/token_id.php @@ -0,0 +1,9 @@ + '{authUrl}', + 'region' => '{region}', + 'tokenId' => '{tokenId}', +]); diff --git a/samples/Setup/user_id.php b/samples/Setup/user_id.php new file mode 100644 index 000000000..53948b511 --- /dev/null +++ b/samples/Setup/user_id.php @@ -0,0 +1,12 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'id' => '{userId}', + 'password' => '{password}' + ] +]); \ No newline at end of file diff --git a/samples/Setup/username.php b/samples/Setup/username.php new file mode 100644 index 000000000..83458a002 --- /dev/null +++ b/samples/Setup/username.php @@ -0,0 +1,15 @@ + '{authUrl}', + 'region' => '{region}', + 'user' => [ + 'name' => '{username}', + 'password' => '{password}', + 'domain' => [ + 'id' => '{domainId}' + ] + ] +]); \ No newline at end of file diff --git a/src/Compute/v2/Service.php b/src/Compute/v2/Service.php index 8090d8d0d..3dc1fd4c8 100644 --- a/src/Compute/v2/Service.php +++ b/src/Compute/v2/Service.php @@ -37,10 +37,10 @@ public function createServer(array $options): Server /** * List servers. * - * @param bool $detailed Determines whether detailed information will be returned. If FALSE is specified, only - * the ID, name and links attributes are returned, saving bandwidth. - * @param array $options {@see \OpenStack\Compute\v2\Api::getServers} - * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * @param bool $detailed Determines whether detailed information will be returned. If FALSE is specified, only + * the ID, name and links attributes are returned, saving bandwidth. + * @param array $options {@see \OpenStack\Compute\v2\Api::getServers} + * @param callable|null $mapFn a callable function that will be invoked on every iteration of the list * * @return \Generator */ diff --git a/src/ObjectStore/v1/Models/Container.php b/src/ObjectStore/v1/Models/Container.php index 6448694e8..fa9350268 100644 --- a/src/ObjectStore/v1/Models/Container.php +++ b/src/ObjectStore/v1/Models/Container.php @@ -79,6 +79,8 @@ public function retrieve() /** * @param array $userOptions {@see \OpenStack\ObjectStore\v1\Api::putContainer} + * + * @return self */ public function create(array $userOptions): Creatable { diff --git a/tests/sample/BlockStorage/v3/VolumeTest.php b/tests/sample/BlockStorage/v3/VolumeTest.php index d598c26c9..1f48a0178 100644 --- a/tests/sample/BlockStorage/v3/VolumeTest.php +++ b/tests/sample/BlockStorage/v3/VolumeTest.php @@ -35,16 +35,18 @@ public function testCreate(): Volume /** * @depends testCreate */ - public function testGet(Volume $createdVolume) + public function testRead(Volume $createdVolume) { /** @var Volume $volume */ - require_once $this->sampleFile('volumes/get.php', [ + require_once $this->sampleFile('volumes/read.php', [ '{volumeId}' => $createdVolume->id, ]); $this->assertInstanceOf(Volume::class, $volume); $this->assertEquals($createdVolume->id, $volume->id); - $this->assertNull($volume->description); + $this->assertEquals($createdVolume->name, $volume->name); + $this->assertEquals($createdVolume->size, $volume->size); + $this->assertEquals($createdVolume->description, $volume->description); } /** diff --git a/tests/sample/BlockStorage/v3/VolumeTypeTest.php b/tests/sample/BlockStorage/v3/VolumeTypeTest.php index 94f8f4abc..05aa6b51e 100644 --- a/tests/sample/BlockStorage/v3/VolumeTypeTest.php +++ b/tests/sample/BlockStorage/v3/VolumeTypeTest.php @@ -2,7 +2,6 @@ namespace OpenStack\Sample\BlockStorage\v3; -use OpenStack\BlockStorage\v2\Models\Snapshot; use OpenStack\BlockStorage\v2\Models\VolumeType; use OpenStack\Common\Error\BadResponseError; @@ -24,16 +23,13 @@ public function testCreate(): VolumeType /** * @depends testCreate */ - public function testGet(VolumeType $createdVolumeType) + public function testRead(VolumeType $createdVolumeType) { /** @var VolumeType $volumeType */ - require_once $this->sampleFile('volume_types/get.php', ['{volumeTypeId}' => $createdVolumeType->id]); + require_once $this->sampleFile('volume_types/read.php', ['{volumeTypeId}' => $createdVolumeType->id]); $this->assertInstanceOf(VolumeType::class, $volumeType); $this->assertEquals($createdVolumeType->id, $volumeType->id); - $this->assertNull($volumeType->name); - - $volumeType->retrieve(); $this->assertEquals($createdVolumeType->name, $volumeType->name); } diff --git a/tests/sample/Compute/v2/FlavorTest.php b/tests/sample/Compute/v2/FlavorTest.php index 61a4708b6..540e93c26 100644 --- a/tests/sample/Compute/v2/FlavorTest.php +++ b/tests/sample/Compute/v2/FlavorTest.php @@ -12,7 +12,7 @@ public function testCreate(): Flavor $name = $this->randomStr(); /** @var $flavor \OpenStack\Compute\v2\Models\Flavor */ - require_once $this->sampleFile('flavors/create_flavor.php', ['{flavorName}' => $name]); + require_once $this->sampleFile('flavors/create.php', ['{flavorName}' => $name]); $this->assertInstanceOf(Flavor::class, $flavor); $this->assertEquals($name, $flavor->name); @@ -27,7 +27,7 @@ public function testList(Flavor $createdFlavor) { $found = false; require_once $this->sampleFile( - 'flavors/list_flavors.php', + 'flavors/list.php', [ '/** @var \OpenStack\Compute\v2\Models\Flavor $flavor */' => <<<'PHP' /** @var \OpenStack\Compute\v2\Models\Flavor $flavor */ @@ -45,10 +45,10 @@ public function testList(Flavor $createdFlavor) /** * @depends testCreate */ - public function testGet(Flavor $createdFlavor) + public function testRead(Flavor $createdFlavor) { /** @var \OpenStack\Compute\v2\Models\Flavor $flavor */ - require_once $this->sampleFile('flavors/get_flavor.php', ['{flavorId}' => $createdFlavor->id]); + require_once $this->sampleFile('flavors/read.php', ['{flavorId}' => $createdFlavor->id]); $this->assertInstanceOf(Flavor::class, $flavor); $this->assertEquals($createdFlavor->id, $flavor->id); @@ -60,7 +60,7 @@ public function testGet(Flavor $createdFlavor) */ public function testDelete(Flavor $createdFlavor) { - require_once $this->sampleFile('flavors/delete_flavor.php', ['{flavorId}' => $createdFlavor->id]); + require_once $this->sampleFile('flavors/delete.php', ['{flavorId}' => $createdFlavor->id]); foreach ($this->getService()->listFlavors() as $flavor) { $this->assertNotEquals($createdFlavor->id, $flavor->id); diff --git a/tests/sample/Compute/v2/ServerTest.php b/tests/sample/Compute/v2/ServerTest.php index c92ef611d..0d3b54956 100644 --- a/tests/sample/Compute/v2/ServerTest.php +++ b/tests/sample/Compute/v2/ServerTest.php @@ -10,7 +10,6 @@ class ServerTest extends TestCase { - public function testCreate(): Server { $flavorId = getenv('OS_FLAVOR'); @@ -37,7 +36,7 @@ public function testCreate(): Server ]; /** @var $server \OpenStack\Compute\v2\Models\Server */ - require_once $this->sampleFile('servers/create_server.php', $replacements); + require_once $this->sampleFile('servers/create.php', $replacements); $server->waitUntilActive(); @@ -55,7 +54,7 @@ public function testUpdate(Server $createdServer) { $newName = $this->randomStr(); - require_once $this->sampleFile('servers/update_server.php', [ + require_once $this->sampleFile('servers/update.php', [ '{serverId}' => $createdServer->id, '{newName}' => $newName, ]); @@ -72,7 +71,7 @@ public function testUpdate(Server $createdServer) public function testGet(Server $createdServer) { /** @var \OpenStack\Compute\v2\Models\Server $server */ - require_once $this->sampleFile('servers/get_server.php', ['{serverId}' => $createdServer->id]); + require_once $this->sampleFile('servers/read.php', ['{serverId}' => $createdServer->id]); $this->assertInstanceOf(Server::class, $server); $this->assertEquals($createdServer->id, $server->id); @@ -343,7 +342,7 @@ public function testGetConsoleOutput(Server $createdServer) */ public function testDelete(Server $createdServer) { - require_once $this->sampleFile('servers/delete_server.php', ['{serverId}' => $createdServer->id]); + require_once $this->sampleFile('servers/delete.php', ['{serverId}' => $createdServer->id]); // Needed so that subnet and network can be removed $createdServer->waitUntilDeleted(); diff --git a/tests/sample/Identity/v3/ApplicationCredentialTest.php b/tests/sample/Identity/v3/ApplicationCredentialTest.php index 42be5d25e..a93f715a7 100644 --- a/tests/sample/Identity/v3/ApplicationCredentialTest.php +++ b/tests/sample/Identity/v3/ApplicationCredentialTest.php @@ -8,14 +8,14 @@ class ApplicationCredentialTest extends TestCase { - public function testAdd(): ApplicationCredential + public function testCreate(): ApplicationCredential { $name = $this->randomStr(); $description = $this->randomStr(); /** @var $applicationCredential \OpenStack\Identity\v3\Models\ApplicationCredential */ require_once $this->sampleFile( - 'application_credentials/add_application_credential.php', + 'application_credentials/create.php', [ '{name}' => $name, '{description}' => $description, @@ -30,7 +30,7 @@ public function testAdd(): ApplicationCredential } /** - * @depends testAdd + * @depends testCreate */ public function testGenerateToken(ApplicationCredential $applicationCredential) { @@ -48,13 +48,13 @@ public function testGenerateToken(ApplicationCredential $applicationCredential) } /** - * @depends testAdd + * @depends testCreate */ - public function testRetrieve(ApplicationCredential $originalApplicationCredential) + public function testRead(ApplicationCredential $originalApplicationCredential) { /** @var $applicationCredential \OpenStack\Identity\v3\Models\ApplicationCredential */ require_once $this->sampleFile( - 'application_credentials/show_application_credential.php', + 'application_credentials/read.php', ['{applicationCredentialId}' => $originalApplicationCredential->id] ); @@ -64,7 +64,7 @@ public function testRetrieve(ApplicationCredential $originalApplicationCredentia } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(ApplicationCredential $applicationCredential) { @@ -78,7 +78,7 @@ public function testDelete(ApplicationCredential $applicationCredential) $this->assertTrue($token->validate()); require_once $this->sampleFile( - 'application_credentials/delete_application_credential.php', + 'application_credentials/delete.php', [ '{applicationCredentialId}' => $applicationCredential->id, ] diff --git a/tests/sample/Identity/v3/DomainTest.php b/tests/sample/Identity/v3/DomainTest.php index d852f2ad7..2c6b4dd67 100644 --- a/tests/sample/Identity/v3/DomainTest.php +++ b/tests/sample/Identity/v3/DomainTest.php @@ -14,7 +14,7 @@ public function testCreate(): Domain /** @var $domain \OpenStack\Identity\v3\Models\Domain */ require_once $this->sampleFile( - 'domains/add_domain.php', + 'domains/create.php', [ '{name}' => $name, '{description}' => $description, @@ -34,7 +34,7 @@ public function testList(Domain $createdDomain) { $found = false; require_once $this->sampleFile( - 'domains/list_domains.php', + 'domains/list.php', [ '/** @var $domain \OpenStack\Identity\v3\Models\Domain */' => <<<'PHP' /** @var $domain \OpenStack\Identity\v3\Models\Domain */ @@ -51,10 +51,10 @@ public function testList(Domain $createdDomain) /** * @depends testCreate */ - public function testShow(Domain $createdDomain) + public function testRead(Domain $createdDomain) { /** @var $domain \OpenStack\Identity\v3\Models\Domain */ - require_once $this->sampleFile('domains/show_domain.php', ['{domainId}' => $createdDomain->id]); + require_once $this->sampleFile('domains/read.php', ['{domainId}' => $createdDomain->id]); $this->assertInstanceOf(Domain::class, $domain); $this->assertEquals($createdDomain->id, $domain->id); $this->assertEquals($createdDomain->name, $domain->name); @@ -252,7 +252,7 @@ public function testRevokeUserRole(Domain $createdDomain, array $createdRoleAndU public function testUpdate(Domain $createdDomain) { $this->assertTrue($createdDomain->enabled); - require_once $this->sampleFile('domains/update_domain.php', ['{domainId}' => $createdDomain->id]); + require_once $this->sampleFile('domains/update.php', ['{domainId}' => $createdDomain->id]); $createdDomain->retrieve(); $this->assertFalse($createdDomain->enabled); } @@ -262,7 +262,7 @@ public function testUpdate(Domain $createdDomain) */ public function testDelete(Domain $createdDomain) { - require_once $this->sampleFile('domains/delete_domain.php', ['{domainId}' => $createdDomain->id]); + require_once $this->sampleFile('domains/delete.php', ['{domainId}' => $createdDomain->id]); $found = false; foreach ($this->getService()->listDomains() as $domain) { if ($domain->id === $createdDomain->id) { diff --git a/tests/sample/Identity/v3/EndpointTest.php b/tests/sample/Identity/v3/EndpointTest.php index e9bc4e684..4aec0854a 100644 --- a/tests/sample/Identity/v3/EndpointTest.php +++ b/tests/sample/Identity/v3/EndpointTest.php @@ -8,13 +8,13 @@ class EndpointTest extends TestCase { - public function testAdd(): Endpoint + public function testCreate(): Endpoint { $service = $this->getService()->createService(['name' => $this->randomStr(), 'type' => 'volume', 'description' => $this->randomStr()]); /** @var $endpoint \OpenStack\Identity\v3\Models\Endpoint */ require_once $this->sampleFile( - 'endpoints/add_endpoint.php', + 'endpoints/create.php', [ '{endpointName}' => $this->randomStr(), '{serviceId}' => $service->id, @@ -28,13 +28,13 @@ public function testAdd(): Endpoint } /** - * @depends testAdd + * @depends testCreate */ public function testList(Endpoint $createdEndpoint) { $found = false; require_once $this->sampleFile( - 'endpoints/list_endpoints.php', + 'endpoints/list.php', [ '/** @var $endpoint \OpenStack\Identity\v3\Models\Endpoint */' => <<<'PHP' /** @var $endpoint \OpenStack\Identity\v3\Models\Endpoint */ @@ -50,14 +50,14 @@ public function testList(Endpoint $createdEndpoint) } /** - * @depends testAdd + * @depends testCreate */ public function testUpdate(Endpoint $createdEndpoint) { $this->assertEquals(Enum::INTERFACE_INTERNAL, $createdEndpoint->interface); require_once $this->sampleFile( - 'endpoints/update_endpoint.php', + 'endpoints/update.php', [ '{endpointId}' => $createdEndpoint->id, ] @@ -68,12 +68,12 @@ public function testUpdate(Endpoint $createdEndpoint) } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(Endpoint $createdEndpoint) { require_once $this->sampleFile( - 'endpoints/delete_endpoint.php', + 'endpoints/delete.php', [ '{endpointId}' => $createdEndpoint->id, ] diff --git a/tests/sample/Identity/v3/GroupTest.php b/tests/sample/Identity/v3/GroupTest.php index 602fa7ff7..e910e2de4 100644 --- a/tests/sample/Identity/v3/GroupTest.php +++ b/tests/sample/Identity/v3/GroupTest.php @@ -7,14 +7,14 @@ class GroupTest extends TestCase { - public function testAdd(): array + public function testCreate(): array { $name = $this->randomStr(); $description = $this->randomStr(); /** @var $group \OpenStack\Identity\v3\Models\Group */ require_once $this->sampleFile( - 'groups/add_group.php', + 'groups/create.php', [ '{name}' => $name, '{description}' => $description, @@ -31,7 +31,7 @@ public function testAdd(): array } /** - * @depends testAdd + * @depends testCreate */ public function testAddUser(array $groupAndUser): void { @@ -53,7 +53,7 @@ public function testAddUser(array $groupAndUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testCheckMembership(array $groupAndUser): void { @@ -61,7 +61,7 @@ public function testCheckMembership(array $groupAndUser): void /** @var $createdUser \OpenStack\Identity\v3\Models\User */ [$createdGroup, $createdUser] = $groupAndUser; - /** @var $result bool */ + /** @var $hasMembership bool */ require_once $this->sampleFile( 'groups/check_user_membership.php', [ @@ -70,11 +70,11 @@ public function testCheckMembership(array $groupAndUser): void ] ); - $this->assertTrue($result); + $this->assertTrue($hasMembership); } /** - * @depends testAdd + * @depends testCreate */ public function testListUsers(array $groupAndUser): void { @@ -101,7 +101,7 @@ public function testListUsers(array $groupAndUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testRemoveUser(array $groupAndUser): void { @@ -123,16 +123,16 @@ public function testRemoveUser(array $groupAndUser): void } /** - * @depends testAdd + * @depends testCreate */ - public function testGet(array $groupAndUser): void + public function testRead(array $groupAndUser): void { /** @var $createdGroup \OpenStack\Identity\v3\Models\Group */ [$createdGroup] = $groupAndUser; /** @var $group \OpenStack\Identity\v3\Models\Group */ require_once $this->sampleFile( - 'groups/get_group.php', + 'groups/read.php', [ '{groupId}' => $createdGroup->id, ] @@ -144,7 +144,7 @@ public function testGet(array $groupAndUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testUpdate(array $groupAndUser): void { @@ -155,7 +155,7 @@ public function testUpdate(array $groupAndUser): void $newDescription = $this->randomStr(); require_once $this->sampleFile( - 'groups/update_group.php', + 'groups/update.php', [ '{groupId}' => $createdGroup->id, '{name}' => $newName, @@ -169,7 +169,7 @@ public function testUpdate(array $groupAndUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testList(array $groupAndUser): void { @@ -178,7 +178,7 @@ public function testList(array $groupAndUser): void $found = false; require_once $this->sampleFile( - 'groups/list_groups.php', + 'groups/list.php', [ '{groupId}' => $createdGroup->id, '/** @var $group \OpenStack\Identity\v3\Models\Group */' => <<<'PHP' @@ -196,7 +196,7 @@ public function testList(array $groupAndUser): void /** - * @depends testAdd + * @depends testCreate */ public function testDelete(array $groupAndUser): void { @@ -204,7 +204,7 @@ public function testDelete(array $groupAndUser): void [$createdGroup] = $groupAndUser; require_once $this->sampleFile( - 'groups/delete_group.php', + 'groups/delete.php', [ '{groupId}' => $createdGroup->id, ] diff --git a/tests/sample/Identity/v3/ProjectTest.php b/tests/sample/Identity/v3/ProjectTest.php index ea72d79ea..5e54a05a8 100644 --- a/tests/sample/Identity/v3/ProjectTest.php +++ b/tests/sample/Identity/v3/ProjectTest.php @@ -7,11 +7,11 @@ class ProjectTest extends TestCase { - public function testAdd(): Project + public function testCreate(): Project { /** @var $project \OpenStack\Identity\v3\Models\Project */ require_once $this->sampleFile( - 'projects/add_project.php', + 'projects/create.php', ['{name}' => $this->randomStr(), '{description}' => $this->randomStr()] ); $this->assertInstanceOf(Project::class, $project); @@ -20,19 +20,19 @@ public function testAdd(): Project } /** - * @depends testAdd + * @depends testCreate */ - public function testGet(Project $createdProject) + public function testRead(Project $createdProject) { /** @var $project \OpenStack\Identity\v3\Models\Project */ - require_once $this->sampleFile('projects/get_project.php', ['{id}' => $createdProject->id]); + require_once $this->sampleFile('projects/read.php', ['{id}' => $createdProject->id]); $this->assertInstanceOf(Project::class, $project); $this->assertEquals($createdProject->id, $project->id); $this->assertEquals($createdProject->name, $project->name); } /** - * @depends testAdd + * @depends testCreate */ public function testGrantGroupRole(Project $createdProject): array { @@ -55,7 +55,7 @@ public function testGrantGroupRole(Project $createdProject): array } /** - * @depends testAdd + * @depends testCreate * @depends testGrantGroupRole */ public function testCheckGroupRole(Project $createdProject, array $createdRoleAndGroup) @@ -76,7 +76,7 @@ public function testCheckGroupRole(Project $createdProject, array $createdRoleAn } /** - * @depends testAdd + * @depends testCreate * @depends testGrantGroupRole */ public function testListGroupRoles(Project $createdProject, array $createdRoleAndGroup) @@ -103,7 +103,7 @@ public function testListGroupRoles(Project $createdProject, array $createdRoleAn } /** - * @depends testAdd + * @depends testCreate * @depends testGrantGroupRole */ public function testRevokeGroupRole(Project $createdProject, array $createdRoleAndGroup) @@ -125,7 +125,7 @@ public function testRevokeGroupRole(Project $createdProject, array $createdRoleA } /** - * @depends testAdd + * @depends testCreate */ public function testGrantUserRole(Project $createdProject): array { @@ -147,7 +147,7 @@ public function testGrantUserRole(Project $createdProject): array } /** - * @depends testAdd + * @depends testCreate * @depends testGrantUserRole */ public function testCheckUserRole(Project $createdProject, array $createdRoleAndUser) @@ -168,7 +168,7 @@ public function testCheckUserRole(Project $createdProject, array $createdRoleAnd } /** - * @depends testAdd + * @depends testCreate * @depends testGrantUserRole */ public function testListUserRoles(Project $createdProject, array $createdRoleAndUser) @@ -195,7 +195,7 @@ public function testListUserRoles(Project $createdProject, array $createdRoleAnd } /** - * @depends testAdd + * @depends testCreate * @depends testGrantUserRole */ public function testRevokeUserRole(Project $createdProject, array $createdRoleAndUser) @@ -217,24 +217,24 @@ public function testRevokeUserRole(Project $createdProject, array $createdRoleAn } /** - * @depends testAdd + * @depends testCreate */ public function testUpdate(Project $createdProject) { $this->assertTrue($createdProject->enabled); - require_once $this->sampleFile('projects/update_project.php', ['{id}' => $createdProject->id]); + require_once $this->sampleFile('projects/update.php', ['{id}' => $createdProject->id]); $createdProject->retrieve(); $this->assertFalse($createdProject->enabled); } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(Project $createdProject) { - require_once $this->sampleFile('projects/delete_project.php', ['{id}' => $createdProject->id]); + require_once $this->sampleFile('projects/delete.php', ['{id}' => $createdProject->id]); $found = false; foreach ($this->getService()->listProjects() as $project) { diff --git a/tests/sample/Identity/v3/RoleTest.php b/tests/sample/Identity/v3/RoleTest.php index 059a1b669..77648be6f 100644 --- a/tests/sample/Identity/v3/RoleTest.php +++ b/tests/sample/Identity/v3/RoleTest.php @@ -6,23 +6,23 @@ class RoleTest extends TestCase { - public function testAdd(): Role + public function testCeate(): Role { /** @var $role \OpenStack\Identity\v3\Models\Role */ - require_once $this->sampleFile('roles/add_role.php', ['{name}' => $this->randomStr()]); + require_once $this->sampleFile('roles/create.php', ['{name}' => $this->randomStr()]); $this->assertInstanceOf(Role::class, $role); return $role; } /** - * @depends testAdd + * @depends testCeate */ public function testList(Role $createdRole): void { $found = false; require_once $this->sampleFile( - 'roles/list_roles.php', + 'roles/list.php', [ '/** @var $role \OpenStack\Identity\v3\Models\Role */' => <<<'PHP' /** @var $role \OpenStack\Identity\v3\Models\Role */ @@ -38,7 +38,7 @@ public function testList(Role $createdRole): void } /** - * @depends testAdd + * @depends testCeate */ public function testListAssignments(Role $createdRole): void { diff --git a/tests/sample/Identity/v3/ServiceTest.php b/tests/sample/Identity/v3/ServiceTest.php index 48e4d11ae..a93148d5e 100644 --- a/tests/sample/Identity/v3/ServiceTest.php +++ b/tests/sample/Identity/v3/ServiceTest.php @@ -7,11 +7,11 @@ class ServiceTest extends TestCase { - public function testAdd(): \OpenStack\Identity\v3\Models\Service + public function testCreate(): \OpenStack\Identity\v3\Models\Service { /** @var $service \OpenStack\Identity\v3\Models\Service */ require_once $this->sampleFile( - 'services/add_service.php', + 'services/create.php', [ '{serviceName}' => $this->randomStr(), '{serviceType}' => $this->randomStr(), @@ -23,13 +23,13 @@ public function testAdd(): \OpenStack\Identity\v3\Models\Service } /** - * @depends testAdd + * @depends testCreate */ public function testList(\OpenStack\Identity\v3\Models\Service $createdService) { $found = false; require_once $this->sampleFile( - 'services/list_services.php', + 'services/list.php', [ '/** @var $service \OpenStack\Identity\v3\Models\Service */' => <<<'PHP' /** @var $service \OpenStack\Identity\v3\Models\Service */ @@ -45,14 +45,14 @@ public function testList(\OpenStack\Identity\v3\Models\Service $createdService) } /** - * @depends testAdd + * @depends testCreate */ public function testUpdate(\OpenStack\Identity\v3\Models\Service $createdService) { $newDescription = $this->randomStr(); require_once $this->sampleFile( - 'services/update_service.php', + 'services/update.php', [ '{serviceId}' => $createdService->id, '{description}' => $newDescription, @@ -64,13 +64,13 @@ public function testUpdate(\OpenStack\Identity\v3\Models\Service $createdService } /** - * @depends testAdd + * @depends testCreate */ public function testGet(\OpenStack\Identity\v3\Models\Service $createdService) { /** @var $service \OpenStack\Identity\v3\Models\Service */ require_once $this->sampleFile( - 'services/get_service.php', + 'services/read.php', [ '{serviceId}' => $createdService->id, ] @@ -82,12 +82,12 @@ public function testGet(\OpenStack\Identity\v3\Models\Service $createdService) } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(\OpenStack\Identity\v3\Models\Service $createdService) { require_once $this->sampleFile( - 'services/delete_service.php', + 'services/delete.php', [ '{serviceId}' => $createdService->id, ] diff --git a/tests/sample/Identity/v3/UserTest.php b/tests/sample/Identity/v3/UserTest.php index 2fabbe467..313cbc502 100644 --- a/tests/sample/Identity/v3/UserTest.php +++ b/tests/sample/Identity/v3/UserTest.php @@ -7,14 +7,14 @@ class UserTest extends TestCase { - public function testAdd(): User + public function testCreate(): User { $domain = $this->getService()->createDomain(['name' => $this->randomStr()]); $project = $this->getService()->createProject(['name' => $this->randomStr(), 'domainId' => $domain->id]); /** @var $user \OpenStack\Identity\v3\Models\User */ require_once $this->sampleFile( - 'users/add_user.php', + 'users/create.php', [ '{defaultProjectId}' => $project->id, '{description}' => $this->randomStr(), @@ -31,12 +31,12 @@ public function testAdd(): User } /** - * @depends testAdd + * @depends testCreate */ - public function testGet(User $createdUser): void + public function testRead(User $createdUser): void { /** @var $user \OpenStack\Identity\v3\Models\User */ - require_once $this->sampleFile('users/get_user.php', ['{id}' => $createdUser->id]); + require_once $this->sampleFile('users/read.php', ['{id}' => $createdUser->id]); $this->assertInstanceOf(User::class, $user); $this->assertEquals($createdUser->id, $user->id); @@ -45,13 +45,13 @@ public function testGet(User $createdUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testList(User $createdUser): void { $found = false; require_once $this->sampleFile( - 'users/list_users.php', + 'users/list.php', [ '/** @var $user \OpenStack\Identity\v3\Models\User */' => <<<'PHP' /** @var $user \OpenStack\Identity\v3\Models\User */ @@ -67,7 +67,7 @@ public function testList(User $createdUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testListGroups(User $createdUser): void { @@ -93,7 +93,7 @@ public function testListGroups(User $createdUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testListProjects(User $createdUser): void { @@ -121,7 +121,7 @@ public function testListProjects(User $createdUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testUpdate(User $createdUser): void { @@ -129,7 +129,7 @@ public function testUpdate(User $createdUser): void $newDescription = $this->randomStr(); require_once $this->sampleFile( - 'users/update_user.php', + 'users/update.php', [ '{id}' => $createdUser->id, '{name}' => $newName, @@ -144,11 +144,11 @@ public function testUpdate(User $createdUser): void } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(User $createdUser): void { - require_once $this->sampleFile('users/delete_user.php', ['{id}' => $createdUser->id]); + require_once $this->sampleFile('users/delete.php', ['{id}' => $createdUser->id]); $found = false; foreach ($this->getService()->listUsers() as $user) { diff --git a/tests/sample/Images/v2/ImageTest.php b/tests/sample/Images/v2/ImageTest.php index f8b583ebd..af524d3f5 100644 --- a/tests/sample/Images/v2/ImageTest.php +++ b/tests/sample/Images/v2/ImageTest.php @@ -7,7 +7,6 @@ class ImageTest extends TestCase { - public function testCreate(): Image { /** @var Image $image */ @@ -54,11 +53,11 @@ public function testList(Image $createdImage) /** * @depends testCreate */ - public function testGet(Image $createdImage) + public function testRead(Image $createdImage) { /** @var Image $image */ require_once $this->sampleFile( - 'images/get.php', + 'images/read.php', [ '{imageId}' => $createdImage->id, ] diff --git a/tests/sample/Images/v2/MemberTest.php b/tests/sample/Images/v2/MemberTest.php index 0ebd10f62..df3893b1d 100644 --- a/tests/sample/Images/v2/MemberTest.php +++ b/tests/sample/Images/v2/MemberTest.php @@ -8,7 +8,7 @@ class MemberTest extends TestCase { - public function testAdd(): Member + public function testCreate(): Member { $image = $this->getService()->createImage([ 'name' => $this->randomStr(), @@ -18,14 +18,14 @@ public function testAdd(): Member ]); /** @var Member $member */ - require_once $this->sampleFile('members/add.php', ['{imageId}' => $image->id,]); + require_once $this->sampleFile('members/create.php', ['{imageId}' => $image->id,]); $this->assertInstanceOf(Member::class, $member); return $member; } /** - * @depends testAdd + * @depends testCreate */ public function testUpdateStatus(Member $createdMember) { @@ -41,7 +41,7 @@ public function testUpdateStatus(Member $createdMember) } /** - * @depends testAdd + * @depends testCreate */ public function testDelete(Member $createdMember) { diff --git a/tests/sample/Networking/v2/NetworkTest.php b/tests/sample/Networking/v2/NetworkTest.php index 5b360f0d5..df6a65323 100644 --- a/tests/sample/Networking/v2/NetworkTest.php +++ b/tests/sample/Networking/v2/NetworkTest.php @@ -53,10 +53,10 @@ public function testUpdate(Network $createdNetwork) /** * @depends testCreate */ - public function testRetrieve(Network $createdNetwork) + public function testRead(Network $createdNetwork) { /** @var \OpenStack\Networking\v2\Models\Network $network */ - require_once $this->sampleFile('networks/get.php', ['{networkId}' => $createdNetwork->id]); + require_once $this->sampleFile('networks/read.php', ['{networkId}' => $createdNetwork->id]); $this->assertInstanceOf(Network::class, $network); $this->assertEquals($createdNetwork->id, $network->id); diff --git a/tests/sample/Networking/v2/PortTest.php b/tests/sample/Networking/v2/PortTest.php index 040c48791..05e08b5f6 100644 --- a/tests/sample/Networking/v2/PortTest.php +++ b/tests/sample/Networking/v2/PortTest.php @@ -97,20 +97,17 @@ public function testList(Port $createdPort) /** * @depends testCreate */ - public function testGet(Port $createdPort) + public function testRead(Port $createdPort) { /** @var $port \OpenStack\Networking\v2\Models\Port */ require_once $this->sampleFile( - 'ports/get.php', + 'ports/read.php', [ '{portId}' => $createdPort->id, ]); $this->assertInstanceOf(Port::class, $port); $this->assertNotEmpty($port->id); - $this->assertEmpty($port->name); - - $port->retrieve(); $this->assertNotEmpty($port->name); } diff --git a/tests/sample/Networking/v2/SubnetTest.php b/tests/sample/Networking/v2/SubnetTest.php index 05b55b827..0beb40f7f 100644 --- a/tests/sample/Networking/v2/SubnetTest.php +++ b/tests/sample/Networking/v2/SubnetTest.php @@ -100,10 +100,10 @@ public function testUpdate(Subnet $createdSubnet) /** * @depends testCreate */ - public function testRetrieve(Subnet $createdSubnet) + public function testRead(Subnet $createdSubnet) { /** @var $subnet \OpenStack\Networking\v2\Models\Subnet */ - require_once $this->sampleFile('subnets/get.php', ['{subnetId}' => $createdSubnet->id]); + require_once $this->sampleFile('subnets/read.php', ['{subnetId}' => $createdSubnet->id]); $this->assertInstanceOf(Subnet::class, $subnet); $this->assertEquals($subnet->id, $subnet->id); diff --git a/tests/sample/ObjectStore/v1/ContainerTest.php b/tests/sample/ObjectStore/v1/ContainerTest.php index 426ae3ca4..a24999db1 100644 --- a/tests/sample/ObjectStore/v1/ContainerTest.php +++ b/tests/sample/ObjectStore/v1/ContainerTest.php @@ -22,13 +22,14 @@ public function testCreate(): Container /** * @depends testCreate */ - public function testGet(Container $createdContainer) + public function testRead(Container $createdContainer) { /** @var \OpenStack\ObjectStore\v1\Models\Container $container */ - require_once $this->sampleFile('containers/get.php', ['{containerName}' => $createdContainer->name]); + require_once $this->sampleFile('containers/read.php', ['{containerName}' => $createdContainer->name]); $this->assertInstanceOf(Container::class, $container); $this->assertEquals($createdContainer->name, $container->name); + $this->assertEquals(0, $container->objectCount); $this->assertEquals([], $container->metadata); } diff --git a/tests/sample/ObjectStore/v1/ObjectTest.php b/tests/sample/ObjectStore/v1/ObjectTest.php index 731490af6..9ba1181ee 100644 --- a/tests/sample/ObjectStore/v1/ObjectTest.php +++ b/tests/sample/ObjectStore/v1/ObjectTest.php @@ -99,17 +99,22 @@ public function testDownloadStream(StorageObject $createdObject) /** * @depends testCreate */ - public function testGet(StorageObject $createdObject) + public function testRead(StorageObject $createdObject) { + $createdObject->retrieve(); + /** @var StorageObject $object */ - require_once $this->sampleFile('objects/get.php', [ + require_once $this->sampleFile('objects/read.php', [ '{containerName}' => $createdObject->containerName, '{objectName}' => $createdObject->name, ]); $this->assertInstanceOf(StorageObject::class, $object); $this->assertEquals($createdObject->name, $object->name); - $this->assertEquals(null, $object->metadata); + $this->assertEquals($createdObject->containerName, $object->containerName); + $this->assertEquals($createdObject->contentLength, $object->contentLength); + $this->assertEquals($createdObject->hash, $object->hash); + $this->assertEquals([], $object->metadata); } /** diff --git a/tests/sample/SampleManager.php b/tests/sample/SampleManager.php index 585c84b04..cda017d97 100644 --- a/tests/sample/SampleManager.php +++ b/tests/sample/SampleManager.php @@ -2,7 +2,6 @@ namespace OpenStack\Sample; -use OpenStack\Integration\SampleManagerInterface; use RuntimeException; class SampleManager @@ -98,7 +97,7 @@ public function write(string $path, array $replacements): string } $content = strtr(file_get_contents($sampleFile), $replacements); - $content = str_replace("'vendor/'", "'" . dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . "vendor'", $content); + $content = str_replace("'vendor/'", "'" . dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . "vendor'", $content); $subst = $this->getConnectionTemplate(); $content = preg_replace('/\([^)]+\)/', '', $content, 1);