Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/supported-versions' into support…
Browse files Browse the repository at this point in the history
…ed-versions
  • Loading branch information
k0ka committed Jan 5, 2024
2 parents d5dea1b + 5aa3c01 commit f9eb5ff
Show file tree
Hide file tree
Showing 69 changed files with 14 additions and 531 deletions.
9 changes: 0 additions & 9 deletions src/BlockStorage/v2/Models/QuotaSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 0 additions & 5 deletions src/BlockStorage/v2/Models/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() + [
Expand All @@ -84,8 +81,6 @@ public function retrieve()
}

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postSnapshots}
*/
public function create(array $userOptions): Creatable
Expand Down
11 changes: 0 additions & 11 deletions src/BlockStorage/v2/Models/Volume.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ class Volume extends OperatorResource implements Creatable, Listable, Updateable
'volume_image_metadata' => 'volumeImageMetadata',
];

/**
* {@inheritdoc}
*/
protected function getAliases(): array
{
return parent::getAliases() + [
Expand All @@ -110,8 +107,6 @@ public function retrieve()
}

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postVolumes}
*/
public function create(array $userOptions): Creatable
Expand Down Expand Up @@ -179,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)
Expand Down
2 changes: 0 additions & 2 deletions src/BlockStorage/v2/Models/VolumeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class VolumeType extends OperatorResource implements Listable, Creatable, Update
protected $resourcesKey = 'volume_types';

/**
* {@inheritdoc}
*
* @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postTypes}
*/
public function create(array $userOptions): Creatable
Expand Down
2 changes: 1 addition & 1 deletion src/BlockStorage/v2/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use OpenStack\Common\Service\AbstractService;

/**
* @property \OpenStack\BlockStorage\v2\Api $api
* @property Api $api
*/
class Service extends AbstractService
{
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Api/ApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Api/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public function hasParam(string $key): bool
}

/**
* @param $name
*
* @return Parameter
*/
public function getParam(string $name)
Expand Down
21 changes: 2 additions & 19 deletions src/Common/Api/OperatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ trait OperatorTrait
/** @var ApiInterface */
protected $api;

/**
* {@inheritdoc}
*/
public function __construct(ClientInterface $client, ApiInterface $api)
{
$this->client = $client;
Expand Down Expand Up @@ -61,9 +58,9 @@ public function __debugInfo()
* @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
*
* @return Promise
*
* @throws \RuntimeException If method does not exist
*/
public function __call($methodName, $args)
{
Expand All @@ -90,17 +87,12 @@ 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)
Expand All @@ -119,25 +111,16 @@ protected function sendRequest(Operation $operation, array $userValues = [], boo
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);
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Api/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 0 additions & 1 deletion src/Common/ArrayAccessTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ trait ArrayAccessTrait
* Sets an internal key with a value.
*
* @param string $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
{
Expand Down
5 changes: 0 additions & 5 deletions src/Common/Error/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ class Builder
*/
private $client;

/**
* @param ClientInterface $client
*/
public function __construct(ClientInterface $client = null)
{
$this->client = $client ?: new Client();
}

/**
* Internal method used when outputting headers in the error description.
*
* @param $name
*/
private function header(string $name): string
{
Expand Down
11 changes: 0 additions & 11 deletions src/Common/JsonPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -76,8 +72,6 @@ private function setPath(string $path, $value, array $json): array

/**
* Return the updated structure.
*
* @return mixed
*/
public function getStructure()
{
Expand All @@ -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)
Expand All @@ -98,9 +90,6 @@ public function get(string $path)

/**
* Internal method for recursion.
*
* @param $path
* @param $json
*/
private function getPath(string $path, $json)
{
Expand Down
5 changes: 0 additions & 5 deletions src/Common/Resource/Alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 0 additions & 6 deletions src/Common/Resource/OperatorResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])));
Expand Down Expand Up @@ -130,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);
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Service/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,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
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 @@ -9,7 +9,7 @@

class HandlerStack extends GuzzleStack
{
public static function create(?callable $handler = null): GuzzleStack
public static function create(callable $handler = null): GuzzleStack
{
$stack = new self($handler ?: Utils::chooseHandler());
$stack->push(Middleware::httpErrors(), 'http_errors');
Expand Down
3 changes: 2 additions & 1 deletion src/Common/Transport/JsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)));
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/Common/Transport/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ function (ResponseInterface $response) use ($request) {
};
}

/**
* @param Token $token
*/
public static function authHandler(callable $tokenGenerator, Token $token = null): callable
{
return function (callable $handler) use ($tokenGenerator, $token) {
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Transport/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
9 changes: 0 additions & 9 deletions src/Compute/v2/Models/Flavor.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,19 @@ 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);

return $this->populateFromResponse($response);
}

/**
* {@inheritdoc}
*/
public function delete()
{
$this->execute($this->api->deleteFlavor(), ['id' => (string) $this->id]);
Expand Down
3 changes: 0 additions & 3 deletions src/Compute/v2/Models/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand Down
3 changes: 0 additions & 3 deletions src/Compute/v2/Models/Hypervisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
Loading

0 comments on commit f9eb5ff

Please sign in to comment.