diff --git a/composer.lock b/composer.lock index 3080d4b8d..972e601cc 100644 --- a/composer.lock +++ b/composer.lock @@ -1369,30 +1369,32 @@ }, { "name": "guzzlehttp/uri-template", - "version": "v0.2.0", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce" + "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/db46525d6d8fee71033b73cc07160f3e5271a8ce", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/ecea8feef63bd4fef1f037ecb288386999ecc11c", + "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "symfony/polyfill-php80": "^1.17" + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-php80": "^1.24" }, "require-dev": { - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3", + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", "uri-template/tests": "1.0.0" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.0-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { @@ -1405,22 +1407,35 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, { "name": "George Mponos", "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos", - "role": "Developer" + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" } ], "description": "A polyfill class for uri_template of PHP", - "homepage": "https://github.com/guzzlehttp/uri-template", "keywords": [ "guzzlehttp", "uri-template" ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/master" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.3" }, "funding": [ { @@ -1428,11 +1443,15 @@ "type": "github" }, { - "url": "https://github.com/gmponos", + "url": "https://github.com/Nyholm", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/uri-template", + "type": "tidelift" } ], - "time": "2020-07-21T13:45:09+00:00" + "time": "2023-12-03T19:50:20+00:00" }, { "name": "icewind/searchdav", @@ -2666,29 +2685,33 @@ }, { "name": "php-opencloud/openstack", - "version": "v3.2.1", + "version": "v3.10.0", "source": { "type": "git", "url": "https://github.com/php-opencloud/openstack.git", - "reference": "42e2d09b9368becb6fde6dac17854132fcf77a5c" + "reference": "2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/42e2d09b9368becb6fde6dac17854132fcf77a5c", - "reference": "42e2d09b9368becb6fde6dac17854132fcf77a5c", + "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa", + "reference": "2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^7.0", - "guzzlehttp/uri-template": "0.2", + "guzzlehttp/psr7": ">=1.7", + "guzzlehttp/uri-template": "^0.2 || ^1.0", "justinrainbow/json-schema": "^5.2", - "php": "^7.2.5|^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", + "ergebnis/composer-normalize": "^2.0", + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^3", "php-coveralls/php-coveralls": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^8.0", + "phpspec/prophecy": "^1.17", + "phpunit/phpunit": ">=8.5.23 <9.0", "psr/log": "^1.0" }, "type": "library", @@ -2716,6 +2739,11 @@ "name": "Ha Phan", "email": "thanhha.work@gmail.com", "homepage": "https://github.com/haphan" + }, + { + "name": "Konstantin Babushkin", + "email": "koka@idwrx.com", + "homepage": "https://github.com/k0ka" } ], "description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi", @@ -2728,9 +2756,9 @@ ], "support": { "issues": "https://github.com/php-opencloud/openstack/issues", - "source": "https://github.com/php-opencloud/openstack/tree/v3.2.1" + "source": "https://github.com/php-opencloud/openstack/tree/v3.10.0" }, - "time": "2021-07-21T13:43:25+00:00" + "time": "2024-04-02T12:17:34+00:00" }, { "name": "phpseclib/phpseclib", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 97c6dee54..111335e32 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -1855,6 +1855,8 @@ 'OpenStack\\BlockStorage\\v2\\Models\\VolumeType' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php', 'OpenStack\\BlockStorage\\v2\\Params' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v2/Params.php', 'OpenStack\\BlockStorage\\v2\\Service' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v2/Service.php', + 'OpenStack\\BlockStorage\\v3\\Api' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v3/Api.php', + 'OpenStack\\BlockStorage\\v3\\Service' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v3/Service.php', 'OpenStack\\Common\\Api\\AbstractApi' => $vendorDir . '/php-opencloud/openstack/src/Common/Api/AbstractApi.php', 'OpenStack\\Common\\Api\\AbstractParams' => $vendorDir . '/php-opencloud/openstack/src/Common/Api/AbstractParams.php', 'OpenStack\\Common\\Api\\ApiInterface' => $vendorDir . '/php-opencloud/openstack/src/Common/Api/ApiInterface.php', @@ -1892,6 +1894,7 @@ 'OpenStack\\Common\\Service\\Builder' => $vendorDir . '/php-opencloud/openstack/src/Common/Service/Builder.php', 'OpenStack\\Common\\Service\\ServiceInterface' => $vendorDir . '/php-opencloud/openstack/src/Common/Service/ServiceInterface.php', 'OpenStack\\Common\\Transport\\HandlerStack' => $vendorDir . '/php-opencloud/openstack/src/Common/Transport/HandlerStack.php', + 'OpenStack\\Common\\Transport\\HandlerStackFactory' => $vendorDir . '/php-opencloud/openstack/src/Common/Transport/HandlerStackFactory.php', 'OpenStack\\Common\\Transport\\JsonSerializer' => $vendorDir . '/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php', 'OpenStack\\Common\\Transport\\Middleware' => $vendorDir . '/php-opencloud/openstack/src/Common/Transport/Middleware.php', 'OpenStack\\Common\\Transport\\RequestSerializer' => $vendorDir . '/php-opencloud/openstack/src/Common/Transport/RequestSerializer.php', @@ -1921,6 +1924,7 @@ 'OpenStack\\Identity\\v2\\Service' => $vendorDir . '/php-opencloud/openstack/src/Identity/v2/Service.php', 'OpenStack\\Identity\\v3\\Api' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Api.php', 'OpenStack\\Identity\\v3\\Enum' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Enum.php', + 'OpenStack\\Identity\\v3\\Models\\ApplicationCredential' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Models/ApplicationCredential.php', 'OpenStack\\Identity\\v3\\Models\\Assignment' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php', 'OpenStack\\Identity\\v3\\Models\\Catalog' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php', 'OpenStack\\Identity\\v3\\Models\\Credential' => $vendorDir . '/php-opencloud/openstack/src/Identity/v3/Models/Credential.php', @@ -1950,17 +1954,23 @@ 'OpenStack\\Metric\\v1\\Gnocchi\\Service' => $vendorDir . '/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php', 'OpenStack\\Networking\\v2\\Api' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Api.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Api' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ApiTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ApiTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\FixedIp' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FixedIp.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\FloatingIp' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\GatewayInfo' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\Router' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Params' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ParamsTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ParamsTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Service' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ServiceTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ServiceTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Api' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ApiTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ApiTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Models\\SecurityGroup' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Models\\SecurityGroupRule' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Params' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ParamsTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ParamsTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Service' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ServiceTrait' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ServiceTrait.php', 'OpenStack\\Networking\\v2\\Models\\InterfaceAttachment' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Models/InterfaceAttachment.php', 'OpenStack\\Networking\\v2\\Models\\LoadBalancer' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php', 'OpenStack\\Networking\\v2\\Models\\LoadBalancerHealthMonitor' => $vendorDir . '/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php', diff --git a/composer/autoload_static.php b/composer/autoload_static.php index d295a7840..a8cde0d21 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -2400,6 +2400,8 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'OpenStack\\BlockStorage\\v2\\Models\\VolumeType' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php', 'OpenStack\\BlockStorage\\v2\\Params' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v2/Params.php', 'OpenStack\\BlockStorage\\v2\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v2/Service.php', + 'OpenStack\\BlockStorage\\v3\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v3/Api.php', + 'OpenStack\\BlockStorage\\v3\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v3/Service.php', 'OpenStack\\Common\\Api\\AbstractApi' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Api/AbstractApi.php', 'OpenStack\\Common\\Api\\AbstractParams' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Api/AbstractParams.php', 'OpenStack\\Common\\Api\\ApiInterface' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Api/ApiInterface.php', @@ -2437,6 +2439,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'OpenStack\\Common\\Service\\Builder' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Service/Builder.php', 'OpenStack\\Common\\Service\\ServiceInterface' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Service/ServiceInterface.php', 'OpenStack\\Common\\Transport\\HandlerStack' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Transport/HandlerStack.php', + 'OpenStack\\Common\\Transport\\HandlerStackFactory' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Transport/HandlerStackFactory.php', 'OpenStack\\Common\\Transport\\JsonSerializer' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php', 'OpenStack\\Common\\Transport\\Middleware' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Transport/Middleware.php', 'OpenStack\\Common\\Transport\\RequestSerializer' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Common/Transport/RequestSerializer.php', @@ -2466,6 +2469,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'OpenStack\\Identity\\v2\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v2/Service.php', 'OpenStack\\Identity\\v3\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Api.php', 'OpenStack\\Identity\\v3\\Enum' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Enum.php', + 'OpenStack\\Identity\\v3\\Models\\ApplicationCredential' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Models/ApplicationCredential.php', 'OpenStack\\Identity\\v3\\Models\\Assignment' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php', 'OpenStack\\Identity\\v3\\Models\\Catalog' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php', 'OpenStack\\Identity\\v3\\Models\\Credential' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Identity/v3/Models/Credential.php', @@ -2495,17 +2499,23 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'OpenStack\\Metric\\v1\\Gnocchi\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php', 'OpenStack\\Networking\\v2\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Api.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ApiTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ApiTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\FixedIp' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FixedIp.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\FloatingIp' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\GatewayInfo' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Models\\Router' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Params' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ParamsTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ParamsTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php', + 'OpenStack\\Networking\\v2\\Extensions\\Layer3\\ServiceTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ServiceTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ApiTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ApiTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Models\\SecurityGroup' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Models\\SecurityGroupRule' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Params' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ParamsTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ParamsTrait.php', 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\Service' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php', + 'OpenStack\\Networking\\v2\\Extensions\\SecurityGroups\\ServiceTrait' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ServiceTrait.php', 'OpenStack\\Networking\\v2\\Models\\InterfaceAttachment' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Models/InterfaceAttachment.php', 'OpenStack\\Networking\\v2\\Models\\LoadBalancer' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php', 'OpenStack\\Networking\\v2\\Models\\LoadBalancerHealthMonitor' => __DIR__ . '/..' . '/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php', diff --git a/composer/installed.json b/composer/installed.json index 3bab863dc..0a2ac04fd 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -1417,32 +1417,34 @@ }, { "name": "guzzlehttp/uri-template", - "version": "v0.2.0", - "version_normalized": "0.2.0.0", + "version": "v1.0.3", + "version_normalized": "1.0.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce" + "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/db46525d6d8fee71033b73cc07160f3e5271a8ce", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/ecea8feef63bd4fef1f037ecb288386999ecc11c", + "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "symfony/polyfill-php80": "^1.17" + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-php80": "^1.24" }, "require-dev": { - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3", + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", "uri-template/tests": "1.0.0" }, - "time": "2020-07-21T13:45:09+00:00", + "time": "2023-12-03T19:50:20+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.0-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "installation-source": "dist", @@ -1456,22 +1458,35 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, { "name": "George Mponos", "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos", - "role": "Developer" + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" } ], "description": "A polyfill class for uri_template of PHP", - "homepage": "https://github.com/guzzlehttp/uri-template", "keywords": [ "guzzlehttp", "uri-template" ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/master" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.3" }, "funding": [ { @@ -1479,8 +1494,12 @@ "type": "github" }, { - "url": "https://github.com/gmponos", + "url": "https://github.com/Nyholm", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/uri-template", + "type": "tidelift" } ], "install-path": "../guzzlehttp/uri-template" @@ -2780,33 +2799,37 @@ }, { "name": "php-opencloud/openstack", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", + "version": "v3.10.0", + "version_normalized": "3.10.0.0", "source": { "type": "git", "url": "https://github.com/php-opencloud/openstack.git", - "reference": "42e2d09b9368becb6fde6dac17854132fcf77a5c" + "reference": "2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/42e2d09b9368becb6fde6dac17854132fcf77a5c", - "reference": "42e2d09b9368becb6fde6dac17854132fcf77a5c", + "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa", + "reference": "2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^7.0", - "guzzlehttp/uri-template": "0.2", + "guzzlehttp/psr7": ">=1.7", + "guzzlehttp/uri-template": "^0.2 || ^1.0", "justinrainbow/json-schema": "^5.2", - "php": "^7.2.5|^8.0" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", + "ergebnis/composer-normalize": "^2.0", + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^3", "php-coveralls/php-coveralls": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^8.0", + "phpspec/prophecy": "^1.17", + "phpunit/phpunit": ">=8.5.23 <9.0", "psr/log": "^1.0" }, - "time": "2021-07-21T13:43:25+00:00", + "time": "2024-04-02T12:17:34+00:00", "type": "library", "extra": { "branch-alias": { @@ -2833,6 +2856,11 @@ "name": "Ha Phan", "email": "thanhha.work@gmail.com", "homepage": "https://github.com/haphan" + }, + { + "name": "Konstantin Babushkin", + "email": "koka@idwrx.com", + "homepage": "https://github.com/k0ka" } ], "description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi", @@ -2845,7 +2873,7 @@ ], "support": { "issues": "https://github.com/php-opencloud/openstack/issues", - "source": "https://github.com/php-opencloud/openstack/tree/v3.2.1" + "source": "https://github.com/php-opencloud/openstack/tree/v3.10.0" }, "install-path": "../php-opencloud/openstack" }, diff --git a/composer/installed.php b/composer/installed.php index c8fce3406..7bbb8a8cf 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0ecec0a5d936442e91288c31eaef178b092fe09a', + 'reference' => 'e0c280b0939edd09537e973f7f9c4acd3d6a27ea', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -173,9 +173,9 @@ 'dev_requirement' => false, ), 'guzzlehttp/uri-template' => array( - 'pretty_version' => 'v0.2.0', - 'version' => '0.2.0.0', - 'reference' => 'db46525d6d8fee71033b73cc07160f3e5271a8ce', + 'pretty_version' => 'v1.0.3', + 'version' => '1.0.3.0', + 'reference' => 'ecea8feef63bd4fef1f037ecb288386999ecc11c', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/uri-template', 'aliases' => array(), @@ -292,7 +292,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '0ecec0a5d936442e91288c31eaef178b092fe09a', + 'reference' => 'e0c280b0939edd09537e973f7f9c4acd3d6a27ea', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -392,9 +392,9 @@ 'dev_requirement' => false, ), 'php-opencloud/openstack' => array( - 'pretty_version' => 'v3.2.1', - 'version' => '3.2.1.0', - 'reference' => '42e2d09b9368becb6fde6dac17854132fcf77a5c', + 'pretty_version' => 'v3.10.0', + 'version' => '3.10.0.0', + 'reference' => '2ed9c10badd8eb2645870a7d1f6e9dabe809d6aa', 'type' => 'library', 'install_path' => __DIR__ . '/../php-opencloud/openstack', 'aliases' => array(), diff --git a/guzzlehttp/uri-template/LICENSE b/guzzlehttp/uri-template/LICENSE new file mode 100644 index 000000000..e70120fcc --- /dev/null +++ b/guzzlehttp/uri-template/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2014 Michael Dowling +Copyright (c) 2020 George Mponos +Copyright (c) 2020 Graham Campbell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/guzzlehttp/uri-template/LICENSE.md b/guzzlehttp/uri-template/LICENSE.md deleted file mode 100644 index 68902646b..000000000 --- a/guzzlehttp/uri-template/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -# The MIT License (MIT) - -Copyright (c) 2020 George Mponos - -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. diff --git a/guzzlehttp/uri-template/src/UriTemplate.php b/guzzlehttp/uri-template/src/UriTemplate.php index 31915f4d6..e848cd3b6 100644 --- a/guzzlehttp/uri-template/src/UriTemplate.php +++ b/guzzlehttp/uri-template/src/UriTemplate.php @@ -7,7 +7,7 @@ /** * Expands URI templates. Userland implementation of PECL uri_template. * - * @link http://tools.ietf.org/html/rfc6570 + * @see https://datatracker.ietf.org/doc/html/rfc6570 */ final class UriTemplate { @@ -132,7 +132,6 @@ private static function expandMatch(array $matches, array $variables): string continue; } - /** @var mixed */ $variable = $variables[$value['value']]; $actuallyUseQuery = $useQuery; $expanded = ''; @@ -169,7 +168,7 @@ private static function expandMatch(array $matches, array $variables): string } } - /** @var string */ + /** @var string $var */ $kvp[$key] = $var; } @@ -206,7 +205,7 @@ private static function expandMatch(array $matches, array $variables): string } if ($actuallyUseQuery) { - if (!$expanded && $joiner !== '&') { + if ($expanded === '' && $joiner !== '&') { $expanded = $value['value']; } else { $expanded = \sprintf('%s=%s', $value['value'], $expanded); diff --git a/php-opencloud/openstack/LICENSE b/php-opencloud/openstack/LICENSE index 5ddbb84c7..f8ff464bd 100644 --- a/php-opencloud/openstack/LICENSE +++ b/php-opencloud/openstack/LICENSE @@ -1,4 +1,192 @@ - Copyright 2012-2016 Rackspace US, Inc. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016-2023 PHP OpenCloud Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -10,7 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. - - All contributions to this repository are covered under the same license, - terms, and conditions. + limitations under the License. \ No newline at end of file diff --git a/php-opencloud/openstack/src/BlockStorage/v2/Models/QuotaSet.php b/php-opencloud/openstack/src/BlockStorage/v2/Models/QuotaSet.php index d28052484..c603bc28e 100644 --- a/php-opencloud/openstack/src/BlockStorage/v2/Models/QuotaSet.php +++ b/php-opencloud/openstack/src/BlockStorage/v2/Models/QuotaSet.php @@ -58,27 +58,18 @@ class QuotaSet extends OperatorResource implements Retrievable, Updateable, Dele protected $resourceKey = 'quota_set'; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string) $this->tenantId]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putQuotaSet()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $response = $this->executeWithState($this->api->deleteQuotaSet()); diff --git a/php-opencloud/openstack/src/BlockStorage/v2/Models/Snapshot.php b/php-opencloud/openstack/src/BlockStorage/v2/Models/Snapshot.php index f36dbeba2..f05a403b6 100644 --- a/php-opencloud/openstack/src/BlockStorage/v2/Models/Snapshot.php +++ b/php-opencloud/openstack/src/BlockStorage/v2/Models/Snapshot.php @@ -59,9 +59,6 @@ class Snapshot extends OperatorResource implements Listable, Creatable, Updateab 'os-extended-snapshot-attributes:project_id' => 'projectId', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/BlockStorage/v2/Models/Volume.php b/php-opencloud/openstack/src/BlockStorage/v2/Models/Volume.php index 55e886b6e..1aec74ab1 100644 --- a/php-opencloud/openstack/src/BlockStorage/v2/Models/Volume.php +++ b/php-opencloud/openstack/src/BlockStorage/v2/Models/Volume.php @@ -85,9 +85,6 @@ class Volume extends OperatorResource implements Creatable, Listable, Updateable 'volume_image_metadata' => 'volumeImageMetadata', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -177,12 +174,6 @@ public function setImageMetadata(array $metadata) /** * Administrator only. Resets the status, attach status, and migration status for a volume. Specify the os-reset_status action in the request body. * - * @param array $options - * - * $options['status'] = (string) The volume status. - * $options['migrationStatus'] = (string) The volume migration status. - * $options['attachStatus'] = (string) The volume attach status. [OPTIONAL] - * * @see https://developer.openstack.org/api-ref/block-storage/v2/index.html#volume-actions-volumes-action */ public function resetStatus(array $options) diff --git a/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php b/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php index c54425e2f..120cfa732 100644 --- a/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php +++ b/php-opencloud/openstack/src/BlockStorage/v2/Models/VolumeType.php @@ -8,12 +8,13 @@ use OpenStack\Common\Resource\Deletable; use OpenStack\Common\Resource\Listable; use OpenStack\Common\Resource\OperatorResource; +use OpenStack\Common\Resource\Retrievable; use OpenStack\Common\Resource\Updateable; /** * @property \OpenStack\BlockStorage\v2\Api $api */ -class VolumeType extends OperatorResource implements Listable, Creatable, Updateable, Deletable +class VolumeType extends OperatorResource implements Listable, Creatable, Updateable, Deletable, Retrievable { /** @var string */ public $id; @@ -34,6 +35,12 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } + public function retrieve() + { + $response = $this->executeWithState($this->api->getType()); + $this->populateFromResponse($response); + } + public function update() { $this->executeWithState($this->api->putType()); diff --git a/php-opencloud/openstack/src/BlockStorage/v2/Service.php b/php-opencloud/openstack/src/BlockStorage/v2/Service.php index 5df79b550..b509a6663 100644 --- a/php-opencloud/openstack/src/BlockStorage/v2/Service.php +++ b/php-opencloud/openstack/src/BlockStorage/v2/Service.php @@ -11,7 +11,7 @@ use OpenStack\Common\Service\AbstractService; /** - * @property \OpenStack\BlockStorage\v2\Api $api + * @property Api $api */ class Service extends AbstractService { @@ -31,6 +31,8 @@ public function createVolume(array $userOptions): Volume * * @param bool $detail if set to TRUE, more information will be returned * @param array $userOptions {@see Api::getVolumes} + * + * @return \Generator */ public function listVolumes(bool $detail = false, array $userOptions = []): \Generator { @@ -58,6 +60,9 @@ public function createVolumeType(array $userOptions): VolumeType return $this->model(VolumeType::class)->create($userOptions); } + /** + * @return \Generator + */ public function listVolumeTypes(): \Generator { return $this->model(VolumeType::class)->enumerate($this->api->getTypes(), []); @@ -79,6 +84,9 @@ public function createSnapshot(array $userOptions): Snapshot return $this->model(Snapshot::class)->create($userOptions); } + /** + * @return \Generator + */ public function listSnapshots(bool $detail = false, array $userOptions = []): \Generator { $def = (true === $detail) ? $this->api->getSnapshotsDetail() : $this->api->getSnapshots(); diff --git a/php-opencloud/openstack/src/BlockStorage/v3/Api.php b/php-opencloud/openstack/src/BlockStorage/v3/Api.php new file mode 100644 index 000000000..c0ece2749 --- /dev/null +++ b/php-opencloud/openstack/src/BlockStorage/v3/Api.php @@ -0,0 +1,7 @@ + self::STRING_TYPE, 'location' => self::QUERY, + 'sentAs' => 'sort_dir', 'description' => 'Sorts by one or more sets of attribute and sort direction combinations.', 'enum' => ['asc', 'desc'], ]; @@ -95,6 +96,7 @@ public function sortKey(): array return [ 'type' => self::STRING_TYPE, 'location' => self::QUERY, + 'sentAs' => 'sort_key', 'description' => 'Sorts by one or more sets of attribute and sort direction combinations.', ]; } diff --git a/php-opencloud/openstack/src/Common/Api/ApiInterface.php b/php-opencloud/openstack/src/Common/Api/ApiInterface.php index 149c1f03c..86284b42d 100644 --- a/php-opencloud/openstack/src/Common/Api/ApiInterface.php +++ b/php-opencloud/openstack/src/Common/Api/ApiInterface.php @@ -7,7 +7,7 @@ /** * All classes which implement this interface are a data representation of a remote OpenStack API. * They do not execute functionality, but instead return data for each API operation for other parts - * of the SDK to use. Usually, the data is injected into {@see OpenStack\Common\Api\Operation} objects. + * of the SDK to use. Usually, the data is injected into {@see Operation} objects. * The operation is then serialized into a {@see GuzzleHttp\Message\Request} and sent to the API. * * The reason for storing all the API-specific data is to decouple service information from client diff --git a/php-opencloud/openstack/src/Common/Api/Operation.php b/php-opencloud/openstack/src/Common/Api/Operation.php index 26278927b..25c6eb44f 100644 --- a/php-opencloud/openstack/src/Common/Api/Operation.php +++ b/php-opencloud/openstack/src/Common/Api/Operation.php @@ -27,6 +27,9 @@ class Operation /** @var []Parameter The parameters of this operation */ private $params; + /** @var bool Whether this operation should skip authentication */ + private $skipAuth; + /** * @param array $definition The data definition (in array form) that will populate this * operation. Usually this is retrieved from an {@see ApiInterface} @@ -41,7 +44,8 @@ public function __construct(array $definition) $this->jsonKey = $definition['jsonKey']; } - $this->params = self::toParamArray($definition['params']); + $this->params = self::toParamArray($definition['params']); + $this->skipAuth = $definition['skipAuth'] ?? false; } public function getPath(): string @@ -54,10 +58,18 @@ public function getMethod(): string return $this->method; } + /** + * Indicates if operation must be run without authentication. This is useful for getting authentication tokens. + */ + public function getSkipAuth(): bool + { + return $this->skipAuth; + } + /** * Indicates whether this operation supports a parameter. * - * @param $key The name of a parameter + * @param string $key The name of a parameter */ public function hasParam(string $key): bool { @@ -65,8 +77,6 @@ public function hasParam(string $key): bool } /** - * @param $name - * * @return Parameter */ public function getParam(string $name) diff --git a/php-opencloud/openstack/src/Common/Api/OperatorTrait.php b/php-opencloud/openstack/src/Common/Api/OperatorTrait.php index 1555c21df..710bd8add 100644 --- a/php-opencloud/openstack/src/Common/Api/OperatorTrait.php +++ b/php-opencloud/openstack/src/Common/Api/OperatorTrait.php @@ -20,9 +20,6 @@ trait OperatorTrait /** @var ApiInterface */ protected $api; - /** - * {@inheritdoc} - */ public function __construct(ClientInterface $client, ApiInterface $api) { $this->client = $client; @@ -58,12 +55,12 @@ public function __debugInfo() * {@see Promise} object. In order for this to happen, the called methods need to be in the * following format: `createAsync`, where `create` is the sequential method being wrapped. * - * @param $methodName the name of the method being invoked - * @param $args the arguments to be passed to the sequential method - * - * @throws \RuntimeException If method does not exist + * @param string $methodName the name of the method being invoked + * @param array $args the arguments to be passed to the sequential method * * @return Promise + * + * @throws \RuntimeException If method does not exist */ public function __call($methodName, $args) { @@ -90,19 +87,11 @@ function () use (&$promise, $realMethod, $args) { throw $e($methodName); } - /** - * {@inheritdoc} - */ public function getOperation(array $definition): Operation { return new Operation($definition); } - /** - * @return mixed - * - * @throws \Exception - */ protected function sendRequest(Operation $operation, array $userValues = [], bool $async = false) { $operation->validate($userValues); @@ -110,34 +99,27 @@ protected function sendRequest(Operation $operation, array $userValues = [], boo $options = (new RequestSerializer())->serializeOptions($operation, $userValues); $method = $async ? 'requestAsync' : 'request'; - $uri = Utils::uri_template($operation->getPath(), $userValues); + $uri = Utils::uri_template($operation->getPath(), $userValues); if (array_key_exists('requestOptions', $userValues)) { $options += $userValues['requestOptions']; } + $options['openstack.skip_auth'] = $operation->getSkipAuth(); + return $this->client->$method($operation->getMethod(), $uri, $options); } - /** - * {@inheritdoc} - */ public function execute(array $definition, array $userValues = []): ResponseInterface { return $this->sendRequest($this->getOperation($definition), $userValues); } - /** - * {@inheritdoc} - */ public function executeAsync(array $definition, array $userValues = []): PromiseInterface { return $this->sendRequest($this->getOperation($definition), $userValues, true); } - /** - * {@inheritdoc} - */ public function model(string $class, $data = null): ResourceInterface { $model = new $class($this->client, $this->api); diff --git a/php-opencloud/openstack/src/Common/Api/Parameter.php b/php-opencloud/openstack/src/Common/Api/Parameter.php index 5d46d7e3c..bfa8d2e0d 100644 --- a/php-opencloud/openstack/src/Common/Api/Parameter.php +++ b/php-opencloud/openstack/src/Common/Api/Parameter.php @@ -35,7 +35,7 @@ class Parameter { use HydratorStrategyTrait; - const DEFAULT_LOCATION = 'json'; + public const DEFAULT_LOCATION = 'json'; /** * The human-friendly name of the parameter. This is what the user will input. @@ -304,8 +304,6 @@ public function getLocation(): string /** * Verifies whether the given location matches the parameter's location. - * - * @param $value */ public function hasLocation($value): bool { diff --git a/php-opencloud/openstack/src/Common/ArrayAccessTrait.php b/php-opencloud/openstack/src/Common/ArrayAccessTrait.php index cbd709dff..fa9e42f62 100644 --- a/php-opencloud/openstack/src/Common/ArrayAccessTrait.php +++ b/php-opencloud/openstack/src/Common/ArrayAccessTrait.php @@ -20,7 +20,6 @@ trait ArrayAccessTrait * Sets an internal key with a value. * * @param string $offset - * @param mixed $value */ public function offsetSet($offset, $value) { diff --git a/php-opencloud/openstack/src/Common/Auth/AuthHandler.php b/php-opencloud/openstack/src/Common/Auth/AuthHandler.php index de396cc0e..71a58721c 100644 --- a/php-opencloud/openstack/src/Common/Auth/AuthHandler.php +++ b/php-opencloud/openstack/src/Common/Auth/AuthHandler.php @@ -43,7 +43,12 @@ public function __invoke(RequestInterface $request, array $options) { $fn = $this->nextHandler; - if ($this->shouldIgnore($request)) { + if (!isset($options['openstack.skip_auth'])) { + // Deprecated. Left for backward compatibility only. + if ($this->shouldIgnore($request)) { + return $fn($request, $options); + } + } elseif ($options['openstack.skip_auth']) { return $fn($request, $options); } diff --git a/php-opencloud/openstack/src/Common/Auth/IdentityService.php b/php-opencloud/openstack/src/Common/Auth/IdentityService.php index 949b11035..c9f86849a 100644 --- a/php-opencloud/openstack/src/Common/Auth/IdentityService.php +++ b/php-opencloud/openstack/src/Common/Auth/IdentityService.php @@ -9,7 +9,7 @@ interface IdentityService /** * Authenticates and retrieves back a token and catalog. * - * @return array The FIRST key is {@see Token} instance, the SECOND key is a {@see Catalog} instance + * @return array{0: \OpenStack\Common\Auth\Token, 1: string} The FIRST key is {@see Token} instance, the SECOND key is a URL of the service */ public function authenticate(array $options): array; } diff --git a/php-opencloud/openstack/src/Common/Error/Builder.php b/php-opencloud/openstack/src/Common/Error/Builder.php index f7ba9615c..f2717aa1a 100644 --- a/php-opencloud/openstack/src/Common/Error/Builder.php +++ b/php-opencloud/openstack/src/Common/Error/Builder.php @@ -19,6 +19,8 @@ */ class Builder { + public const MAX_BODY_LENGTH = 5000; + /** * The default domain to use for further link documentation. * @@ -33,9 +35,6 @@ class Builder */ private $client; - /** - * @param ClientInterface $client - */ public function __construct(ClientInterface $client = null) { $this->client = $client ?: new Client(); @@ -43,8 +42,6 @@ public function __construct(ClientInterface $client = null) /** * Internal method used when outputting headers in the error description. - * - * @param $name */ private function header(string $name): string { @@ -71,30 +68,46 @@ private function linkIsValid(string $link): bool /** * @codeCoverageIgnore */ - public function str(MessageInterface $message): string + public function str(MessageInterface $message, int $verbosity = 0): string { if ($message instanceof RequestInterface) { - $msg = trim($message->getMethod().' ' - .$message->getRequestTarget()) - .' HTTP/'.$message->getProtocolVersion(); + $msg = trim($message->getMethod().' '.$message->getRequestTarget()); + $msg .= ' HTTP/'.$message->getProtocolVersion(); if (!$message->hasHeader('host')) { $msg .= "\r\nHost: ".$message->getUri()->getHost(); } - } elseif ($message instanceof ResponseInterface) { - $msg = 'HTTP/'.$message->getProtocolVersion().' ' - .$message->getStatusCode().' ' - .$message->getReasonPhrase(); + } else { + if ($message instanceof ResponseInterface) { + $msg = 'HTTP/'.$message->getProtocolVersion().' ' + .$message->getStatusCode().' ' + .$message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + } + + if ($verbosity < 1) { + return $msg; } foreach ($message->getHeaders() as $name => $values) { $msg .= "\r\n{$name}: ".implode(', ', $values); } - if (ini_get('memory_limit') < 0 || $message->getBody()->getSize() < ini_get('memory_limit')) { - $msg .= "\r\n\r\n".$message->getBody(); + if ($verbosity < 2) { + return $msg; + } + + $contentType = strtolower($message->getHeaderLine('content-type')); + if (false !== strpos($contentType, 'application/json')) { + $body = $message->getBody()->read(self::MAX_BODY_LENGTH); + $msg .= "\r\n\r\n".$body; + if ('' !== $message->getBody()->read(1)) { + $msg .= '...'; + } } - return $msg; + return trim($msg); } /** @@ -103,7 +116,7 @@ public function str(MessageInterface $message): string * @param RequestInterface $request The faulty request * @param ResponseInterface $response The error-filled response */ - public function httpError(RequestInterface $request, ResponseInterface $response): BadResponseError + public function httpError(RequestInterface $request, ResponseInterface $response, int $verbosity = 0): BadResponseError { $message = $this->header('HTTP Error'); @@ -114,10 +127,10 @@ public function httpError(RequestInterface $request, ResponseInterface $response ); $message .= $this->header('Request'); - $message .= trim($this->str($request)).PHP_EOL.PHP_EOL; + $message .= $this->str($request, $verbosity).PHP_EOL.PHP_EOL; $message .= $this->header('Response'); - $message .= trim($this->str($response)).PHP_EOL.PHP_EOL; + $message .= $this->str($response, $verbosity).PHP_EOL.PHP_EOL; $message .= $this->header('Further information'); $message .= $this->getStatusCodeMessage($response->getStatusCode()); diff --git a/php-opencloud/openstack/src/Common/JsonPath.php b/php-opencloud/openstack/src/Common/JsonPath.php index 346da5eda..18019c352 100644 --- a/php-opencloud/openstack/src/Common/JsonPath.php +++ b/php-opencloud/openstack/src/Common/JsonPath.php @@ -50,10 +50,6 @@ public function set(string $path, $value) /** * Internal method for recursive calls. * - * @param $path - * @param $value - * @param $json - * * @return mixed */ private function setPath(string $path, $value, array $json): array @@ -76,8 +72,6 @@ private function setPath(string $path, $value, array $json): array /** * Return the updated structure. - * - * @return mixed */ public function getStructure() { @@ -87,8 +81,6 @@ public function getStructure() /** * Get a path's value. If no path can be matched, NULL is returned. * - * @param $path - * * @return mixed|null */ public function get(string $path) @@ -98,9 +90,6 @@ public function get(string $path) /** * Internal method for recursion. - * - * @param $path - * @param $json */ private function getPath(string $path, $json) { diff --git a/php-opencloud/openstack/src/Common/JsonSchema/JsonPatch.php b/php-opencloud/openstack/src/Common/JsonSchema/JsonPatch.php index 55f93abe3..cce7c3289 100644 --- a/php-opencloud/openstack/src/Common/JsonSchema/JsonPatch.php +++ b/php-opencloud/openstack/src/Common/JsonSchema/JsonPatch.php @@ -6,9 +6,9 @@ class JsonPatch { - const OP_ADD = 'add'; - const OP_REPLACE = 'replace'; - const OP_REMOVE = 'remove'; + public const OP_ADD = 'add'; + public const OP_REPLACE = 'replace'; + public const OP_REMOVE = 'remove'; public static function diff($src, $dest) { diff --git a/php-opencloud/openstack/src/Common/Resource/AbstractResource.php b/php-opencloud/openstack/src/Common/Resource/AbstractResource.php index 2dcf5632f..75f2b1bae 100644 --- a/php-opencloud/openstack/src/Common/Resource/AbstractResource.php +++ b/php-opencloud/openstack/src/Common/Resource/AbstractResource.php @@ -55,7 +55,7 @@ public function populateFromResponse(ResponseInterface $response) /** * Populates the current resource from a data array. * - * @return mixed|void + * @return self */ public function populateFromArray(array $array) { diff --git a/php-opencloud/openstack/src/Common/Resource/Alias.php b/php-opencloud/openstack/src/Common/Resource/Alias.php index 69746f229..ebd7a6bfd 100644 --- a/php-opencloud/openstack/src/Common/Resource/Alias.php +++ b/php-opencloud/openstack/src/Common/Resource/Alias.php @@ -33,11 +33,6 @@ public function __construct(string $propertyName, string $className = null, bool $this->className = $className && class_exists($className) ? $className : null; } - /** - * @param mixed $value - * - * @return mixed - */ public function getValue(ResourceInterface $resource, $value) { if (null === $value || !$this->className) { diff --git a/php-opencloud/openstack/src/Common/Resource/Creatable.php b/php-opencloud/openstack/src/Common/Resource/Creatable.php index 80ac7570d..d07280b09 100644 --- a/php-opencloud/openstack/src/Common/Resource/Creatable.php +++ b/php-opencloud/openstack/src/Common/Resource/Creatable.php @@ -12,7 +12,7 @@ interface Creatable /** * Create a new resource according to the configuration set in the options. * - * @return self + * @return static */ public function create(array $userOptions): Creatable; } diff --git a/php-opencloud/openstack/src/Common/Resource/HasWaiterTrait.php b/php-opencloud/openstack/src/Common/Resource/HasWaiterTrait.php index 7747fdbfb..b5ca6e46a 100644 --- a/php-opencloud/openstack/src/Common/Resource/HasWaiterTrait.php +++ b/php-opencloud/openstack/src/Common/Resource/HasWaiterTrait.php @@ -19,10 +19,10 @@ trait HasWaiterTrait * will enter a loop, requesting feedback from the remote API until it sends back an appropriate * status. * - * @param string $status The state to be reached - * @param int $timeout The maximum timeout. If the total time taken by the waiter has reached - * or exceed this timeout, the blocking operation will immediately cease. - * @param int $sleepPeriod the amount of time to pause between each HTTP request + * @param string $status The state to be reached + * @param bool|int $timeout The maximum timeout. If the total time taken by the waiter has reached + * or exceed this timeout, the blocking operation will immediately cease. + * @param int $sleepPeriod the amount of time to pause between each HTTP request */ public function waitUntil(string $status, $timeout = 60, int $sleepPeriod = 1) { diff --git a/php-opencloud/openstack/src/Common/Resource/Listable.php b/php-opencloud/openstack/src/Common/Resource/Listable.php index 9b8744ee7..a19499e3d 100644 --- a/php-opencloud/openstack/src/Common/Resource/Listable.php +++ b/php-opencloud/openstack/src/Common/Resource/Listable.php @@ -22,7 +22,7 @@ interface Listable * @param array $userVals The user values * @param callable $mapFn an optional callback that will be executed on every resource iteration * - * @returns void + * @returns \Generator */ public function enumerate(array $def, array $userVals = [], callable $mapFn = null); } diff --git a/php-opencloud/openstack/src/Common/Resource/OperatorResource.php b/php-opencloud/openstack/src/Common/Resource/OperatorResource.php index 35cf31864..894925986 100644 --- a/php-opencloud/openstack/src/Common/Resource/OperatorResource.php +++ b/php-opencloud/openstack/src/Common/Resource/OperatorResource.php @@ -11,7 +11,7 @@ abstract class OperatorResource extends AbstractResource implements OperatorInte { use OperatorTrait; - const DEFAULT_MARKER_KEY = 'id'; + public const DEFAULT_MARKER_KEY = 'id'; /** * The key that indicates how the API nests resource collections. For example, when @@ -47,9 +47,6 @@ protected function getHttpBaseUrl() return $this->client->getConfig('base_uri'); } - /** - * @return mixed - */ public function executeWithState(array $definition) { return $this->execute($definition, $this->getAttrs(array_keys($definition['params']))); @@ -68,7 +65,9 @@ private function getResourcesKey(): string } /** - * {@inheritdoc} + * Creates a generator for enumerating over a collection of resources returned by the request. + * + * @returns \Generator */ public function enumerate(array $def, array $userVals = [], callable $mapFn = null): \Generator { @@ -82,7 +81,7 @@ public function enumerate(array $def, array $userVals = [], callable $mapFn = nu return $this->sendRequest($operation, $userVals); }; - $resourceFn = function (array $data) { + $resourceFn = function (array $data) { $resource = $this->newInstance(); $resource->populateFromArray($data); @@ -101,6 +100,11 @@ public function enumerate(array $def, array $userVals = [], callable $mapFn = nu return $iterator(); } + /** + * Extracts multiple instances of the current resource from a response. + * + * @return array + */ public function extractMultipleInstances(ResponseInterface $response, string $key = null): array { $key = $key ?: $this->getResourcesKey(); @@ -123,9 +127,6 @@ protected function getService() return new $service($this->client, $this->api); } - /** - * {@inheritdoc} - */ public function model(string $class, $data = null): ResourceInterface { $model = new $class($this->client, $this->api); diff --git a/php-opencloud/openstack/src/Common/Resource/ResourceInterface.php b/php-opencloud/openstack/src/Common/Resource/ResourceInterface.php index ae3249dd0..4e51c97e5 100644 --- a/php-opencloud/openstack/src/Common/Resource/ResourceInterface.php +++ b/php-opencloud/openstack/src/Common/Resource/ResourceInterface.php @@ -20,16 +20,18 @@ interface ResourceInterface public function populateFromResponse(ResponseInterface $response); /** - * @return mixed + * @return self */ public function populateFromArray(array $data); /** - * @param string $name the name of the model class - * @param mixed $data either a {@see ResponseInterface} or data array that will populate the newly - * created model class + * @template T of \OpenStack\Common\Resource\ResourceInterface + * + * @param class-string $class the name of the model class + * @param mixed $data either a {@see ResponseInterface} or data array that will populate the newly + * created model class * - * @return \OpenStack\Common\Resource\ResourceInterface + * @return T */ public function model(string $class, $data = null): ResourceInterface; } diff --git a/php-opencloud/openstack/src/Common/Service/Builder.php b/php-opencloud/openstack/src/Common/Service/Builder.php index 8103aca7c..f63eefc18 100644 --- a/php-opencloud/openstack/src/Common/Service/Builder.php +++ b/php-opencloud/openstack/src/Common/Service/Builder.php @@ -6,11 +6,9 @@ use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use GuzzleHttp\Middleware as GuzzleMiddleware; +use GuzzleHttp\HandlerStack; use OpenStack\Common\Auth\IdentityService; -use OpenStack\Common\Auth\Token; -use OpenStack\Common\Transport\HandlerStack; -use OpenStack\Common\Transport\Middleware; +use OpenStack\Common\Transport\HandlerStackFactory; use OpenStack\Common\Transport\Utils; /** @@ -69,10 +67,6 @@ private function getClasses($namespace) * * @param string $namespace The namespace of the service * @param array $serviceOptions The service-specific options to use - * - * @return \OpenStack\Common\Service\ServiceInterface - * - * @throws \Exception */ public function createService(string $namespace, array $serviceOptions = []): ServiceInterface { @@ -81,26 +75,24 @@ public function createService(string $namespace, array $serviceOptions = []): Se $this->stockAuthHandler($options); $this->stockHttpClient($options, $namespace); - list($apiClass, $serviceClass) = $this->getClasses($namespace); + [$apiClass, $serviceClass] = $this->getClasses($namespace); return new $serviceClass($options['httpClient'], new $apiClass()); } - private function stockHttpClient(array &$options, string $serviceName) + private function stockHttpClient(array &$options, string $serviceName): void { if (!isset($options['httpClient']) || !($options['httpClient'] instanceof ClientInterface)) { if (false !== stripos($serviceName, 'identity')) { $baseUrl = $options['authUrl']; - $stack = $this->getStack($options['authHandler']); + $token = null; } else { - list($token, $baseUrl) = $options['identityService']->authenticate($options); - $stack = $this->getStack($options['authHandler'], $token); + [$token, $baseUrl] = $options['identityService']->authenticate($options); } + $stack = HandlerStackFactory::createWithOptions(array_merge($options, ['token' => $token])); $microVersion = $options['microVersion'] ?? null; - $this->addDebugMiddleware($options, $stack); - $options['httpClient'] = $this->httpClient($baseUrl, $stack, $options['catalogType'], $microVersion); } } @@ -108,20 +100,7 @@ private function stockHttpClient(array &$options, string $serviceName) /** * @codeCoverageIgnore */ - private function addDebugMiddleware(array $options, HandlerStack &$stack) - { - if (!empty($options['debugLog']) - && !empty($options['logger']) - && !empty($options['messageFormatter']) - ) { - $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); - } - } - - /** - * @codeCoverageIgnore - */ - private function stockAuthHandler(array &$options) + private function stockAuthHandler(array &$options): void { if (!isset($options['authHandler'])) { $options['authHandler'] = function () use ($options) { @@ -130,14 +109,6 @@ private function stockAuthHandler(array &$options) } } - private function getStack(callable $authHandler, Token $token = null): HandlerStack - { - $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($authHandler, $token)); - - return $stack; - } - private function httpClient(string $baseUrl, HandlerStack $stack, string $serviceType = null, string $microVersion = null): ClientInterface { $clientOptions = [ diff --git a/php-opencloud/openstack/src/Common/Transport/HandlerStack.php b/php-opencloud/openstack/src/Common/Transport/HandlerStack.php index d0205d58d..fd500be50 100644 --- a/php-opencloud/openstack/src/Common/Transport/HandlerStack.php +++ b/php-opencloud/openstack/src/Common/Transport/HandlerStack.php @@ -1,20 +1,17 @@ push(Middleware::httpErrors(), 'http_errors'); - $stack->push(Middleware::prepareBody(), 'prepare_body'); - - return $stack; + return HandlerStackFactory::create($handler); } } diff --git a/php-opencloud/openstack/src/Common/Transport/HandlerStackFactory.php b/php-opencloud/openstack/src/Common/Transport/HandlerStackFactory.php new file mode 100644 index 000000000..a2324d581 --- /dev/null +++ b/php-opencloud/openstack/src/Common/Transport/HandlerStackFactory.php @@ -0,0 +1,58 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + + return $stack; + } + + /** + * Creates a new HandlerStack with the given options. + * + * @param array{ + * handler: callable, + * authHandler: callable, + * token: \OpenStack\Common\Auth\Token, + * errorVerbosity: int, + * debugLog: bool, + * logger: \Psr\Log\LoggerInterface, + * messageFormatter: \GuzzleHttp\MessageFormatter + * } $options + */ + public static function createWithOptions(array $options): HandlerStack + { + $stack = new HandlerStack($options['handler'] ?? Utils::chooseHandler()); + $stack->push(Middleware::httpErrors($options['errorVerbosity'] ?? 0), 'http_errors'); + $stack->push(GuzzleMiddleware::prepareBody(), 'prepare_body'); + + if (!empty($options['authHandler'])) { + $stack->push(Middleware::authHandler($options['authHandler'], $options['token'] ?? null)); + } + + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $logMiddleware = GuzzleMiddleware::log($options['logger'], $options['messageFormatter']); + $stack->push($logMiddleware, 'logger'); + } + + return $stack; + } +} diff --git a/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php b/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php index 5cd2e25bf..0ea5750ab 100644 --- a/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php +++ b/php-opencloud/openstack/src/Common/Transport/JsonSerializer.php @@ -87,6 +87,7 @@ public function stockJson(Parameter $param, $userValue, array $json): array } elseif ($param->isObject()) { $userValue = $this->stockObjectJson($param, $this->serializeObjectValue($userValue)); } + // Populate the final value return $this->stockValue($param, $userValue, $json); } @@ -97,7 +98,7 @@ private function serializeObjectValue($value) if ($value instanceof Serializable) { $value = $value->serialize(); } elseif (!($value instanceof \stdClass)) { - throw new \InvalidArgumentException(sprintf('When an object value is provided, it must either be \stdClass or implement the Serializable '.'interface, you provided %s', print_r($value, true))); + throw new \InvalidArgumentException(sprintf('When an object value is provided, it must either be \stdClass or implement the Serializable interface, you provided %s', print_r($value, true))); } } diff --git a/php-opencloud/openstack/src/Common/Transport/Middleware.php b/php-opencloud/openstack/src/Common/Transport/Middleware.php index 5f3077ca4..d11667ef4 100644 --- a/php-opencloud/openstack/src/Common/Transport/Middleware.php +++ b/php-opencloud/openstack/src/Common/Transport/Middleware.php @@ -15,25 +15,22 @@ final class Middleware { - public static function httpErrors(): callable + public static function httpErrors(int $verbosity = 0): callable { - return function (callable $handler) { - return function ($request, array $options) use ($handler) { + return function (callable $handler) use ($verbosity) { + return function ($request, array $options) use ($handler, $verbosity) { return $handler($request, $options)->then( - function (ResponseInterface $response) use ($request) { + function (ResponseInterface $response) use ($request, $verbosity) { if ($response->getStatusCode() < 400) { return $response; } - throw (new Builder())->httpError($request, $response); + throw (new Builder())->httpError($request, $response, $verbosity); } ); }; }; } - /** - * @param Token $token - */ public static function authHandler(callable $tokenGenerator, Token $token = null): callable { return function (callable $handler) use ($tokenGenerator, $token) { diff --git a/php-opencloud/openstack/src/Common/Transport/Utils.php b/php-opencloud/openstack/src/Common/Transport/Utils.php index 35ae5842a..6a52a81a2 100644 --- a/php-opencloud/openstack/src/Common/Transport/Utils.php +++ b/php-opencloud/openstack/src/Common/Transport/Utils.php @@ -69,8 +69,6 @@ public static function normalizeUrl(string $url): string /** * Add an unlimited list of paths to a given URI. - * - * @param ...$paths */ public static function addPaths(UriInterface $uri, ...$paths): UriInterface { diff --git a/php-opencloud/openstack/src/Compute/v2/Api.php b/php-opencloud/openstack/src/Compute/v2/Api.php index 2a8dde1a9..ee4adfa00 100644 --- a/php-opencloud/openstack/src/Compute/v2/Api.php +++ b/php-opencloud/openstack/src/Compute/v2/Api.php @@ -332,6 +332,30 @@ public function stopServer(): array ]; } + public function resumeServer(): array + { + return [ + 'method' => 'POST', + 'path' => 'servers/{id}/action', + 'params' => [ + 'id' => $this->params->urlId('server'), + 'resume' => $this->params->nullAction(), + ], + ]; + } + + public function suspendServer(): array + { + return [ + 'method' => 'POST', + 'path' => 'servers/{id}/action', + 'params' => [ + 'id' => $this->params->urlId('server'), + 'suspend' => $this->params->nullAction(), + ], + ]; + } + public function rebuildServer(): array { return [ diff --git a/php-opencloud/openstack/src/Compute/v2/Enum.php b/php-opencloud/openstack/src/Compute/v2/Enum.php index 84e8f5912..378445e60 100644 --- a/php-opencloud/openstack/src/Compute/v2/Enum.php +++ b/php-opencloud/openstack/src/Compute/v2/Enum.php @@ -9,11 +9,11 @@ */ abstract class Enum { - const REBOOT_SOFT = 'SOFT'; - const REBOOT_HARD = 'HARD'; - const CONSOLE_NOVNC = 'novnc'; - const CONSOLE_XVPNC = 'xvpvnc'; - const CONSOLE_RDP_HTML5 = 'rdp-html5'; - const CONSOLE_SPICE_HTML5 = 'spice-html5'; - const CONSOLE_SERIAL = 'serial'; + public const REBOOT_SOFT = 'SOFT'; + public const REBOOT_HARD = 'HARD'; + public const CONSOLE_NOVNC = 'novnc'; + public const CONSOLE_XVPNC = 'xvpvnc'; + public const CONSOLE_RDP_HTML5 = 'rdp-html5'; + public const CONSOLE_SPICE_HTML5 = 'spice-html5'; + public const CONSOLE_SERIAL = 'serial'; } diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Flavor.php b/php-opencloud/openstack/src/Compute/v2/Models/Flavor.php index 1000aad41..c6ea08b68 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Flavor.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Flavor.php @@ -41,18 +41,12 @@ class Flavor extends OperatorResource implements Listable, Retrievable, Creatabl protected $resourceKey = 'flavor'; protected $resourcesKey = 'flavors'; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getFlavor(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postFlavors(), $userOptions); @@ -60,9 +54,6 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteFlavor(), ['id' => (string) $this->id]); diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Host.php b/php-opencloud/openstack/src/Compute/v2/Models/Host.php index ad6bbc0f1..002502a25 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Host.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Host.php @@ -31,9 +31,6 @@ class Host extends OperatorResource implements Listable, Retrievable 'host_name' => 'name', ]; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getHost(), $this->getAttrs(['name'])); diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Hypervisor.php b/php-opencloud/openstack/src/Compute/v2/Models/Hypervisor.php index 6710f9493..0490c9389 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Hypervisor.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Hypervisor.php @@ -94,9 +94,6 @@ class Hypervisor extends OperatorResource implements Retrievable, Listable 'disk_available_least' => 'diskAvailableLeast', ]; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getHypervisor(), ['id' => (string) $this->id]); diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Image.php b/php-opencloud/openstack/src/Compute/v2/Models/Image.php index 5bd88134b..55fd3e58d 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Image.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Image.php @@ -7,6 +7,7 @@ use OpenStack\Common\Resource\Alias; use OpenStack\Common\Resource\Deletable; use OpenStack\Common\Resource\HasMetadata; +use OpenStack\Common\Resource\HasWaiterTrait; use OpenStack\Common\Resource\Listable; use OpenStack\Common\Resource\OperatorResource; use OpenStack\Common\Resource\Retrievable; @@ -20,6 +21,8 @@ */ class Image extends OperatorResource implements Listable, Retrievable, Deletable, HasMetadata { + use HasWaiterTrait; + /** @var string */ public $id; @@ -53,9 +56,6 @@ class Image extends OperatorResource implements Listable, Retrievable, Deletable protected $resourceKey = 'image'; protected $resourcesKey = 'images'; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -64,18 +64,12 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getImage(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteImage(), ['id' => (string) $this->id]); @@ -120,8 +114,6 @@ public function mergeMetadata(array $metadata) * Retrieve the value for a specific metadata key. * * @param string $key {@see \OpenStack\Compute\v2\Api::getImageMetadataKey} - * - * @return mixed */ public function getMetadataItem(string $key) { diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Keypair.php b/php-opencloud/openstack/src/Compute/v2/Models/Keypair.php index 065052e2c..8584be847 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Keypair.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Keypair.php @@ -40,7 +40,11 @@ class Keypair extends OperatorResource implements Listable, Retrievable, Deletab /** @var string */ public $type; - /** @var string */ + /** + * @var string + * + * @deprecated Left for backward compatibility only. It is not retrieved from the API. + */ public $id; /** @var \DateTimeImmutable */ @@ -56,9 +60,6 @@ class Keypair extends OperatorResource implements Listable, Retrievable, Deletab protected $resourceKey = 'keypair'; protected $resourcesKey = 'keypairs'; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -66,9 +67,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getKeypair(), $this->getAttrs(['name', 'userId'])); @@ -82,17 +80,11 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function populateFromArray(array $array): self { return parent::populateFromArray(Utils::flattenJson($array, $this->resourceKey)); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteKeypair(), ['name' => (string) $this->name]); diff --git a/php-opencloud/openstack/src/Compute/v2/Models/QuotaSet.php b/php-opencloud/openstack/src/Compute/v2/Models/QuotaSet.php index 719375d54..9b44511fb 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/QuotaSet.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/QuotaSet.php @@ -147,27 +147,18 @@ class QuotaSet extends OperatorResource implements Retrievable, Updateable, Dele 'server_groups' => 'serverGroups', ]; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string) $this->tenantId]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $response = $this->executeWithState($this->api->deleteQuotaSet()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putQuotaSet()); diff --git a/php-opencloud/openstack/src/Compute/v2/Models/Server.php b/php-opencloud/openstack/src/Compute/v2/Models/Server.php index e2390fd43..bb7e73ae8 100644 --- a/php-opencloud/openstack/src/Compute/v2/Models/Server.php +++ b/php-opencloud/openstack/src/Compute/v2/Models/Server.php @@ -113,9 +113,6 @@ class Server extends OperatorResource implements Creatable, Updateable, Deletabl 'OS-EXT-SRV-ATTR:hypervisor_hostname' => 'hypervisorHostname', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -127,8 +124,6 @@ protected function getAliases(): array } /** - * {@inheritdoc} - * * @param array $userOptions {@see \OpenStack\Compute\v2\Api::postServer} */ public function create(array $userOptions): Creatable @@ -142,26 +137,17 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->execute($this->api->putServer(), $this->getAttrs(['id', 'name', 'ipv4', 'ipv6'])); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteServer(), $this->getAttrs(['id'])); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getServer(), $this->getAttrs(['id'])); @@ -199,7 +185,7 @@ public function resetState() */ public function reboot(string $type = Enum::REBOOT_SOFT) { - if (!in_array($type, ['SOFT', 'HARD'])) { + if (!in_array($type, [Enum::REBOOT_SOFT, Enum::REBOOT_HARD])) { throw new \RuntimeException('Reboot type must either be SOFT or HARD'); } @@ -231,6 +217,28 @@ public function stop() ]); } + /** + * Resumes server. + */ + public function resume(): void + { + $this->execute($this->api->resumeServer(), [ + 'id' => $this->id, + 'resume' => null, + ]); + } + + /** + * Suspends server. + */ + public function suspend(): void + { + $this->execute($this->api->suspendServer(), [ + 'id' => $this->id, + 'suspend' => null, + ]); + } + /** * Rebuilds the server. * @@ -394,6 +402,8 @@ public function listAddresses(array $options = []): array /** * Returns Generator for InterfaceAttachment. + * + * @return \Generator */ public function listInterfaceAttachments(array $options = []): \Generator { @@ -470,8 +480,6 @@ public function resetMetadata(array $metadata) * existing keys will remain unaffected. * * @param array $metadata {@see \OpenStack\Compute\v2\Api::postServerMetadata} - * - * @return array */ public function mergeMetadata(array $metadata) { @@ -483,8 +491,6 @@ public function mergeMetadata(array $metadata) * Retrieve the value for a specific metadata key. * * @param string $key {@see \OpenStack\Compute\v2\Api::getServerMetadataKey} - * - * @return mixed */ public function getMetadataItem(string $key) { @@ -541,6 +547,8 @@ public function parseMetadata(ResponseInterface $response): array /** * Returns Generator for SecurityGroups. + * + * @return \Generator */ public function listSecurityGroups(): \Generator { @@ -549,6 +557,8 @@ public function listSecurityGroups(): \Generator /** * Returns Generator for VolumeAttachment. + * + * @return \Generator */ public function listVolumeAttachments(): \Generator { @@ -557,8 +567,6 @@ public function listVolumeAttachments(): \Generator /** * Attach a volume and returns volume that was attached. - * - * @param $volumeId */ public function attachVolume(string $volumeId): VolumeAttachment { @@ -569,8 +577,6 @@ public function attachVolume(string $volumeId): VolumeAttachment /** * Detach a volume. - * - * @param $attachmentId */ public function detachVolume(string $attachmentId) { diff --git a/php-opencloud/openstack/src/Compute/v2/Service.php b/php-opencloud/openstack/src/Compute/v2/Service.php index a67e33eb3..3dc1fd4c8 100644 --- a/php-opencloud/openstack/src/Compute/v2/Service.php +++ b/php-opencloud/openstack/src/Compute/v2/Service.php @@ -19,7 +19,7 @@ /** * Compute v2 service for OpenStack. * - * @property \OpenStack\Compute\v2\Api $api + * @property Api $api */ class Service extends AbstractService { @@ -37,10 +37,12 @@ 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 */ public function listServers(bool $detailed = false, array $options = [], callable $mapFn = null): \Generator { @@ -73,6 +75,8 @@ public function getServer(array $options = []): Server * @param array $options {@see \OpenStack\Compute\v2\Api::getFlavors} * @param callable $mapFn a callable function that will be invoked on every iteration of the list * @param bool $detailed set to true to fetch flavors' details + * + * @return \Generator */ public function listFlavors(array $options = [], callable $mapFn = null, bool $detailed = false): \Generator { @@ -110,8 +114,10 @@ public function createFlavor(array $options = []): Flavor /** * List images. * - * @param array $options {@see \OpenStack\Compute\v2\Api::getImages} - * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * @param array $options {@see \OpenStack\Compute\v2\Api::getImages} + * @param callable|null $mapFn a callable function that will be invoked on every iteration of the list + * + * @return \Generator */ public function listImages(array $options = [], callable $mapFn = null): \Generator { @@ -139,6 +145,8 @@ public function getImage(array $options = []): Image * * @param array $options {@see \OpenStack\Compute\v2\Api::getKeyPairs} * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * + * @return \Generator */ public function listKeypairs(array $options = [], callable $mapFn = null): \Generator { @@ -193,6 +201,8 @@ public function getHypervisorStatistics(): HypervisorStatistic * the ID, name and links attributes are returned, saving bandwidth. * @param array $options {@see \OpenStack\Compute\v2\Api::getHypervisors} * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * + * @return \Generator */ public function listHypervisors(bool $detailed = false, array $options = [], callable $mapFn = null): \Generator { @@ -216,6 +226,8 @@ public function getHypervisor(array $options = []): Hypervisor * * @param array $options {@see \OpenStack\Compute\v2\Api::getHosts} * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * + * @return \Generator */ public function listHosts(array $options = [], callable $mapFn = null): \Generator { @@ -245,6 +257,8 @@ public function getHost(array $options = []): Host * * @param array $options {@see \OpenStack\Compute\v2\Api::getAvailabilityZones} * @param callable $mapFn a callable function that will be invoked on every iteration of the list + * + * @return \Generator */ public function listAvailabilityZones(array $options = [], callable $mapFn = null): \Generator { diff --git a/php-opencloud/openstack/src/Identity/v2/Api.php b/php-opencloud/openstack/src/Identity/v2/Api.php index 5024b3597..f22c970dd 100644 --- a/php-opencloud/openstack/src/Identity/v2/Api.php +++ b/php-opencloud/openstack/src/Identity/v2/Api.php @@ -14,20 +14,21 @@ class Api implements ApiInterface public function postToken(): array { return [ - 'method' => 'POST', - 'path' => 'tokens', - 'params' => [ - 'username' => [ + 'method' => 'POST', + 'path' => 'tokens', + 'skipAuth' => true, + 'params' => [ + 'username' => [ 'type' => 'string', 'required' => true, 'path' => 'auth.passwordCredentials', ], - 'password' => [ + 'password' => [ 'type' => 'string', 'required' => true, 'path' => 'auth.passwordCredentials', ], - 'tenantId' => [ + 'tenantId' => [ 'type' => 'string', 'path' => 'auth', ], diff --git a/php-opencloud/openstack/src/Identity/v2/Models/Catalog.php b/php-opencloud/openstack/src/Identity/v2/Models/Catalog.php index 247c9fafc..91de2d2bc 100644 --- a/php-opencloud/openstack/src/Identity/v2/Models/Catalog.php +++ b/php-opencloud/openstack/src/Identity/v2/Models/Catalog.php @@ -14,7 +14,7 @@ */ class Catalog extends OperatorResource implements \OpenStack\Common\Auth\Catalog { - const DEFAULT_URL_TYPE = 'publicURL'; + public const DEFAULT_URL_TYPE = 'publicURL'; /** * The catalog entries. @@ -23,9 +23,6 @@ class Catalog extends OperatorResource implements \OpenStack\Common\Auth\Catalog */ public $entries = []; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -33,9 +30,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response): self { $entries = Utils::jsonDecode($response)['access']['serviceCatalog']; diff --git a/php-opencloud/openstack/src/Identity/v2/Models/Entry.php b/php-opencloud/openstack/src/Identity/v2/Models/Entry.php index 650428770..2c101688a 100644 --- a/php-opencloud/openstack/src/Identity/v2/Models/Entry.php +++ b/php-opencloud/openstack/src/Identity/v2/Models/Entry.php @@ -21,9 +21,6 @@ class Entry extends OperatorResource /** @var []Endpoint */ public $endpoints = []; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/Identity/v2/Models/Token.php b/php-opencloud/openstack/src/Identity/v2/Models/Token.php index 4599caf6f..35281b4b2 100644 --- a/php-opencloud/openstack/src/Identity/v2/Models/Token.php +++ b/php-opencloud/openstack/src/Identity/v2/Models/Token.php @@ -26,9 +26,6 @@ class Token extends OperatorResource implements \OpenStack\Common\Auth\Token /** @var Tenant */ public $tenant; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -38,9 +35,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response): self { $this->populateFromArray(Utils::jsonDecode($response)['access']['token']); diff --git a/php-opencloud/openstack/src/Identity/v2/Service.php b/php-opencloud/openstack/src/Identity/v2/Service.php index cded85fa5..620f6b948 100644 --- a/php-opencloud/openstack/src/Identity/v2/Service.php +++ b/php-opencloud/openstack/src/Identity/v2/Service.php @@ -13,7 +13,7 @@ /** * Represents the OpenStack Identity v2 service. * - * @property \OpenStack\Identity\v2\Api $api + * @property Api $api */ class Service extends AbstractService implements IdentityService { @@ -44,8 +44,6 @@ public function authenticate(array $options = []): array * Generates a new authentication token. * * @param array $options {@see \OpenStack\Identity\v2\Api::postToken} - * - * @return Models\Token */ public function generateToken(array $options = []): Token { diff --git a/php-opencloud/openstack/src/Identity/v3/Api.php b/php-opencloud/openstack/src/Identity/v3/Api.php index 325e3ac17..418684c91 100644 --- a/php-opencloud/openstack/src/Identity/v3/Api.php +++ b/php-opencloud/openstack/src/Identity/v3/Api.php @@ -16,13 +16,15 @@ public function __construct() public function postTokens(): array { return [ - 'method' => 'POST', - 'path' => 'auth/tokens', - 'params' => [ - 'methods' => $this->params->methods(), - 'user' => $this->params->user(), - 'tokenId' => $this->params->tokenBody(), - 'scope' => $this->params->scope(), + 'method' => 'POST', + 'path' => 'auth/tokens', + 'skipAuth' => true, + 'params' => [ + 'methods' => $this->params->methods(), + 'user' => $this->params->user(), + 'application_credential' => $this->params->applicationCredential(), + 'tokenId' => $this->params->tokenBody(), + 'scope' => $this->params->scope(), ], ]; } @@ -554,6 +556,7 @@ public function patchUser(): array 'description' => $this->params->desc('user'), 'email' => $this->params->email(), 'enabled' => $this->params->enabled('user'), + 'name' => $this->params->name('user'), 'password' => $this->params->password(), ], ]; @@ -837,4 +840,43 @@ public function deletePolicy(): array 'params' => ['id' => $this->params->idUrl('policy')], ]; } + + public function getApplicationCredential(): array + { + return [ + 'method' => 'GET', + 'path' => 'users/{userId}/application_credentials/{id}', + 'jsonKey' => 'application_credential', + 'params' => [ + 'id' => $this->params->idUrl('application_credential'), + 'userId' => $this->params->idUrl('user'), + ], + ]; + } + + public function postApplicationCredential(): array + { + return [ + 'method' => 'POST', + 'path' => 'users/{userId}/application_credentials', + 'jsonKey' => 'application_credential', + 'params' => [ + 'userId' => $this->params->idUrl('user'), + 'name' => $this->params->name('application_credential'), + 'description' => $this->params->desc('application_credential'), + ], + ]; + } + + public function deleteApplicationCredential(): array + { + return [ + 'method' => 'DELETE', + 'path' => 'users/{userId}/application_credentials/{id}', + 'params' => [ + 'id' => $this->params->idUrl('application_credential'), + 'userId' => $this->params->idUrl('user'), + ], + ]; + } } diff --git a/php-opencloud/openstack/src/Identity/v3/Enum.php b/php-opencloud/openstack/src/Identity/v3/Enum.php index 1a6b1c60a..60401a2b2 100644 --- a/php-opencloud/openstack/src/Identity/v3/Enum.php +++ b/php-opencloud/openstack/src/Identity/v3/Enum.php @@ -6,7 +6,7 @@ abstract class Enum { - const INTERFACE_INTERNAL = 'internal'; - const INTERFACE_PUBLIC = 'public'; - const INTERFACE_ADMIN = 'admin'; + public const INTERFACE_INTERNAL = 'internal'; + public const INTERFACE_PUBLIC = 'public'; + public const INTERFACE_ADMIN = 'admin'; } diff --git a/php-opencloud/openstack/src/Identity/v3/Models/ApplicationCredential.php b/php-opencloud/openstack/src/Identity/v3/Models/ApplicationCredential.php new file mode 100644 index 000000000..32644f2ef --- /dev/null +++ b/php-opencloud/openstack/src/Identity/v3/Models/ApplicationCredential.php @@ -0,0 +1,69 @@ + 'userId', + ]; + + protected $resourceKey = 'application_credential'; + protected $resourcesKey = 'application_credentials'; + + /** + * {@inheritdoc} + * + * @param array $userOptions {@see \OpenStack\Identity\v3\Api::postApplicationCredential} + */ + public function create(array $userOptions): Creatable + { + $response = $this->execute($this->api->postApplicationCredential(), $userOptions); + + return $this->populateFromResponse($response); + } + + /** + * {@inheritdoc} + */ + public function retrieve() + { + $response = $this->execute( + $this->api->getApplicationCredential(), + ['id' => $this->id, 'userId' => $this->userId] + ); + $this->populateFromResponse($response); + } + + /** + * {@inheritdoc} + */ + public function delete() + { + $this->executeWithState($this->api->deleteApplicationCredential()); + } +} diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php b/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php index e4bb157cf..26032a5fe 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Assignment.php @@ -25,9 +25,6 @@ class Assignment extends OperatorResource implements Listable protected $resourcesKey = 'role_assignments'; protected $resourceKey = 'role_assignment'; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php b/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php index 3dc784533..d208d7b6a 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Catalog.php @@ -15,9 +15,6 @@ class Catalog extends OperatorResource implements \OpenStack\Common\Auth\Catalog /** @var []Service */ public $services; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Credential.php b/php-opencloud/openstack/src/Identity/v3/Models/Credential.php index ab844b3e4..294a3ec1f 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Credential.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Credential.php @@ -39,37 +39,25 @@ class Credential extends OperatorResource implements Creatable, Updateable, Retr 'user_id' => 'userId', ]; - /** - * {@inheritdoc} - */ - public function create(array $data): Creatable + public function create(array $userOptions): Creatable { - $response = $this->execute($this->api->postCredentials(), $data); + $response = $this->execute($this->api->postCredentials(), $userOptions); return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getCredential()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchCredential()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteCredential()); diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Domain.php b/php-opencloud/openstack/src/Identity/v3/Models/Domain.php index 9118d38f9..332503e99 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Domain.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Domain.php @@ -36,8 +36,6 @@ class Domain extends OperatorResource implements Creatable, Listable, Retrievabl protected $resourcesKey = 'domains'; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postDomains} */ public function create(array $data): Creatable @@ -47,27 +45,18 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getDomain()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchDomain()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteDomain()); @@ -75,6 +64,8 @@ public function delete() /** * @param array $options {@see \OpenStack\Identity\v3\Api::getUserRoles} + * + * @return \Generator */ public function listUserRoles(array $options = []): \Generator { @@ -115,6 +106,8 @@ public function revokeUserRole(array $options = []) /** * @param array $options {@see \OpenStack\Identity\v3\Api::getGroupRoles} + * + * @return \Generator */ public function listGroupRoles(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php b/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php index 5fe0a5bc2..1f496fba5 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Endpoint.php @@ -41,8 +41,6 @@ class Endpoint extends OperatorResource implements Creatable, Updateable, Deleta protected $aliases = ['service_id' => 'serviceId']; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postEndpoints} */ public function create(array $data): Creatable @@ -52,27 +50,18 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getEndpoint()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchEndpoint()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteEndpoint(), $this->getAttrs(['id'])); diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Group.php b/php-opencloud/openstack/src/Identity/v3/Models/Group.php index 8bfee36b3..c6869dea6 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Group.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Group.php @@ -38,8 +38,6 @@ class Group extends OperatorResource implements Creatable, Listable, Retrievable protected $resourcesKey = 'groups'; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postGroups} */ public function create(array $data): Creatable @@ -49,27 +47,18 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getGroup(), ['id' => $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchGroup()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteGroup(), ['id' => $this->id]); @@ -77,6 +66,8 @@ public function delete() /** * @param array $options {@see \OpenStack\Identity\v3\Api::getGroupUsers} + * + * @return \Generator */ public function listUsers(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Policy.php b/php-opencloud/openstack/src/Identity/v3/Models/Policy.php index 121688292..1ccca4f0a 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Policy.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Policy.php @@ -43,8 +43,6 @@ class Policy extends OperatorResource implements Creatable, Listable, Retrievabl ]; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postPolicies} */ public function create(array $data): Creatable @@ -54,27 +52,18 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getPolicy(), ['id' => $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchPolicy()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deletePolicy(), ['id' => $this->id]); diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Project.php b/php-opencloud/openstack/src/Identity/v3/Models/Project.php index 62041c69e..8d58c2236 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Project.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Project.php @@ -47,8 +47,6 @@ class Project extends OperatorResource implements Creatable, Retrievable, Listab protected $resourcesKey = 'projects'; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postProjects} */ public function create(array $data): Creatable @@ -59,27 +57,18 @@ public function create(array $data): Creatable return $this; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getProject()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchProject()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteProject()); @@ -87,6 +76,8 @@ public function delete() /** * @param array $options {@see \OpenStack\Identity\v3\Api::getProjectUserRoles} + * + * @return \Generator */ public function listUserRoles(array $options = []): \Generator { @@ -127,6 +118,8 @@ public function revokeUserRole(array $options) /** * @param array $options {@see \OpenStack\Identity\v3\Api::getProjectGroupRoles} + * + * @return \Generator */ public function listGroupRoles(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Role.php b/php-opencloud/openstack/src/Identity/v3/Models/Role.php index 907b1005d..d2236311b 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Role.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Role.php @@ -27,8 +27,6 @@ class Role extends OperatorResource implements Creatable, Listable, Deletable protected $resourcesKey = 'roles'; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postRoles} */ public function create(array $data): Creatable @@ -38,9 +36,6 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteRole()); diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Service.php b/php-opencloud/openstack/src/Identity/v3/Models/Service.php index 67d0b5f7b..6a257dce0 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Service.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Service.php @@ -38,9 +38,6 @@ class Service extends OperatorResource implements Creatable, Listable, Retrievab protected $resourceKey = 'service'; protected $resourcesKey = 'services'; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -49,8 +46,6 @@ protected function getAliases(): array } /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postServices} */ public function create(array $data): Creatable @@ -60,27 +55,18 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getService()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchService()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteService()); diff --git a/php-opencloud/openstack/src/Identity/v3/Models/Token.php b/php-opencloud/openstack/src/Identity/v3/Models/Token.php index b3808a54d..d4054d7c2 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/Token.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/Token.php @@ -4,6 +4,8 @@ namespace OpenStack\Identity\v3\Models; +use InvalidArgumentException; +use OpenStack\Common\Error\BadResponseError; use OpenStack\Common\Resource\Alias; use OpenStack\Common\Resource\Creatable; use OpenStack\Common\Resource\OperatorResource; @@ -31,7 +33,6 @@ class Token extends OperatorResource implements Creatable, Retrievable, \OpenSta /** @var Catalog */ public $catalog; - /** @var mixed */ public $extras; /** @var User */ @@ -48,9 +49,6 @@ class Token extends OperatorResource implements Creatable, Retrievable, \OpenSta protected $cachedToken; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -63,9 +61,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response) { parent::populateFromResponse($response); @@ -87,9 +82,6 @@ public function hasExpired(): bool return $this->expires <= new \DateTimeImmutable('now', $this->expires->getTimezone()); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getTokens(), ['tokenId' => $this->id]); @@ -97,24 +89,27 @@ public function retrieve() } /** - * {@inheritdoc} - * - * @param array $data {@see \OpenStack\Identity\v3\Api::postTokens} + * @param array $userOptions {@see \OpenStack\Identity\v3\Api::postTokens} */ - public function create(array $data): Creatable + public function create(array $userOptions): Creatable { - if (isset($data['user'])) { - $data['methods'] = ['password']; - if (!isset($data['user']['id']) && empty($data['user']['domain'])) { - throw new \InvalidArgumentException('When authenticating with a username, you must also provide either the domain name or domain ID to '.'which the user belongs to. Alternatively, if you provide a user ID instead, you do not need to '.'provide domain information.'); + if (isset($userOptions['user'])) { + $userOptions['methods'] = ['password']; + if (!isset($userOptions['user']['id']) && empty($userOptions['user']['domain'])) { + throw new InvalidArgumentException('When authenticating with a username, you must also provide either the domain name '.'or domain ID to which the user belongs to. Alternatively, if you provide a user ID instead, '.'you do not need to provide domain information.'); + } + } elseif (isset($userOptions['application_credential'])) { + $userOptions['methods'] = ['application_credential']; + if (!isset($userOptions['application_credential']['id']) || !isset($userOptions['application_credential']['secret'])) { + throw new InvalidArgumentException('When authenticating with a application_credential, you must provide application credential ID '.' and application credential secret.'); } - } elseif (isset($data['tokenId'])) { - $data['methods'] = ['token']; + } elseif (isset($userOptions['tokenId'])) { + $userOptions['methods'] = ['token']; } else { - throw new \InvalidArgumentException('Either a user or token must be provided.'); + throw new InvalidArgumentException('Either a user, tokenId or application_credential must be provided.'); } - $response = $this->execute($this->api->postTokens(), $data); + $response = $this->execute($this->api->postTokens(), $userOptions); $token = $this->populateFromResponse($response); // Cache response as an array to export if needed. @@ -136,4 +131,20 @@ public function export(): array { return $this->cachedToken; } + + /** + * Checks if the token is valid. + * + * @return bool TRUE if the token is valid; FALSE otherwise + */ + public function validate(): bool + { + try { + $this->execute($this->api->headTokens(), ['tokenId' => $this->id]); + + return true; + } catch (BadResponseError $e) { + return false; + } + } } diff --git a/php-opencloud/openstack/src/Identity/v3/Models/User.php b/php-opencloud/openstack/src/Identity/v3/Models/User.php index 81aa561e6..28efc859a 100644 --- a/php-opencloud/openstack/src/Identity/v3/Models/User.php +++ b/php-opencloud/openstack/src/Identity/v3/Models/User.php @@ -49,8 +49,6 @@ class User extends OperatorResource implements Creatable, Listable, Retrievable, protected $resourcesKey = 'users'; /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Identity\v3\Api::postUsers} */ public function create(array $data): Creatable @@ -60,41 +58,56 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getUser(), ['id' => $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->patchUser()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->execute($this->api->deleteUser(), ['id' => $this->id]); } + /** + * @return \Generator + */ public function listGroups(): \Generator { - $options['id'] = $this->id; - - return $this->model(Group::class)->enumerate($this->api->getUserGroups(), $options); + return $this->model(Group::class)->enumerate($this->api->getUserGroups(), ['id' => $this->id]); } + /** + * @return \Generator + */ public function listProjects(): \Generator { return $this->model(Project::class)->enumerate($this->api->getUserProjects(), ['id' => $this->id]); } + + /** + * Creates a new application credential according to the provided options. + * + * @param array $options {@see \OpenStack\Identity\v3\Api::postApplicationCredential} + */ + public function createApplicationCredential(array $options): ApplicationCredential + { + return $this->model(ApplicationCredential::class)->create(['userId' => $this->id] + $options); + } + + /** + * Retrieves an application credential object and populates its unique identifier object. This operation will not + * perform a GET or HEAD request by default; you will need to call retrieve() if you want to pull in remote state + * from the API. + */ + public function getApplicationCredential(string $id): ApplicationCredential + { + return $this->model(ApplicationCredential::class, ['id' => $id, 'userId' => $this->id]); + } } diff --git a/php-opencloud/openstack/src/Identity/v3/Params.php b/php-opencloud/openstack/src/Identity/v3/Params.php index f001d3c48..cba08f5fe 100644 --- a/php-opencloud/openstack/src/Identity/v3/Params.php +++ b/php-opencloud/openstack/src/Identity/v3/Params.php @@ -21,6 +21,24 @@ public function methods(): array ]; } + public function applicationCredential(): array + { + return [ + 'type' => self::OBJECT_TYPE, + 'path' => 'auth.identity', + 'properties' => [ + 'id' => [ + 'type' => self::STRING_TYPE, + 'description' => $this->id('application credential id'), + ], + 'secret' => [ + 'type' => self::STRING_TYPE, + 'description' => 'The secret of the application credential', + ], + ], + ]; + } + public function user(): array { return [ diff --git a/php-opencloud/openstack/src/Identity/v3/Service.php b/php-opencloud/openstack/src/Identity/v3/Service.php index ca16aac59..5760436fe 100644 --- a/php-opencloud/openstack/src/Identity/v3/Service.php +++ b/php-opencloud/openstack/src/Identity/v3/Service.php @@ -12,7 +12,7 @@ /** * Represents the Keystone v3 service. * - * @property \OpenStack\Identity\v3\Api $api + * @property Api $api */ class Service extends AbstractService implements IdentityService { @@ -45,7 +45,7 @@ public function authenticate(array $options): array $name = $options['catalogName']; $type = $options['catalogType']; $region = $options['region']; - $interface = isset($options['interface']) ? $options['interface'] : Enum::INTERFACE_PUBLIC; + $interface = $options['interface'] ?? Enum::INTERFACE_PUBLIC; if ($baseUrl = $token->catalog->getServiceUrl($name, $type, $region, $interface)) { return [$token, $baseUrl]; @@ -128,6 +128,8 @@ public function createService(array $options): Models\Service * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getServices} + * + * @return \Generator */ public function listServices(array $options = []): \Generator { @@ -172,6 +174,8 @@ public function getEndpoint(string $id): Models\Endpoint * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getEndpoints} + * + * @return \Generator */ public function listEndpoints(array $options = []): \Generator { @@ -194,6 +198,8 @@ public function createDomain(array $options): Models\Domain * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getDomains} + * + * @return \Generator */ public function listDomains(array $options = []): \Generator { @@ -227,6 +233,8 @@ public function createProject(array $options): Models\Project * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getProjects} + * + * @return \Generator */ public function listProjects(array $options = []): \Generator { @@ -260,6 +268,8 @@ public function createUser(array $options): Models\User * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getUsers} + * + * @return \Generator */ public function listUsers(array $options = []): \Generator { @@ -293,6 +303,8 @@ public function createGroup(array $options): Models\Group * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getGroups} + * + * @return \Generator */ public function listGroups(array $options = []): \Generator { @@ -324,6 +336,8 @@ public function createCredential(array $options): Models\Credential * Returns a generator which will yield a collection of credential objects. The elements which generators yield can * be accessed using a foreach loop. Often the API will not return the full state of the resource in collections; * you will need to use retrieve() to pull in the full state of the remote resource from the API. + * + * @return \Generator */ public function listCredentials(): \Generator { @@ -357,6 +371,8 @@ public function createRole(array $options): Models\Role * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getRoles} + * + * @return \Generator */ public function listRoles(array $options = []): \Generator { @@ -369,6 +385,8 @@ public function listRoles(array $options = []): \Generator * collections; you will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getRoleAssignments} + * + * @return \Generator */ public function listRoleAssignments(array $options = []): \Generator { @@ -391,6 +409,8 @@ public function createPolicy(array $options): Models\Policy * will need to use retrieve() to pull in the full state of the remote resource from the API. * * @param array $options {@see \OpenStack\Identity\v3\Api::getPolicies} + * + * @return \Generator */ public function listPolicies(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Images/v2/Models/Image.php b/php-opencloud/openstack/src/Images/v2/Models/Image.php index 8c0e88628..9cff176b6 100644 --- a/php-opencloud/openstack/src/Images/v2/Models/Image.php +++ b/php-opencloud/openstack/src/Images/v2/Models/Image.php @@ -85,9 +85,6 @@ class Image extends OperatorResource implements Creatable, Listable, Retrievable 'virtual_size' => 'virtualSize', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -213,6 +210,9 @@ public function addMember($memberId): Member return $this->model(Member::class, ['imageId' => $this->id, 'id' => $memberId])->create([]); } + /** + * @return \Generator + */ public function listMembers(): \Generator { return $this->model(Member::class)->enumerate($this->api->getImageMembers(), ['imageId' => $this->id]); diff --git a/php-opencloud/openstack/src/Images/v2/Models/Member.php b/php-opencloud/openstack/src/Images/v2/Models/Member.php index c3cb00b7b..9023d2817 100644 --- a/php-opencloud/openstack/src/Images/v2/Models/Member.php +++ b/php-opencloud/openstack/src/Images/v2/Models/Member.php @@ -16,9 +16,9 @@ */ class Member extends OperatorResource implements Creatable, Listable, Retrievable, Deletable { - const STATUS_ACCEPTED = 'accepted'; - const STATUS_PENDING = 'pending'; - const STATUS_REJECTED = 'rejected'; + public const STATUS_ACCEPTED = 'accepted'; + public const STATUS_PENDING = 'pending'; + public const STATUS_REJECTED = 'rejected'; /** @var string */ public $imageId; @@ -43,9 +43,6 @@ class Member extends OperatorResource implements Creatable, Listable, Retrievabl 'image_id' => 'imageId', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/Images/v2/Service.php b/php-opencloud/openstack/src/Images/v2/Service.php index 9c977cf25..bcb8f4349 100644 --- a/php-opencloud/openstack/src/Images/v2/Service.php +++ b/php-opencloud/openstack/src/Images/v2/Service.php @@ -17,6 +17,9 @@ public function createImage(array $data): Image return $this->model(Image::class)->create($data); } + /** + * @return \Generator + */ public function listImages(array $data = []): \Generator { return $this->model(Image::class)->enumerate($this->api->getImages(), $data); diff --git a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Metric.php b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Metric.php index 71b489caa..9ad76011f 100644 --- a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Metric.php +++ b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Metric.php @@ -40,9 +40,6 @@ class Metric extends OperatorResource implements Retrievable 'archive_policy' => 'archivePolicy', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -50,9 +47,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getMetric()); diff --git a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Resource.php b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Resource.php index 33c39d89a..06c2d6940 100644 --- a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Resource.php +++ b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Models/Resource.php @@ -14,21 +14,21 @@ */ class Resource extends OperatorResource implements Retrievable { - const RESOURCE_TYPE_GENERIC = 'generic'; - const RESOURCE_TYPE_CEPH_ACCOUNT = 'ceph_account'; - const RESOURCE_TYPE_HOST = 'host'; - const RESOURCE_TYPE_HOST_DISK = 'host_disk'; - const RESOURCE_TYPE_HOST_NETWORK_INTERFACE = 'host_network_interface'; - const RESOURCE_TYPE_IDENTITY = 'identity'; - const RESOURCE_TYPE_IMAGE = 'image'; - const RESOURCE_TYPE_INSTANCE = 'instance'; - const RESOURCE_TYPE_INSTANCE_DISK = 'instance_disk'; - const RESOURCE_TYPE_INSTANCE_NETWORK_INTERFACE = 'instance_network_interface'; - const RESOURCE_TYPE_IPMI = 'ipmi'; - const RESOURCE_TYPE_NETWORK = 'network'; - const RESOURCE_TYPE_STACK = 'stack'; - const RESOURCE_TYPE_SWIFT_ACCOUNT = 'swift_account'; - const RESOURCE_TYPE_VOLUME = 'volume'; + public const RESOURCE_TYPE_GENERIC = 'generic'; + public const RESOURCE_TYPE_CEPH_ACCOUNT = 'ceph_account'; + public const RESOURCE_TYPE_HOST = 'host'; + public const RESOURCE_TYPE_HOST_DISK = 'host_disk'; + public const RESOURCE_TYPE_HOST_NETWORK_INTERFACE = 'host_network_interface'; + public const RESOURCE_TYPE_IDENTITY = 'identity'; + public const RESOURCE_TYPE_IMAGE = 'image'; + public const RESOURCE_TYPE_INSTANCE = 'instance'; + public const RESOURCE_TYPE_INSTANCE_DISK = 'instance_disk'; + public const RESOURCE_TYPE_INSTANCE_NETWORK_INTERFACE = 'instance_network_interface'; + public const RESOURCE_TYPE_IPMI = 'ipmi'; + public const RESOURCE_TYPE_NETWORK = 'network'; + public const RESOURCE_TYPE_STACK = 'stack'; + public const RESOURCE_TYPE_SWIFT_ACCOUNT = 'swift_account'; + public const RESOURCE_TYPE_VOLUME = 'volume'; /** @var string */ public $createdByUserId; @@ -138,6 +138,8 @@ public function getMetricMeasures(array $options = []): array /** * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::getResourceMetrics} + * + * @return \Generator */ public function listResourceMetrics(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php index c44dfafb5..61be0e282 100644 --- a/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php +++ b/php-opencloud/openstack/src/Metric/v1/Gnocchi/Service.php @@ -18,6 +18,8 @@ class Service extends AbstractService { /** * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\ResourceType type in a generator format. + * + * @return \Generator */ public function listResourceTypes(): \Generator { @@ -28,6 +30,8 @@ public function listResourceTypes(): \Generator * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\Resource type in a generator format. * * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::getResources} + * + * @return \Generator */ public function listResources(array $options = []): \Generator { @@ -55,6 +59,8 @@ public function getResource(array $options = []): Resource * Retrieves a collection of \OpenStack\Metric\v1\Gnocchi\Models\Resource type in a generator format. * * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::searchResources} + * + * @return \Generator */ public function searchResources(array $options = []): \Generator { @@ -94,6 +100,8 @@ public function getMetric(string $id): Metric * Retrieves a collection of Metric type in a generator format. * * @param array $options {@see \OpenStack\Metric\v1\Gnocchi\Api::getMetrics} + * + * @return \Generator */ public function listMetrics(array $options = []): \Generator { diff --git a/php-opencloud/openstack/src/Networking/v2/Api.php b/php-opencloud/openstack/src/Networking/v2/Api.php index d4cc0e39e..e9bfc27b7 100644 --- a/php-opencloud/openstack/src/Networking/v2/Api.php +++ b/php-opencloud/openstack/src/Networking/v2/Api.php @@ -5,6 +5,8 @@ namespace OpenStack\Networking\v2; use OpenStack\Common\Api\AbstractApi; +use OpenStack\Networking\v2\Extensions\Layer3\ApiTrait as Layer3; +use OpenStack\Networking\v2\Extensions\SecurityGroups\ApiTrait as SecurityGroup; /** * A representation of the Neutron (Nova) v2 REST API. @@ -13,6 +15,9 @@ */ class Api extends AbstractApi { + use Layer3; + use SecurityGroup; + private $pathPrefix = 'v2.0'; public function __construct() diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php index b9ab45172..faab09ac6 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Api.php @@ -4,6 +4,11 @@ use OpenStack\Common\Api\AbstractApi; +/** + * @deprecated Use Networking\v2\Api instead + * + * @internal + */ class Api extends AbstractApi { private $pathPrefix = 'v2.0'; diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ApiTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ApiTrait.php new file mode 100644 index 000000000..5d7c757ac --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ApiTrait.php @@ -0,0 +1,172 @@ + 'POST', + 'path' => $this->pathPrefix.'/floatingips', + 'jsonKey' => 'floatingip', + 'params' => [ + 'tenantId' => $this->params->tenantIdJson(), + 'floatingNetworkId' => $this->params->floatingNetworkIdJson(), + 'fixedIpAddress' => $this->params->fixedIpAddressJson(), + 'floatingIpAddress' => $this->params->floatingIpAddressJson(), + 'portId' => $this->params->portIdJson(), + ], + ]; + } + + public function getFloatingIps(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/floatingips', + 'params' => [ + 'tenantId' => $this->params->queryTenantId(), + ], + ]; + } + + public function putFloatingIp(): array + { + return [ + 'method' => 'PUT', + 'path' => $this->pathPrefix.'/floatingips/{id}', + 'jsonKey' => 'floatingip', + 'params' => [ + 'id' => $this->params->idPath(), + 'floatingNetworkId' => $this->notRequired($this->params->floatingNetworkIdJson()), + 'fixedIpAddress' => $this->params->fixedIpAddressJson(), + 'floatingIpAddress' => $this->params->floatingIpAddressJson(), + 'portId' => $this->params->portIdJson(), + ], + ]; + } + + public function getFloatingIp(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/floatingips/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + 'portId' => $this->params->portIdJson(), + ], + ]; + } + + public function deleteFloatingIp(): array + { + return [ + 'method' => 'DELETE', + 'path' => $this->pathPrefix.'/floatingips/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + public function postRouters(): array + { + return [ + 'method' => 'POST', + 'path' => $this->pathPrefix.'/routers', + 'jsonKey' => 'router', + 'params' => [ + 'name' => $this->params->nameJson(), + 'externalGatewayInfo' => $this->params->externalGatewayInfo(), + 'adminStateUp' => $this->params->adminStateUp(), + 'tenantId' => $this->params->tenantId(), + 'distributed' => $this->params->distributedJson(), + 'ha' => $this->params->haJson(), + ], + ]; + } + + public function getRouters(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/routers', + 'params' => [ + 'name' => $this->params->queryName(), + 'tenantId' => $this->params->queryTenantId(), + ], + ]; + } + + public function putRouter(): array + { + return [ + 'method' => 'PUT', + 'path' => $this->pathPrefix.'/routers/{id}', + 'jsonKey' => 'router', + 'params' => [ + 'id' => $this->params->idPath(), + 'name' => $this->params->nameJson(), + 'externalGatewayInfo' => $this->params->externalGatewayInfo(), + 'adminStateUp' => $this->params->adminStateUp(), + ], + ]; + } + + public function getRouter(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/routers/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + public function deleteRouter(): array + { + return [ + 'method' => 'DELETE', + 'path' => $this->pathPrefix.'/routers/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + public function putAddInterface(): array + { + return [ + 'method' => 'PUT', + 'path' => $this->pathPrefix.'/routers/{id}/add_router_interface', + 'params' => [ + 'id' => $this->params->idPath(), + 'subnetId' => $this->params->subnetId(), + 'portId' => $this->params->portIdJson(), + ], + ]; + } + + public function putRemoveInterface(): array + { + return [ + 'method' => 'PUT', + 'path' => $this->pathPrefix.'/routers/{id}/remove_router_interface', + 'params' => [ + 'id' => $this->params->idPath(), + 'subnetId' => $this->params->subnetId(), + 'portId' => $this->params->portIdJson(), + ], + ]; + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php index 07dc0ddba..048b942b2 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/FloatingIp.php @@ -51,6 +51,9 @@ class FloatingIp extends OperatorResource implements Listable, Creatable, Retrie protected $resourceKey = 'floatingip'; protected $resourcesKey = 'floatingips'; + /** + * {@inheritdoc} + */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postFloatingIps(), $userOptions); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php index 0614fe05d..9fff1ed72 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/GatewayInfo.php @@ -21,9 +21,6 @@ class GatewayInfo extends AbstractResource 'enable_snat' => 'enableSnat', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php index f3e701756..6fcb9a265 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Models/Router.php @@ -47,9 +47,6 @@ class Router extends OperatorResource implements Listable, Creatable, Retrievabl 'tenant_id' => 'tenantId', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -57,6 +54,9 @@ protected function getAliases(): array ]; } + /** + * {@inheritdoc} + */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postRouters(), $userOptions); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php index b94abd7e3..d502f61cd 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Params.php @@ -2,9 +2,14 @@ namespace OpenStack\Networking\v2\Extensions\Layer3; +/** + * @deprecated Use Networking\v2\Params instead + * + * @internal + */ class Params extends \OpenStack\Networking\v2\Params { - public function tenantIdJson() + public function tenantIdJson(): array { return [ 'type' => self::STRING_TYPE, @@ -13,7 +18,7 @@ public function tenantIdJson() ]; } - public function floatingNetworkIdJson() + public function floatingNetworkIdJson(): array { return [ 'type' => self::STRING_TYPE, @@ -23,7 +28,7 @@ public function floatingNetworkIdJson() ]; } - public function fixedIpAddressJson() + public function fixedIpAddressJson(): array { return [ 'type' => self::STRING_TYPE, @@ -32,7 +37,7 @@ public function fixedIpAddressJson() ]; } - public function floatingIpAddressJson() + public function floatingIpAddressJson(): array { return [ 'type' => self::STRING_TYPE, @@ -41,7 +46,7 @@ public function floatingIpAddressJson() ]; } - public function portIdJson() + public function portIdJson(): array { return [ 'type' => self::STRING_TYPE, diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ParamsTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ParamsTrait.php new file mode 100644 index 000000000..c201a82e7 --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ParamsTrait.php @@ -0,0 +1,112 @@ + self::STRING_TYPE, + 'description' => 'The UUID of the network associated with the floating IP.', + 'sentAs' => 'floating_network_id', + 'required' => true, + ]; + } + + public function fixedIpAddressJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The fixed IP address that is associated with the floating IP. To associate the floating IP with a fixed IP at creation time, you must specify the identifier of the internal port. If an internal port has multiple associated IP addresses, the service chooses the first IP address unless you explicitly define a fixed IP address in the fixed_ip_address parameter.', + 'sentAs' => 'fixed_ip_address', + ]; + } + + public function floatingIpAddressJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The floating IP address.', + 'sentAs' => 'floating_ip_address', + ]; + } + + public function portIdJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The UUID of the port.', + 'sentAs' => 'port_id', + ]; + } + + public function enableSnatJson(): array + { + return [ + 'type' => self::BOOL_TYPE, + 'description' => 'Enable Source NAT (SNAT) attribute, a part of ext-gw-mode extension. When a gateway is attached to a router using an L3 extension, Network Address Translation (NAT) is enabled for traffic generated by subnets attached to the router.', + 'location' => self::JSON, + 'sentAs' => 'enable_snat', + ]; + } + + public function ipJson(): array + { + return [ + 'type' => self::STRING_TYPE, + ]; + } + + public function externalFixedIpsJson(): array + { + return [ + 'type' => self::ARRAY_TYPE, + 'location' => self::JSON, + 'sentAs' => 'external_fixed_ips', + 'items' => [ + 'type' => self::OBJECT_TYPE, + 'properties' => [ + 'subnetId' => $this->subnetId(), + 'ip' => $this->ipJson(), + ], + ], + ]; + } + + public function externalGatewayInfo(): array + { + return [ + 'type' => self::OBJECT_TYPE, + 'sentAs' => 'external_gateway_info', + 'properties' => [ + 'networkId' => $this->networkId(), + 'enableSnat' => $this->enableSnatJson(), + 'fixedIps' => $this->externalFixedIpsJson(), + ], + ]; + } + + public function distributedJson(): array + { + return [ + 'type' => self::BOOL_TYPE, + 'location' => self::JSON, + 'description' => 'If true, indicates a distributed router.', + ]; + } + + public function haJson(): array + { + return [ + 'type' => self::BOOL_TYPE, + 'location' => self::JSON, + 'description' => 'If true, indicates a highly-available router.', + ]; + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php index 9f9b04de1..6d5458094 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/Service.php @@ -8,6 +8,8 @@ /** * @property Api $api + * + * @deprecated Use Networking\v2\Service instead */ class Service extends AbstractService { @@ -31,6 +33,9 @@ public function getFloatingIp($id): FloatingIp return $this->floatingIp(['id' => $id]); } + /** + * @return \Generator + */ public function listFloatingIps(array $options = []): \Generator { return $this->floatingIp()->enumerate($this->api->getFloatingIps(), $options); @@ -46,6 +51,9 @@ public function getRouter($id): Router return $this->router(['id' => $id]); } + /** + * @return \Generator + */ public function listRouters(array $options = []): \Generator { return $this->router()->enumerate($this->api->getRouters(), $options); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ServiceTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ServiceTrait.php new file mode 100644 index 000000000..785fca67b --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/Layer3/ServiceTrait.php @@ -0,0 +1,62 @@ +model(FloatingIp::class, $info); + } + + private function router(array $info = []): Router + { + return $this->model(Router::class, $info); + } + + public function createFloatingIp(array $options): FloatingIp + { + return $this->floatingIp()->create($options); + } + + public function getFloatingIp($id): FloatingIp + { + return $this->floatingIp(['id' => $id]); + } + + /** + * @return \Generator + */ + public function listFloatingIps(array $options = []): \Generator + { + return $this->floatingIp()->enumerate($this->api->getFloatingIps(), $options); + } + + public function createRouter(array $options): Router + { + return $this->router()->create($options); + } + + public function getRouter($id): Router + { + return $this->router(['id' => $id]); + } + + /** + * @return \Generator + */ + public function listRouters(array $options = []): \Generator + { + return $this->router()->enumerate($this->api->getRouters(), $options); + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php index e30ddc242..9f2597f94 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Api.php @@ -4,6 +4,11 @@ use OpenStack\Common\Api\AbstractApi; +/** + * @deprecated Use Networking\v2\Api instead + * + * @internal + */ class Api extends AbstractApi { private $pathPrefix = 'v2.0'; diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ApiTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ApiTrait.php new file mode 100644 index 000000000..6c7340418 --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ApiTrait.php @@ -0,0 +1,158 @@ + 'GET', + 'path' => $this->pathPrefix.'/security-groups', + 'params' => [ + 'tenantId' => $this->params->queryTenantId(), + 'name' => $this->params->filterName(), + ], + ]; + } + + /** + * Returns information about POST security-groups HTTP operation. + */ + public function postSecurityGroups(): array + { + return [ + 'method' => 'POST', + 'path' => $this->pathPrefix.'/security-groups', + 'jsonKey' => 'security_group', + 'params' => [ + 'description' => $this->params->descriptionJson(), + 'name' => $this->params->nameJson(), + ], + ]; + } + + /** + * Returns information about PUT security-groups HTTP operation. + */ + public function putSecurityGroups(): array + { + return [ + 'method' => 'PUT', + 'path' => $this->pathPrefix.'/security-groups/{id}', + 'jsonKey' => 'security_group', + 'params' => [ + 'id' => $this->params->idPath(), + 'description' => $this->params->descriptionJson(), + 'name' => $this->params->nameJson(), + ], + ]; + } + + /** + * Returns information about GET security-groups/{security_group_id} HTTP + * operation. + */ + public function getSecurityGroup(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/security-groups/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + /** + * Returns information about DELETE security-groups/{security_group_id} HTTP + * operation. + */ + public function deleteSecurityGroup(): array + { + return [ + 'method' => 'DELETE', + 'path' => $this->pathPrefix.'/security-groups/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + /** + * Returns information about GET security-group-rules HTTP operation. + */ + public function getSecurityRules(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/security-group-rules', + 'params' => [], + ]; + } + + /** + * Returns information about POST security-group-rules HTTP operation. + */ + public function postSecurityRules(): array + { + return [ + 'method' => 'POST', + 'path' => $this->pathPrefix.'/security-group-rules', + 'jsonKey' => 'security_group_rule', + 'params' => [ + 'direction' => $this->params->directionJson(), + 'ethertype' => $this->params->ethertypeJson(), + 'securityGroupId' => $this->params->securityGroupIdJson(), + 'portRangeMin' => $this->params->portRangeMinJson(), + 'portRangeMax' => $this->params->portRangeMaxJson(), + 'protocol' => $this->params->protocolJson(), + 'remoteGroupId' => $this->params->remoteGroupIdJson(), + 'remoteIpPrefix' => $this->params->remoteIpPrefixJson(), + 'tenantId' => $this->params->tenantIdJson(), + ], + ]; + } + + /** + * Returns information about DELETE + * security-group-rules/{rules-security-groups-id} HTTP operation. + */ + public function deleteSecurityRule(): array + { + return [ + 'method' => 'DELETE', + 'path' => $this->pathPrefix.'/security-group-rules/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } + + /** + * Returns information about GET + * security-group-rules/{rules-security-groups-id} HTTP operation. + */ + public function getSecurityRule(): array + { + return [ + 'method' => 'GET', + 'path' => $this->pathPrefix.'/security-group-rules/{id}', + 'params' => [ + 'id' => $this->params->idPath(), + ], + ]; + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php index 20516227a..1b09a2e4d 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroup.php @@ -51,9 +51,6 @@ class SecurityGroup extends OperatorResource implements Creatable, Listable, Del protected $resourceKey = 'security_group'; protected $resourcesKey = 'security_groups'; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -72,17 +69,11 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteSecurityGroup()); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getSecurityGroup()); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php index a7da99bdc..4d0319dc6 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Models/SecurityGroupRule.php @@ -90,17 +90,11 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteSecurityRule()); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->getSecurityRule()); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php index 88325a73e..ea700511c 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Params.php @@ -2,9 +2,14 @@ namespace OpenStack\Networking\v2\Extensions\SecurityGroups; +/** + * @deprecated Use Networking\v2\Params instead + * + * @internal + */ class Params extends \OpenStack\Networking\v2\Params { - public function directionJson() + public function directionJson(): array { return [ 'type' => self::STRING_TYPE, @@ -12,7 +17,7 @@ public function directionJson() ]; } - public function ethertypeJson() + public function ethertypeJson(): array { return [ 'type' => self::STRING_TYPE, @@ -20,7 +25,7 @@ public function ethertypeJson() ]; } - public function idJson() + public function idJson(): array { return [ 'type' => self::STRING_TYPE, @@ -28,7 +33,7 @@ public function idJson() ]; } - public function portRangeMaxJson() + public function portRangeMaxJson(): array { return [ 'type' => self::STRING_TYPE, @@ -37,7 +42,7 @@ public function portRangeMaxJson() ]; } - public function portRangeMinJson() + public function portRangeMinJson(): array { return [ 'sentAs' => 'port_range_min', @@ -46,7 +51,7 @@ public function portRangeMinJson() ]; } - public function protocolJson() + public function protocolJson(): array { return [ 'type' => self::STRING_TYPE, @@ -54,7 +59,7 @@ public function protocolJson() ]; } - public function remoteGroupIdJson() + public function remoteGroupIdJson(): array { return [ 'sentAs' => 'remote_group_id', @@ -63,7 +68,7 @@ public function remoteGroupIdJson() ]; } - public function remoteIpPrefixJson() + public function remoteIpPrefixJson(): array { return [ 'sentAs' => 'remote_ip_prefix', @@ -72,7 +77,7 @@ public function remoteIpPrefixJson() ]; } - public function securityGroupIdJson() + public function securityGroupIdJson(): array { return [ 'sentAs' => 'security_group_id', @@ -81,7 +86,7 @@ public function securityGroupIdJson() ]; } - public function tenantIdJson() + public function tenantIdJson(): array { return [ 'sentAs' => 'tenant_id', diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ParamsTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ParamsTrait.php new file mode 100644 index 000000000..90225a417 --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ParamsTrait.php @@ -0,0 +1,97 @@ + self::STRING_TYPE, + 'description' => 'Ingress or egress: the direction in which the security group rule is applied. For a compute instance, an ingress security group rule is applied to incoming (ingress) traffic for that instance. An egress rule is applied to traffic leaving the instance.', + ]; + } + + public function ethertypeJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules.', + ]; + } + + public function idJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The UUID of the security group rule.', + ]; + } + + public function portRangeMaxJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'sentAs' => 'port_range_max', + 'description' => 'The maximum port number in the range that is matched by the security group rule. The port_range_min attribute constrains the port_range_max attribute. If the protocol is ICMP, this value must be an ICMP type.', + ]; + } + + public function portRangeMinJson(): array + { + return [ + 'sentAs' => 'port_range_min', + 'type' => self::STRING_TYPE, + 'description' => 'The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the port_range_max attribute value. If the protocol is ICMP, this value must be an ICMP type.', + ]; + } + + public function protocolJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The protocol that is matched by the security group rule. Value is null, icmp, icmpv6, tcp, or udp.', + ]; + } + + public function remoteGroupIdJson(): array + { + return [ + 'sentAs' => 'remote_group_id', + 'type' => self::STRING_TYPE, + 'description' => 'The remote group UUID to associate with this security group rule. You can specify either the remote_group_id or remote_ip_prefix attribute in the request body.', + ]; + } + + public function remoteIpPrefixJson(): array + { + return [ + 'sentAs' => 'remote_ip_prefix', + 'type' => self::STRING_TYPE, + 'description' => 'The remote IP prefix to associate with this security group rule. You can specify either the remote_group_id or remote_ip_prefix attribute in the request body. This attribute value matches the IP prefix as the source IP address of the IP packet.', + ]; + } + + public function securityGroupIdJson(): array + { + return [ + 'sentAs' => 'security_group_id', + 'type' => self::STRING_TYPE, + 'description' => 'The UUID of the security group.', + ]; + } + + public function filterName(): array + { + return [ + 'description' => 'Filter the list result by the human-readable name of the resource', + 'type' => self::STRING_TYPE, + 'location' => self::QUERY, + ]; + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php index cf10b733b..4a1b70b67 100644 --- a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/Service.php @@ -8,6 +8,10 @@ /** * @property Api $api + * + * @deprecated Use Networking\v2\Service instead + * + * @internal */ class Service extends AbstractService { @@ -21,6 +25,9 @@ private function securityGroupRule(array $info = []): SecurityGroupRule return $this->model(SecurityGroupRule::class, $info); } + /** + * @return \Generator + */ public function listSecurityGroups(array $options = []): \Generator { return $this->securityGroup()->enumerate($this->api->getSecurityGroups(), $options); @@ -36,6 +43,9 @@ public function getSecurityGroup(string $id): SecurityGroup return $this->securityGroup(['id' => $id]); } + /** + * @return \Generator + */ public function listSecurityGroupRules(): \Generator { return $this->securityGroupRule()->enumerate($this->api->getSecurityRules()); diff --git a/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ServiceTrait.php b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ServiceTrait.php new file mode 100644 index 000000000..0e0bd9407 --- /dev/null +++ b/php-opencloud/openstack/src/Networking/v2/Extensions/SecurityGroups/ServiceTrait.php @@ -0,0 +1,62 @@ +model(SecurityGroup::class, $info); + } + + private function securityGroupRule(array $info = []): SecurityGroupRule + { + return $this->model(SecurityGroupRule::class, $info); + } + + /** + * @return \Generator + */ + public function listSecurityGroups(array $options = []): \Generator + { + return $this->securityGroup()->enumerate($this->api->getSecurityGroups(), $options); + } + + public function createSecurityGroup(array $options): SecurityGroup + { + return $this->securityGroup()->create($options); + } + + public function getSecurityGroup(string $id): SecurityGroup + { + return $this->securityGroup(['id' => $id]); + } + + /** + * @return \Generator + */ + public function listSecurityGroupRules(): \Generator + { + return $this->securityGroupRule()->enumerate($this->api->getSecurityRules()); + } + + public function createSecurityGroupRule(array $options): SecurityGroupRule + { + return $this->securityGroupRule()->create($options); + } + + public function getSecurityGroupRule(string $id): SecurityGroupRule + { + return $this->securityGroupRule(['id' => $id]); + } +} diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php index 42671b3df..70df8063d 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancer.php @@ -81,9 +81,6 @@ class LoadBalancer extends OperatorResource implements Creatable, Retrievable, U 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -91,9 +88,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postLoadBalancer(), $userOptions); @@ -101,27 +95,18 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancer(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putLoadBalancer()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteLoadBalancer()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php index 1322e589b..bc25dfddf 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerHealthMonitor.php @@ -104,9 +104,6 @@ class LoadBalancerHealthMonitor extends OperatorResource implements Creatable, R 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -114,9 +111,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postLoadBalancerHealthMonitor(), $userOptions); @@ -124,27 +118,18 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerHealthMonitor(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putLoadBalancerHealthMonitor()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteLoadBalancerHealthMonitor()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerListener.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerListener.php index 2ab1254b3..bc8175063 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerListener.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerListener.php @@ -103,9 +103,6 @@ class LoadBalancerListener extends OperatorResource implements Creatable, Retrie 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -114,9 +111,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postLoadBalancerListener(), $userOptions); @@ -124,27 +118,18 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerListener(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putLoadBalancerListener()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteLoadBalancerListener()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerMember.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerMember.php index a8d01c2b1..a4835bd10 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerMember.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerMember.php @@ -81,9 +81,6 @@ class LoadBalancerMember extends OperatorResource implements Creatable, Retrieva 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $userOptions = array_merge(['poolId' => $this->poolId], $userOptions); @@ -92,27 +89,18 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerMember(), ['poolId' => (string) $this->poolId, 'id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putLoadBalancerMember(), ['poolId' => (string) $this->poolId, 'id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteLoadBalancerMember(), ['poolId' => (string) $this->poolId, 'id' => (string) $this->id]); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerPool.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerPool.php index b18816524..195c0e7cf 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerPool.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerPool.php @@ -103,9 +103,6 @@ class LoadBalancerPool extends OperatorResource implements Creatable, Retrievabl 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -115,9 +112,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postLoadBalancerPool(), $userOptions); @@ -125,27 +119,18 @@ public function create(array $userOptions): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerPool(), ['id' => (string) $this->id]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putLoadBalancerPool()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteLoadBalancerPool()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStat.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStat.php index 4b34a91f4..0bde1af10 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStat.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStat.php @@ -49,9 +49,6 @@ class LoadBalancerStat extends OperatorResource implements Retrievable 'loadbalancer_id' => 'loadbalancerId', ]; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerStats(), ['loadbalancerId' => (string) $this->loadbalancerId]); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStatus.php b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStatus.php index 367952aac..e89e301cd 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStatus.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/LoadBalancerStatus.php @@ -54,9 +54,6 @@ class LoadBalancerStatus extends OperatorResource implements Retrievable 'provisioning_status' => 'provisioningStatus', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -64,9 +61,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getLoadBalancerStatuses(), ['loadbalancerId' => (string) $this->loadbalancerId]); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/Network.php b/php-opencloud/openstack/src/Networking/v2/Models/Network.php index 8bff5bc36..b9741ef56 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/Network.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/Network.php @@ -53,9 +53,6 @@ class Network extends OperatorResource implements Listable, Retrievable, Creatab protected $resourceKey = 'network'; protected $resourcesKey = 'networks'; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getNetwork(), ['id' => (string) $this->id]); @@ -77,8 +74,6 @@ public function bulkCreate(array $data): array } /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Networking\v2\Api::postNetwork} */ public function create(array $data): Creatable @@ -88,18 +83,12 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putNetwork()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteNetwork()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/Port.php b/php-opencloud/openstack/src/Networking/v2/Models/Port.php index 8f1cf03ff..9c3dd6d51 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/Port.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/Port.php @@ -136,9 +136,6 @@ class Port extends OperatorResource implements Creatable, Updateable, Deletable, protected $resourceKey = 'port'; protected $resourcesKey = 'ports'; - /** - * {@inheritdoc} - */ public function create(array $userOptions): Creatable { $response = $this->execute($this->api->postSinglePort(), $userOptions); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/Quota.php b/php-opencloud/openstack/src/Networking/v2/Models/Quota.php index 3398d1dca..637b94440 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/Quota.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/Quota.php @@ -77,27 +77,18 @@ class Quota extends OperatorResource implements Retrievable, Updateable, Deletab 'rbac_policy' => 'rbacPolicy', ]; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getQuota(), ['tenantId' => (string) $this->tenantId]); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putQuota()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteQuota()); diff --git a/php-opencloud/openstack/src/Networking/v2/Models/Subnet.php b/php-opencloud/openstack/src/Networking/v2/Models/Subnet.php index bf77c5c72..f1000c765 100644 --- a/php-opencloud/openstack/src/Networking/v2/Models/Subnet.php +++ b/php-opencloud/openstack/src/Networking/v2/Models/Subnet.php @@ -68,9 +68,6 @@ class Subnet extends OperatorResource implements Listable, Retrievable, Creatabl protected $resourceKey = 'subnet'; protected $resourcesKey = 'subnets'; - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->getSubnet(), ['id' => (string) $this->id]); @@ -92,8 +89,6 @@ public function bulkCreate(array $data): array } /** - * {@inheritdoc} - * * @param array $data {@see \OpenStack\Networking\v2\Api::postSubnet} */ public function create(array $data): Creatable @@ -103,26 +98,17 @@ public function create(array $data): Creatable return $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function update() { $response = $this->executeWithState($this->api->putSubnet()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteSubnet()); } - /** - * {@inheritdoc} - */ protected function getAttrs(array $keys) { $output = parent::getAttrs($keys); diff --git a/php-opencloud/openstack/src/Networking/v2/Params.php b/php-opencloud/openstack/src/Networking/v2/Params.php index ea0938237..2e68a505b 100644 --- a/php-opencloud/openstack/src/Networking/v2/Params.php +++ b/php-opencloud/openstack/src/Networking/v2/Params.php @@ -5,9 +5,14 @@ namespace OpenStack\Networking\v2; use OpenStack\Common\Api\AbstractParams; +use OpenStack\Networking\v2\Extensions\Layer3\ParamsTrait as Layer3; +use OpenStack\Networking\v2\Extensions\SecurityGroups\ParamsTrait as SecurityGroups; class Params extends AbstractParams { + use Layer3; + use SecurityGroups; + /** * Returns information about description parameter. */ @@ -719,4 +724,13 @@ public function type(): array 'description' => 'The type of health monitor. Must be one of TCP, HTTP, HTTPS', ]; } + + public function tenantIdJson(): array + { + return [ + 'type' => self::STRING_TYPE, + 'description' => 'The UUID of the tenant. Only administrative users can specify a tenant UUID other than their own.', + 'sentAs' => 'tenant_id', + ]; + } } diff --git a/php-opencloud/openstack/src/Networking/v2/Service.php b/php-opencloud/openstack/src/Networking/v2/Service.php index 2e1f7169d..03ec9c73b 100644 --- a/php-opencloud/openstack/src/Networking/v2/Service.php +++ b/php-opencloud/openstack/src/Networking/v2/Service.php @@ -5,13 +5,14 @@ namespace OpenStack\Networking\v2; use OpenStack\Common\Service\AbstractService; +use OpenStack\Networking\v2\Extensions\Layer3\ServiceTrait as Layer3; +use OpenStack\Networking\v2\Extensions\SecurityGroups\ServiceTrait as SecurityGroups; use OpenStack\Networking\v2\Models\LoadBalancer; use OpenStack\Networking\v2\Models\LoadBalancerHealthMonitor; use OpenStack\Networking\v2\Models\LoadBalancerListener; use OpenStack\Networking\v2\Models\LoadBalancerMember; use OpenStack\Networking\v2\Models\LoadBalancerPool; use OpenStack\Networking\v2\Models\Network; -use OpenStack\Networking\v2\Models\Pool; use OpenStack\Networking\v2\Models\Port; use OpenStack\Networking\v2\Models\Quota; use OpenStack\Networking\v2\Models\Subnet; @@ -19,10 +20,13 @@ /** * Network v2 service for OpenStack. * - * @property \OpenStack\Networking\v2\Api $api + * @property Api $api */ class Service extends AbstractService { + use Layer3; + use SecurityGroups; + /** * Create a new network resource. * @@ -57,6 +61,8 @@ public function getNetwork(string $id): Network * List networks. * * @param array $options {@see \OpenStack\Networking\v2\Api::getNetworks} + * + * @return \Generator */ public function listNetworks(array $options = []): \Generator { @@ -99,6 +105,8 @@ public function getSubnet(string $id): Subnet * List subnets. * * @param array $options {@see \OpenStack\Networking\v2\Api::getSubnets} + * + * @return \Generator */ public function listSubnets(array $options = []): \Generator { @@ -141,6 +149,8 @@ public function getPort(string $id): Port * List ports. * * @param array $options {@see \OpenStack\Networking\v2\Api::getPorts} + * + * @return \Generator */ public function listPorts(array $options = []): \Generator { @@ -149,6 +159,8 @@ public function listPorts(array $options = []): \Generator /** * Lists quotas for projects with non-default quota values. + * + * @return \Generator */ public function listQuotas(): \Generator { @@ -180,6 +192,8 @@ public function getDefaultQuota(string $tenantId): Quota /** * Lists loadbalancers for projects. + * + * @return \Generator */ public function listLoadBalancers(): \Generator { @@ -206,6 +220,8 @@ public function createLoadBalancer(array $options): LoadBalancer /** * Lists loadbalancer listeners. + * + * @return \Generator */ public function listLoadBalancerListeners(): \Generator { @@ -232,6 +248,8 @@ public function createLoadBalancerListener(array $options): LoadBalancerListener /** * Lists loadbalancer pools. + * + * @return \Generator */ public function listLoadBalancerPools(): \Generator { @@ -258,6 +276,8 @@ public function createLoadBalancerPool(array $options): LoadBalancerPool /** * Lists loadbalancer members. + * + * @return \Generator */ public function listLoadBalancerMembers(string $poolId): \Generator { @@ -284,6 +304,8 @@ public function createLoadBalancerMember(array $options): LoadBalancerMember /** * Lists loadbalancer healthmonitors. + * + * @return \Generator */ public function listLoadBalancerHealthMonitors(): \Generator { diff --git a/php-opencloud/openstack/src/ObjectStore/v1/Models/Account.php b/php-opencloud/openstack/src/ObjectStore/v1/Models/Account.php index 84ef1fd4f..576c6b77b 100644 --- a/php-opencloud/openstack/src/ObjectStore/v1/Models/Account.php +++ b/php-opencloud/openstack/src/ObjectStore/v1/Models/Account.php @@ -16,7 +16,7 @@ class Account extends OperatorResource implements Retrievable, HasMetadata { use MetadataTrait; - const METADATA_PREFIX = 'X-Account-Meta-'; + public const METADATA_PREFIX = 'X-Account-Meta-'; /** @var int */ public $objectCount; @@ -33,9 +33,6 @@ class Account extends OperatorResource implements Retrievable, HasMetadata /** @var string */ public $tempUrl; - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response): self { parent::populateFromResponse($response); @@ -49,27 +46,18 @@ public function populateFromResponse(ResponseInterface $response): self return $this; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->execute($this->api->headAccount()); $this->populateFromResponse($response); } - /** - * {@inheritdoc} - */ public function mergeMetadata(array $metadata) { $response = $this->execute($this->api->postAccount(), ['metadata' => $metadata]); $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function resetMetadata(array $metadata) { $options = [ @@ -87,9 +75,6 @@ public function resetMetadata(array $metadata) $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function getMetadata(): array { $response = $this->execute($this->api->headAccount()); diff --git a/php-opencloud/openstack/src/ObjectStore/v1/Models/Container.php b/php-opencloud/openstack/src/ObjectStore/v1/Models/Container.php index b0ca88904..fa9350268 100644 --- a/php-opencloud/openstack/src/ObjectStore/v1/Models/Container.php +++ b/php-opencloud/openstack/src/ObjectStore/v1/Models/Container.php @@ -22,7 +22,7 @@ class Container extends OperatorResource implements Creatable, Deletable, Retrie { use MetadataTrait; - const METADATA_PREFIX = 'X-Container-Meta-'; + public const METADATA_PREFIX = 'X-Container-Meta-'; /** @var int */ public $objectCount; @@ -38,9 +38,6 @@ class Container extends OperatorResource implements Creatable, Deletable, Retrie protected $markerKey = 'name'; - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response): self { parent::populateFromResponse($response); @@ -57,12 +54,14 @@ public function populateFromResponse(ResponseInterface $response): self * * @param array $options {@see \OpenStack\ObjectStore\v1\Api::getContainer} * @param callable|null $mapFn allows a function to be mapped over each element + * + * @return \Generator */ public function listObjects(array $options = [], callable $mapFn = null): \Generator { $options = array_merge($options, ['name' => $this->name, 'format' => 'json']); - $appendContainerNameFn = function (StorageObject $resource) use ($mapFn) { + $appendContainerNameFn = function (StorageObject $resource) use ($mapFn) { $resource->containerName = $this->name; if ($mapFn) { call_user_func_array($mapFn, [&$resource]); @@ -72,9 +71,6 @@ public function listObjects(array $options = [], callable $mapFn = null): \Gener return $this->model(StorageObject::class)->enumerate($this->api->getContainer(), $options, $appendContainerNameFn); } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->headContainer()); @@ -82,40 +78,31 @@ public function retrieve() } /** - * @param array $data {@see \OpenStack\ObjectStore\v1\Api::putContainer} + * @param array $userOptions {@see \OpenStack\ObjectStore\v1\Api::putContainer} * - * @return $this + * @return self */ - public function create(array $data): Creatable + public function create(array $userOptions): Creatable { - $response = $this->execute($this->api->putContainer(), $data); + $response = $this->execute($this->api->putContainer(), $userOptions); $this->populateFromResponse($response); - $this->name = $data['name']; + $this->name = $userOptions['name']; return $this; } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteContainer()); } - /** - * {@inheritdoc} - */ public function mergeMetadata(array $metadata) { $response = $this->execute($this->api->postContainer(), ['name' => $this->name, 'metadata' => $metadata]); $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function resetMetadata(array $metadata) { $options = [ @@ -134,9 +121,6 @@ public function resetMetadata(array $metadata) $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function getMetadata(): array { $response = $this->executeWithState($this->api->headContainer()); @@ -180,6 +164,22 @@ public function objectExists(string $name): bool } } + /** + * Verifies if provied segment index format for DLOs is valid. + * + * @param string $fmt The format of segment index name, e.g. %05d for 00001, 00002, etc. + * + * @return bool TRUE if the format is valid, FALSE if it is not + */ + public function isValidSegmentIndexFormat($fmt) + { + $testValue1 = sprintf($fmt, 1); + $testValue2 = sprintf($fmt, 10); + + // Test if different results of the same string length + return ($testValue1 !== $testValue2) && (strlen($testValue1) === strlen($testValue2)); + } + /** * Creates a single object according to the values provided. * @@ -197,11 +197,7 @@ public function createObject(array $data): StorageObject * container. When this completes, a manifest file is uploaded which references the prefix of the segments, * allowing concatenation when a request is executed against the manifest. * - * @param array $data {@see \OpenStack\ObjectStore\v1\Api::putObject} - * @param int $data['segmentSize'] The size in Bytes of each segment - * @param string $data['segmentContainer'] The container to which each segment will be uploaded - * @param string $data['segmentPrefix'] The prefix that will come before each segment. If omitted, a default - * is used: name/timestamp/filesize + * @param array $data {@see \OpenStack\ObjectStore\v1\Api::putObject} */ public function createLargeObject(array $data): StorageObject { @@ -213,6 +209,11 @@ public function createLargeObject(array $data): StorageObject $segmentPrefix = isset($data['segmentPrefix']) ? $data['segmentPrefix'] : sprintf('%s/%s/%d', $data['name'], microtime(true), $stream->getSize()); + $segmentIndexFormat = isset($data['segmentIndexFormat']) ? $data['segmentIndexFormat'] : '%05d'; + + if (!$this->isValidSegmentIndexFormat($segmentIndexFormat)) { + throw new \InvalidArgumentException('The provided segmentIndexFormat is not valid.'); + } /** @var \OpenStack\ObjectStore\v1\Service $service */ $service = $this->getService(); @@ -226,14 +227,16 @@ public function createLargeObject(array $data): StorageObject while (!$stream->eof() && $count < $totalSegments) { $promises[] = $this->model(StorageObject::class)->createAsync([ - 'name' => sprintf('%s/%d', $segmentPrefix, ++$count), + 'name' => sprintf('%s/'.$segmentIndexFormat, $segmentPrefix, ++$count), 'stream' => new LimitStream($stream, $segmentSize, ($count - 1) * $segmentSize), 'containerName' => $segmentContainer, ]); } /** @var Promise $p */ - $p = \GuzzleHttp\Promise\all($promises); + $p = function_exists('\GuzzleHttp\Promise\all') + ? \GuzzleHttp\Promise\all($promises) + : \GuzzleHttp\Promise\Utils::all($promises); $p->wait(); return $this->createObject([ diff --git a/php-opencloud/openstack/src/ObjectStore/v1/Models/MetadataTrait.php b/php-opencloud/openstack/src/ObjectStore/v1/Models/MetadataTrait.php index f4006aedb..b1e2beedf 100644 --- a/php-opencloud/openstack/src/ObjectStore/v1/Models/MetadataTrait.php +++ b/php-opencloud/openstack/src/ObjectStore/v1/Models/MetadataTrait.php @@ -13,7 +13,7 @@ public function parseMetadata(ResponseInterface $response): array $metadata = []; foreach ($response->getHeaders() as $header => $value) { - if (0 === strpos($header, static::METADATA_PREFIX)) { + if (0 === stripos($header, static::METADATA_PREFIX)) { $name = substr($header, strlen(static::METADATA_PREFIX)); $metadata[$name] = $response->getHeader($header)[0]; } diff --git a/php-opencloud/openstack/src/ObjectStore/v1/Models/StorageObject.php b/php-opencloud/openstack/src/ObjectStore/v1/Models/StorageObject.php index be4f2c8c1..c8a91f60f 100644 --- a/php-opencloud/openstack/src/ObjectStore/v1/Models/StorageObject.php +++ b/php-opencloud/openstack/src/ObjectStore/v1/Models/StorageObject.php @@ -21,7 +21,7 @@ class StorageObject extends OperatorResource implements Creatable, Deletable, Ha { use MetadataTrait; - const METADATA_PREFIX = 'X-Object-Meta-'; + public const METADATA_PREFIX = 'X-Object-Meta-'; /** @var string */ public $containerName; @@ -52,9 +52,6 @@ class StorageObject extends OperatorResource implements Creatable, Deletable, Ha 'subdir' => 'name', ]; - /** - * {@inheritdoc} - */ protected function getAliases(): array { return parent::getAliases() + [ @@ -62,9 +59,6 @@ protected function getAliases(): array ]; } - /** - * {@inheritdoc} - */ public function populateFromResponse(ResponseInterface $response): self { parent::populateFromResponse($response); @@ -98,8 +92,6 @@ public function getPublicUri(): Uri /** * @param array $data {@see \OpenStack\ObjectStore\v1\Api::putObject} - * - * @return $this */ public function create(array $data): Creatable { @@ -121,9 +113,6 @@ public function create(array $data): Creatable return $storageObject; } - /** - * {@inheritdoc} - */ public function retrieve() { $response = $this->executeWithState($this->api->headObject()); @@ -150,9 +139,6 @@ public function download(array $data = []): StreamInterface return $response->getBody(); } - /** - * {@inheritdoc} - */ public function delete() { $this->executeWithState($this->api->deleteObject()); @@ -167,9 +153,6 @@ public function copy(array $options) $this->execute($this->api->copyObject(), $options); } - /** - * {@inheritdoc} - */ public function mergeMetadata(array $metadata) { $options = [ @@ -182,9 +165,6 @@ public function mergeMetadata(array $metadata) $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function resetMetadata(array $metadata) { $options = [ @@ -197,12 +177,10 @@ public function resetMetadata(array $metadata) $this->metadata = $this->parseMetadata($response); } - /** - * {@inheritdoc} - */ public function getMetadata(): array { $response = $this->executeWithState($this->api->headObject()); + $this->populateFromResponse($response); return $this->parseMetadata($response); } diff --git a/php-opencloud/openstack/src/ObjectStore/v1/Service.php b/php-opencloud/openstack/src/ObjectStore/v1/Service.php index 0f41da3bd..d4bdbae78 100644 --- a/php-opencloud/openstack/src/ObjectStore/v1/Service.php +++ b/php-opencloud/openstack/src/ObjectStore/v1/Service.php @@ -10,7 +10,7 @@ use OpenStack\ObjectStore\v1\Models\Container; /** - * @property \OpenStack\ObjectStore\v1\Api $api + * @property Api $api */ class Service extends AbstractService { @@ -27,6 +27,8 @@ public function getAccount(): Account * * @param array $options {@see \OpenStack\ObjectStore\v1\Api::getAccount} * @param callable|null $mapFn allows a function to be mapped over each element in the collection + * + * @return \Generator */ public function listContainers(array $options = [], callable $mapFn = null): \Generator { diff --git a/php-opencloud/openstack/src/OpenStack.php b/php-opencloud/openstack/src/OpenStack.php index 822de3030..4eecd642a 100644 --- a/php-opencloud/openstack/src/OpenStack.php +++ b/php-opencloud/openstack/src/OpenStack.php @@ -5,9 +5,8 @@ namespace OpenStack; use GuzzleHttp\Client; -use GuzzleHttp\Middleware as GuzzleMiddleware; use OpenStack\Common\Service\Builder; -use OpenStack\Common\Transport\HandlerStack; +use OpenStack\Common\Transport\HandlerStackFactory; use OpenStack\Common\Transport\Utils; use OpenStack\Identity\v3\Service; @@ -33,10 +32,12 @@ class OpenStack * ['messageFormatter'] = (MessageFormatter) Must set if debugLog is true [OPTIONAL] * ['requestOptions'] = (array) Guzzle Http request options [OPTIONAL] * ['cachedToken'] = (array) Cached token credential [OPTIONAL] - * @param Builder $builder */ public function __construct(array $options = [], Builder $builder = null) { + $defaults = ['errorVerbosity' => 2]; + $options = array_merge($defaults, $options); + if (!isset($options['identityService'])) { $options['identityService'] = $this->getDefaultIdentityService($options); } @@ -50,15 +51,7 @@ private function getDefaultIdentityService(array $options): Service throw new \InvalidArgumentException("'authUrl' is a required option"); } - $stack = HandlerStack::create(); - - if (!empty($options['debugLog']) - && !empty($options['logger']) - && !empty($options['messageFormatter']) - ) { - $logMiddleware = GuzzleMiddleware::log($options['logger'], $options['messageFormatter']); - $stack->push($logMiddleware, 'logger'); - } + $stack = HandlerStackFactory::createWithOptions(array_merge($options, ['token' => null])); $clientOptions = [ 'base_uri' => Utils::normalizeUrl($options['authUrl']), @@ -100,6 +93,8 @@ public function networkingV2(array $options = []): Networking\v2\Service * Creates a new Networking v2 Layer 3 service. * * @param array $options options that will be used in configuring the service + * + * @deprecated Use networkingV2 instead */ public function networkingV2ExtLayer3(array $options = []): Networking\v2\Extensions\Layer3\Service { @@ -112,6 +107,8 @@ public function networkingV2ExtLayer3(array $options = []): Networking\v2\Extens * Creates a new Networking v2 Layer 3 service. * * @param array $options options that will be used in configuring the service + * + * @deprecated Use networkingV2 instead */ public function networkingV2ExtSecGroups(array $options = []): Networking\v2\Extensions\SecurityGroups\Service { @@ -160,6 +157,8 @@ public function objectStoreV1(array $options = []): ObjectStore\v1\Service * Creates a new Block Storage v2 service. * * @param array $options options that will be used in configuring the service + * + * @deprecated Use blockStorageV3 instead */ public function blockStorageV2(array $options = []): BlockStorage\v2\Service { @@ -168,6 +167,18 @@ public function blockStorageV2(array $options = []): BlockStorage\v2\Service return $this->builder->createService('BlockStorage\\v2', array_merge($defaults, $options)); } + /** + * Creates a new Block Storage v3 service. + * + * @param array $options options that will be used in configuring the service + */ + public function blockStorageV3(array $options = []): BlockStorage\v3\Service + { + $defaults = ['catalogName' => 'cinderv3', 'catalogType' => 'volumev3']; + + return $this->builder->createService('BlockStorage\\v3', array_merge($defaults, $options)); + } + /** * Creates a new Images v2 service. *