Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b6f959a
GitHub workflows (#369)
k0ka Dec 7, 2023
b49c6a6
always recheck all tests on push to master (#370)
k0ka Dec 7, 2023
184990e
Restore read the docs (#371)
k0ka Dec 12, 2023
e1c63af
Fix documentation (#372)
k0ka Dec 12, 2023
3c85b6f
Fix documentation (#373)
k0ka Dec 12, 2023
5712c30
Fix sort_key and sort_dir parameters for BlockStorage/v2/listSnapshot…
k0ka Dec 20, 2023
0421764
fix list formating in documentation (#375)
k0ka Dec 20, 2023
a5ecd54
added phpdocs for better type hinting (#376)
k0ka Dec 20, 2023
1cad223
one integration workflow (#377)
k0ka Dec 20, 2023
47c8ed9
create BlockStorage v3 as copy of v2 (#378)
k0ka Jan 5, 2024
7651038
Chores (#379)
k0ka Jan 5, 2024
aeb5012
Application credentials (#380)
k0ka Jan 7, 2024
cb8caff
fix doc for application credentials (#381)
k0ka Jan 7, 2024
ac3ca5c
Handler stack factory (#382)
k0ka Jan 7, 2024
2804874
Fix testing class namespaces (#383)
k0ka Jan 7, 2024
45bd478
Refactor tests (#384)
k0ka Jan 8, 2024
2335c75
Move integration tests to phpunit (#387)
k0ka Jan 17, 2024
f5ca4e9
License: add full text, remove rackspace (#388)
k0ka Jan 17, 2024
e351554
added bigger rescue timeouts (#390)
k0ka Jan 17, 2024
f3b3c6f
return HandlerStack for BC (#391)
k0ka Jan 18, 2024
b5d1fc6
Merge network services (#392)
k0ka Jan 27, 2024
857fcc8
Clarify docs (#389)
k0ka Jan 30, 2024
b0e560d
Resume suspend server (#394)
k0ka Jan 30, 2024
9f817df
fix resume/suspend doc (#395)
k0ka Jan 30, 2024
ba44841
refactor unit tests: use `mockRequest` for all requests (#397)
k0ka Feb 1, 2024
c32ab23
Fix Swift container requests with "tokens" in its name (#396)
k0ka Feb 1, 2024
d823be3
add errorVerbosity (#400)
k0ka Feb 5, 2024
cb7fcc8
add docs for volume attachement (#401)
k0ka Feb 5, 2024
8f2ba03
fix doc links (#402)
k0ka Feb 5, 2024
38a6860
enchance error builder: output body only for json, limit body to 5 Kb…
k0ka Feb 10, 2024
2ed9c10
make swift metadata header case insensitive (#407)
k0ka Apr 2, 2024
e32dcf1
return unmaintaned openstack versions into ci (#408)
k0ka Apr 4, 2024
a7ae9d0
new openstack versions (#416)
k0ka Nov 8, 2024
989f5ed
increase sleep before testing detach. The VM must be completely up. (…
k0ka Nov 9, 2024
d305fb6
revert sleep time, add more debug to the failed test (#418)
k0ka Nov 9, 2024
998e5c0
feat: Add PHP 8.4 support (#415)
nickvergessen Nov 20, 2024
842981a
antelope unmaintained (#420)
k0ka Dec 14, 2024
9886899
extend FloatingIP with description and subnet_id (#421)
antondollmaier Jan 7, 2025
c934255
fix github actions (#423)
k0ka Mar 16, 2025
2a23c7b
Support json-schema v6 for nimbusoft/flysystem-openstack-swift . (#424)
evs-xsarus Apr 30, 2025
94bac6d
remove wallaby and yoga due to ubuntu 20.04 deprecation (#425)
k0ka Apr 30, 2025
b92ea55
merge headers in `OperatorTrait::sendRequest` (#427)
k0ka May 30, 2025
3b9f400
Merge branch 'update-v3.14.0'
giogurto-grande Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,22 @@ jobs:
openstack_version: [ "stable/2023.2" ]
php_version: [ 8.1 ]
include:
- name: "bobcat"
openstack_version: "stable/2023.2"
- name: "dalmatian"
openstack_version: "stable/2024.2"
ubuntu_version: "22.04"
- name: "caracal"
openstack_version: "stable/2024.1"
ubuntu_version: "22.04"
- name: "antelope"
openstack_version: "stable/2023.1"
openstack_version: "unmaintained/2023.1"
ubuntu_version: "22.04"
- name: "zed"
openstack_version: "stable/zed"
ubuntu_version: "20.04"
- name: "yoga"
openstack_version: "unmaintained/yoga"
ubuntu_version: "20.04"
- name: "wallaby"
openstack_version: "unmaintained/wallaby"
ubuntu_version: "20.04"
block_storage_v2: true
openstack_version: "unmaintained/zed"
ubuntu_version: "22.04"
runs-on: ubuntu-${{ matrix.ubuntu_version }}
name: Deploy OpenStack ${{ matrix.name }} and run integration tests with php ${{matrix.php_version}}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: get cache directory
id: composer-cache
Expand Down Expand Up @@ -120,7 +116,7 @@ jobs:

- name: Save logs
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: failure-logs
name: failure-logs-${{ strategy.job-index }}
path: failure-logs
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 ]
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 ]
composer:
- name: lowest
arg: "--prefer-lowest --prefer-stable"
Expand All @@ -34,7 +34,7 @@ jobs:
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.php_cs.cache
Expand Down
2 changes: 2 additions & 0 deletions COVERAGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# OpenStack versions coverage

While we strive to support all versions of OpenStack, we can only test limited number of versions. The current set:
* 2024.2 Dalmatian
* 2024.1 Caracal
* 2023.2 Bobcat
* 2023.1 Antelope
* Zed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"guzzlehttp/guzzle": "^7.0",
"guzzlehttp/psr7": ">=1.7",
"guzzlehttp/uri-template": "^0.2 || ^1.0",
"justinrainbow/json-schema": "^5.2"
"justinrainbow/json-schema": "^5.2 || ^6.0"
},
"require-dev": {
"ext-json": "*",
Expand Down
3 changes: 2 additions & 1 deletion samples/Networking/v2/floatingIPs/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
$floatingIp = $networking->createFloatingIp([
"floatingNetworkId" => "{networkId}",
"portId" => "{portId}",
'fixedIpAddress' => '{fixedIpAddress}',
"fixedIpAddress" => "{fixedIpAddress}",
"description" => "{description}",
]);
7 changes: 6 additions & 1 deletion src/Common/Api/OperatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ protected function sendRequest(Operation $operation, array $userValues = [], boo

$uri = Utils::uri_template($operation->getPath(), $userValues);

if (array_key_exists('requestOptions', $userValues)) {
if (isset($userValues['requestOptions'])) {
$options += $userValues['requestOptions'];

// headers are always created in options, merge them
if (isset($userValues['requestOptions']['headers'])) {
$options['headers'] = array_merge($options['headers'], $userValues['requestOptions']['headers']);
}
}

$options['openstack.skip_auth'] = $operation->getSkipAuth();
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Auth/AuthHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AuthHandler
/** @var Token */
private $token;

public function __construct(callable $nextHandler, callable $tokenGenerator, Token $token = null)
public function __construct(callable $nextHandler, callable $tokenGenerator, ?Token $token = null)
{
$this->nextHandler = $nextHandler;
$this->tokenGenerator = $tokenGenerator;
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Error/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Builder
*/
private $client;

public function __construct(ClientInterface $client = null)
public function __construct(?ClientInterface $client = null)
{
$this->client = $client ?: new Client();
}
Expand Down Expand Up @@ -164,7 +164,7 @@ private function getStatusCodeMessage(int $statusCode): string
* @param mixed $userValue The incorrect value the user actually provided
* @param string|null $furtherLink a link to further information if necessary (optional)
*/
public function userInputError(string $expectedType, $userValue, string $furtherLink = null): UserInputError
public function userInputError(string $expectedType, $userValue, ?string $furtherLink = null): UserInputError
{
$message = $this->header('User Input Error');

Expand Down
2 changes: 1 addition & 1 deletion src/Common/HydratorStrategyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function hydrate(array $data, array $aliases = [])
}
}

public function set(string $key, $property, array $data, callable $fn = null)
public function set(string $key, $property, array $data, ?callable $fn = null)
{
if (isset($data[$key]) && property_exists($this, $property)) {
$value = $fn ? call_user_func($fn, $data[$key]) : $data[$key];
Expand Down
2 changes: 1 addition & 1 deletion src/Common/JsonSchema/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Schema
/** @var Validator */
private $validator;

public function __construct($body, Validator $validator = null)
public function __construct($body, ?Validator $validator = null)
{
$this->body = (object) $body;
$this->validator = $validator ?: new Validator();
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Resource/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Alias
* @param string|null $className A class name for the property value
* @param bool $list Whether value of the property should be treated as a list or not
*/
public function __construct(string $propertyName, string $className = null, bool $list = false)
public function __construct(string $propertyName, ?string $className = null, bool $list = false)
{
$this->isList = $list;
$this->propertyName = $propertyName;
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Resource/Listable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ interface Listable
* of the marker will depend on the last element returned in the previous response. If a limit is
* provided, the loop will continue up until that point.
*
* @param array $def The operation definition
* @param array $userVals The user values
* @param callable $mapFn an optional callback that will be executed on every resource iteration
* @param array $def The operation definition
* @param array $userVals The user values
* @param callable|null $mapFn an optional callback that will be executed on every resource iteration
*
* @returns \Generator<mixed, static>
*/
public function enumerate(array $def, array $userVals = [], callable $mapFn = null);
public function enumerate(array $def, array $userVals = [], ?callable $mapFn = null);
}
4 changes: 2 additions & 2 deletions src/Common/Resource/OperatorResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private function getResourcesKey(): string
*
* @returns \Generator<mixed, static>
*/
public function enumerate(array $def, array $userVals = [], callable $mapFn = null): \Generator
public function enumerate(array $def, array $userVals = [], ?callable $mapFn = null): \Generator
{
$operation = $this->getOperation($def);

Expand Down Expand Up @@ -105,7 +105,7 @@ public function enumerate(array $def, array $userVals = [], callable $mapFn = nu
*
* @return array<self>
*/
public function extractMultipleInstances(ResponseInterface $response, string $key = null): array
public function extractMultipleInstances(ResponseInterface $response, ?string $key = null): array
{
$key = $key ?: $this->getResourcesKey();
$resourcesData = Utils::jsonDecode($response)[$key];
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Service/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function stockAuthHandler(array &$options): void
}
}

private function httpClient(string $baseUrl, HandlerStack $stack, string $serviceType = null, string $microVersion = null): ClientInterface
private function httpClient(string $baseUrl, HandlerStack $stack, ?string $serviceType = null, ?string $microVersion = null): ClientInterface
{
$clientOptions = [
'base_uri' => Utils::normalizeUrl($baseUrl),
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Transport/HandlerStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HandlerStack
/**
* @deprecated use \OpenStack\Common\Transport\HandlerStackFactory::createWithOptions instead
*/
public static function create(callable $handler = null): \GuzzleHttp\HandlerStack
public static function create(?callable $handler = null): \GuzzleHttp\HandlerStack
{
return HandlerStackFactory::create($handler);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Transport/HandlerStackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HandlerStackFactory
/**
* @deprecated use \OpenStack\Common\Transport\HandlerStackFactory::createWithOptions instead
*/
public static function create(callable $handler = null): HandlerStack
public static function create(?callable $handler = null): HandlerStack
{
$stack = new HandlerStack($handler ?: Utils::chooseHandler());
$stack->push(Middleware::httpErrors(), 'http_errors');
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Transport/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function (ResponseInterface $response) use ($request, $verbosity) {
};
}

public static function authHandler(callable $tokenGenerator, Token $token = null): callable
public static function authHandler(callable $tokenGenerator, ?Token $token = null): callable
{
return function (callable $handler) use ($tokenGenerator, $token) {
return new AuthHandler($handler, $tokenGenerator, $token);
Expand All @@ -49,7 +49,7 @@ public static function history(array &$container): callable
/**
* @codeCoverageIgnore
*/
public static function retry(callable $decider, callable $delay = null): callable
public static function retry(callable $decider, ?callable $delay = null): callable
{
return GuzzleMiddleware::retry($decider, $delay);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Transport/RequestSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RequestSerializer
{
private $jsonSerializer;

public function __construct(JsonSerializer $jsonSerializer = null)
public function __construct(?JsonSerializer $jsonSerializer = null)
{
$this->jsonSerializer = $jsonSerializer ?: new JsonSerializer();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Transport/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function jsonDecode(ResponseInterface $response, bool $assoc = tru
*
* @return array
*/
public static function flattenJson($data, string $key = null)
public static function flattenJson($data, ?string $key = null)
{
return (!empty($data) && $key && isset($data[$key])) ? $data[$key] : $data;
}
Expand Down
40 changes: 20 additions & 20 deletions src/Compute/v2/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function createServer(array $options): Server
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\Server>
*/
public function listServers(bool $detailed = false, array $options = [], callable $mapFn = null): \Generator
public function listServers(bool $detailed = false, array $options = [], ?callable $mapFn = null): \Generator
{
$def = (true === $detailed) ? $this->api->getServersDetail() : $this->api->getServers();

Expand Down Expand Up @@ -72,13 +72,13 @@ public function getServer(array $options = []): Server
/**
* List flavors.
*
* @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
* @param array $options {@see \OpenStack\Compute\v2\Api::getFlavors}
* @param callable|null $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<mixed, \OpenStack\Compute\v2\Models\Flavor>
*/
public function listFlavors(array $options = [], callable $mapFn = null, bool $detailed = false): \Generator
public function listFlavors(array $options = [], ?callable $mapFn = null, bool $detailed = false): \Generator
{
$def = true === $detailed ? $this->api->getFlavorsDetail() : $this->api->getFlavors();

Expand Down Expand Up @@ -119,7 +119,7 @@ public function createFlavor(array $options = []): Flavor
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\Image>
*/
public function listImages(array $options = [], callable $mapFn = null): \Generator
public function listImages(array $options = [], ?callable $mapFn = null): \Generator
{
return $this->model(Image::class)->enumerate($this->api->getImages(), $options, $mapFn);
}
Expand All @@ -143,12 +143,12 @@ public function getImage(array $options = []): Image
/**
* List key pairs.
*
* @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
* @param array $options {@see \OpenStack\Compute\v2\Api::getKeyPairs}
* @param callable|null $mapFn a callable function that will be invoked on every iteration of the list
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\Keypair>
*/
public function listKeypairs(array $options = [], callable $mapFn = null): \Generator
public function listKeypairs(array $options = [], ?callable $mapFn = null): \Generator
{
return $this->model(Keypair::class)->enumerate($this->api->getKeypairs(), $options, $mapFn);
}
Expand Down Expand Up @@ -197,14 +197,14 @@ public function getHypervisorStatistics(): HypervisorStatistic
/**
* List hypervisors.
*
* @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::getHypervisors}
* @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::getHypervisors}
* @param callable|null $mapFn a callable function that will be invoked on every iteration of the list
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\Hypervisor>
*/
public function listHypervisors(bool $detailed = false, array $options = [], callable $mapFn = null): \Generator
public function listHypervisors(bool $detailed = false, array $options = [], ?callable $mapFn = null): \Generator
{
$def = (true === $detailed) ? $this->api->getHypervisorsDetail() : $this->api->getHypervisors();

Expand All @@ -224,12 +224,12 @@ public function getHypervisor(array $options = []): Hypervisor
/**
* List hosts.
*
* @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
* @param array $options {@see \OpenStack\Compute\v2\Api::getHosts}
* @param callable|null $mapFn a callable function that will be invoked on every iteration of the list
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\Host>
*/
public function listHosts(array $options = [], callable $mapFn = null): \Generator
public function listHosts(array $options = [], ?callable $mapFn = null): \Generator
{
return $this->model(Host::class)->enumerate($this->api->getHosts(), $options, $mapFn);
}
Expand All @@ -255,12 +255,12 @@ public function getHost(array $options = []): Host
/**
* List AZs.
*
* @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
* @param array $options {@see \OpenStack\Compute\v2\Api::getAvailabilityZones}
* @param callable|null $mapFn a callable function that will be invoked on every iteration of the list
*
* @return \Generator<mixed, \OpenStack\Compute\v2\Models\AvailabilityZone>
*/
public function listAvailabilityZones(array $options = [], callable $mapFn = null): \Generator
public function listAvailabilityZones(array $options = [], ?callable $mapFn = null): \Generator
{
return $this->model(AvailabilityZone::class)->enumerate($this->api->getAvailabilityZones(), $options, $mapFn);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Images/v2/Models/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Schema extends \OpenStack\Common\JsonSchema\Schema
{
public function __construct($data, Validator $validator = null)
public function __construct($data, ?Validator $validator = null)
{
if (!isset($data->type)) {
$data->type = 'object';
Expand Down
2 changes: 2 additions & 0 deletions src/Networking/v2/Extensions/Layer3/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function postFloatingIps(): array
'jsonKey' => 'floatingip',
'params' => [
'tenantId' => $this->params->tenantIdJson(),
'description' => $this->notRequired($this->params->descriptionJson()),
'floatingNetworkId' => $this->params->floatingNetworkIdJson(),
'fixedIpAddress' => $this->params->fixedIpAddressJson(),
'floatingIpAddress' => $this->params->floatingIpAddressJson(),
Expand Down Expand Up @@ -53,6 +54,7 @@ public function putFloatingIp(): array
'jsonKey' => 'floatingip',
'params' => [
'id' => $this->params->idPath(),
'description' => $this->notRequired($this->params->descriptionJson()),
'floatingNetworkId' => $this->notRequired($this->params->floatingNetworkIdJson()),
'fixedIpAddress' => $this->params->fixedIpAddressJson(),
'floatingIpAddress' => $this->params->floatingIpAddressJson(),
Expand Down
Loading
Loading