summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
diff options
context:
space:
mode:
authorEoleDev <root@serverpc.home>2016-03-09 15:36:02 +0100
committerEoleDev <root@serverpc.home>2016-03-09 15:36:02 +0100
commitc479658f0bb953ded4b29ca573404a318f1e798f (patch)
treef4c4fa4b7e245abd462794df5b6525ed41306e77 /server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
parent5c6f6c97b7b906476ad5b9ed193e0140dd66f977 (diff)
New Library
Diffstat (limited to 'server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php')
-rw-r--r--server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php107
1 files changed, 107 insertions, 0 deletions
diff --git a/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php b/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
new file mode 100644
index 0000000..d395d10
--- /dev/null
+++ b/server/vendor/php-opencloud/common/tests/unit/Fixtures/ComputeV2Api.php
@@ -0,0 +1,107 @@
+<?php
+
+namespace OpenCloud\Test\Fixtures;
+
+use OpenCloud\Common\Api\ApiInterface;
+
+class ComputeV2Api implements ApiInterface
+{
+ private $idParam = ['type' => 'string', 'required' => true, 'location' => 'url'];
+
+ public function getImage()
+ {
+ return [
+ 'method' => 'GET',
+ 'path' => 'images/{id}',
+ 'params' => [self::$idParam]
+ ];
+ }
+
+ public function postServer()
+ {
+ return [
+ 'path' => 'servers',
+ 'method' => 'POST',
+ 'jsonKey' => 'server',
+ 'params' => [
+ 'removeMetadata' => [
+ 'type' => 'object',
+ 'properties' => ['type' => 'string'],
+ ],
+ 'securityGroups' => [
+ 'type' => 'array',
+ 'items' => [
+ 'type' => 'object',
+ 'properties' => [
+ 'name' => ['type' => 'string']
+ ]
+ ],
+ 'sentAs' => 'security_groups',
+ ],
+ 'userData' => ['type' => 'string', 'sentAs' => 'user_data'],
+ 'availabilityZone' => ['type' => 'string', 'sentAs' => 'availability_zone'],
+ 'imageId' => ['type' => 'string', 'required' => true, 'sentAs' => 'imageRef'],
+ 'flavorId' => ['type' => 'string', 'required' => true, 'sentAs' => 'flavorRef'],
+ 'networks' => [
+ 'type' => 'array',
+ 'items' => [
+ 'type' => 'object',
+ 'properties' => [
+ 'uuid' => ['type' => 'string'],
+ 'port' => ['type' => 'string'],
+ ]
+ ]
+ ],
+ 'name' => ['type' => 'string', 'required' => true],
+ 'metadata' => ['type' => 'object', 'location' => 'json'],
+ 'personality' => ['type' => 'string'],
+ 'blockDeviceMapping' => [
+ 'type' => 'array',
+ 'sentAs' => 'block_device_mapping_v2',
+ 'items' => [
+ 'type' => 'object',
+ 'properties' => [
+ 'configDrive' => ['type' => 'string', 'sentAs' => 'config_drive'],
+ 'bootIndex' => ['type' => 'string', 'sentAs' => 'boot_index'],
+ 'deleteOnTermination' => ['type' => 'boolean', 'sentAs' => 'delete_on_termination'],
+ 'guestFormat' => ['type' => 'string', 'sentAs' => 'guest_format'],
+ 'destinationType' => ['type' => 'string', 'sentAs' => 'destination_type'],
+ 'sourceType' => ['type' => 'string', 'sentAs' => 'source_type'],
+ 'deviceName' => ['type' => 'string', 'sentAs' => 'device_name'],
+ ]
+ ],
+ ],
+ ]
+ ];
+ }
+
+ public function test()
+ {
+ return [
+ 'method' => 'GET',
+ 'path' => 'foo',
+ 'params' => [
+ 'id' => ['type' => 'string', 'location' => 'json'],
+ 'bar' => ['type' => 'string', 'location' => 'json'],
+ ]
+ ];
+ }
+
+ public function getServers()
+ {
+ return [
+ 'method' => 'GET',
+ 'path' => 'servers',
+ 'params' => [
+ 'changesSince' => ['sentAs' => 'changes-since', 'type' => 'string', 'location' => 'query'],
+ 'imageId' => ['sentAs' => 'image', 'type' => 'string', 'location' => 'query'],
+ 'flavorId' => ['sentAs' => 'flavor', 'type' => 'string', 'location' => 'query'],
+ 'name' => ['type' => 'string', 'location' => 'query'],
+ 'marker' => ['type' => 'string', 'location' => 'query'],
+ 'limit' => ['type' => 'integer', 'location' => 'query'],
+ 'status' => ['type' => 'string', 'location' => 'query'],
+ 'host' => ['type' => 'string', 'location' => 'query']
+ ],
+ ];
+ }
+}