1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
<?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',
'description' => 'An arbitrary key/value pairing that will be used for metadata.',
'properties' => [
'type' => 'string',
'description' => <<<TYPEOTHER
The value being set for your key. Bear in mind that "key" is just an example, you can name it anything.
TYPEOTHER
]
],
'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']
],
];
}
}
|