-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathParams.php
More file actions
568 lines (508 loc) · 18.1 KB
/
Params.php
File metadata and controls
568 lines (508 loc) · 18.1 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<?php declare(strict_types=1);
namespace OpenStack\Compute\v2;
use OpenStack\Common\Api\AbstractParams;
class Params extends AbstractParams
{
public function urlId(string $type): array
{
return array_merge(parent::id($type), [
'required' => true,
'location' => self::URL,
'documented' => false,
]);
}
public function minDisk(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::QUERY,
'description' => 'Return flavors that have a minimum disk space in GB.',
];
}
public function minRam(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::QUERY,
'description' => 'Return flavors that have a minimum RAM size in GB.',
];
}
public function flavorName(): array
{
return [
'location' => self::QUERY,
'description' => 'Return images which match a certain name.',
];
}
public function filterChangesSince($type)
{
return [
'location' => self::QUERY,
'sentAs' => 'changes-since',
'description' => sprintf(
"Return %ss which have been changed since a certain time. This value needs to be in an ISO 8601 format.",
$type
),
];
}
public function flavorServer(): array
{
return [
'location' => self::QUERY,
'description' => sprintf("Return images which are associated with a server. This value needs to be in a URL format.")
];
}
public function filterStatus(string $type): array
{
return [
'location' => self::QUERY,
'description' => sprintf(
"Return %ss that have a particular status, such as \"ACTIVE\".",
$type
)
];
}
public function flavorType(): array
{
return [
'location' => self::QUERY,
'description' => 'Return images that are of a particular type, such as "snapshot" or "backup".',
];
}
public function key(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::URL,
'required' => true,
'description' => 'The specific metadata key you are interacting with',
];
}
public function ipv4(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
'sentAs' => 'accessIPv4',
'description' => 'The IP address (version 4) of the remote resource',
];
}
public function ipv6(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
'sentAs' => 'accessIPv6',
'description' => 'The IP address (version 6) of the remote resource',
];
}
public function imageId(): array
{
return [
'type' => self::STRING_TYPE,
'required' => true,
'sentAs' => 'imageRef',
'description' => 'The UUID of the image to use for your server instance. This is not required in case of boot from volume. In all other cases it is required and must be a valid UUID',
];
}
public function flavorId(): array
{
return [
'type' => self::STRING_TYPE,
'required' => true,
'sentAs' => 'flavorRef',
'description' => 'The unique ID of the flavor that this server will be based on',
];
}
public function metadata(): array
{
return [
'type' => self::OBJECT_TYPE,
'location' => self::JSON,
'required' => true,
'description' => 'An arbitrary key/value pairing that will be used for metadata.',
'properties' => [
'type' => self::STRING_TYPE,
'description' => <<<TYPEOTHER
The value being set for your key. Bear in mind that "key" is just an example, you can name it anything.
TYPEOTHER
]
];
}
public function extraSpecs(): array
{
return [
'type' => self::OBJECT_TYPE,
'sentAs' => 'extra_specs',
'location' => self::JSON,
'required' => true,
'description' => 'An arbitrary key/value pairing that will be used for extra specs.',
'properties' => [
'type' => self::STRING_TYPE,
'description' => <<<TYPEOTHER
The value being set for your key. Bear in mind that "key" is just an example, you can name it anything.
TYPEOTHER
]
];
}
public function personality(): array
{
return [
'type' => self::ARRAY_TYPE,
'items' => [
'type' => self::OBJECT_TYPE,
'properties' => [
'path' => [
'type' => self::STRING_TYPE,
'description' => 'The path, on the filesystem, where the personality file will be placed'
],
'contents' => [
'type' => self::STRING_TYPE,
'description' => 'Base64-encoded content of the personality file'
],
]
],
'description' => <<<EOL
File path and contents (text only) to inject into the server at launch. The maximum size of the file path data is 255
bytes. The maximum limit refers to the number of bytes in the decoded data and not the number of characters in the
encoded data.
EOL
];
}
public function securityGroups(): array
{
return [
'type' => self::ARRAY_TYPE,
'sentAs' => 'security_groups',
'description' => 'A list of security group objects which this server will be associated with',
'items' => [
'type' => self::OBJECT_TYPE,
'properties' => ['name' => $this->name('security group')]
],
];
}
public function userData(): array
{
return [
'type' => self::STRING_TYPE,
'sentAs' => 'user_data',
'description' => 'Configuration information or scripts to use upon launch. Must be Base64 encoded.',
];
}
public function availabilityZone(): array
{
return [
'type' => self::STRING_TYPE,
'sentAs' => 'availability_zone',
'description' => 'The availability zone in which to launch the server.',
];
}
public function networks(): array
{
return [
'type' => self::ARRAY_TYPE,
'description' => <<<EOT
A list of network objects which this server will be associated with. By default, the server instance is provisioned
with all isolated networks for the tenant. Optionally, you can create one or more NICs on the server.
To provision the server instance with a NIC for a network, specify the UUID of the network in the uuid attribute in a
networks object.
To provision the server instance with a NIC for an already existing port, specify the port-id in the port attribute in
a networks object.
EOT
,
'items' => [
'type' => self::OBJECT_TYPE,
'properties' => [
'uuid' => [
'type' => self::STRING_TYPE,
'description' => <<<EOL
To provision the server instance with a NIC for a network, specify the UUID of the network in the uuid attribute in a
networks object. Required if you omit the port attribute
EOL
],
'port' => [
'type' => self::STRING_TYPE,
'description' => <<<EOL
To provision the server instance with a NIC for an already existing port, specify the port-id in the port attribute in
a networks object. The port status must be DOWN. Required if you omit the uuid attribute.
EOL
],
]
]
];
}
public function blockDeviceMapping(): array
{
return [
'type' => self::ARRAY_TYPE,
'sentAs' => 'block_device_mapping_v2',
'description' => <<<EOL
Enables booting the server from a volume when additional parameters are given. If specified, the volume status must be
available, and the volume attach_status in OpenStack Block Storage DB must be detached.
EOL
,
'items' => [
'type' => self::OBJECT_TYPE,
'properties' => [
'uuid' => [
'type' => self::STRING_TYPE,
'description' => 'The unique ID for the volume which the server is to be booted from.',
],
'bootIndex' => [
'type' => self::INT_TYPE,
'sentAs' => 'boot_index',
'description' => 'Indicates a number designating the boot order of the device. Use -1 for the boot volume, choose 0 for an attached volume.',
],
'deleteOnTermination' => [
'type' => self::BOOL_TYPE,
'sentAs' => 'delete_on_termination',
'description' => 'To delete the boot volume when the server stops, specify true. Otherwise, specify false.',
],
'guestFormat' => [
'type' => self::STRING_TYPE,
'sentAs' => 'guest_format',
'description' => 'Specifies the guest server disk file system format, such as "ephemeral" or "swap".',
],
'destinationType' => [
'type' => self::STRING_TYPE,
'sentAs' => 'destination_type',
'description' => 'Describes where the volume comes from. Choices are "local" or "volume". When using "volume" the volume ID',
],
'sourceType' => [
'type' => self::STRING_TYPE,
'sentAs' => 'source_type',
'description' => 'Describes the volume source type for the volume. Choices are "blank", "snapshot", "volume", or "image".',
],
'deviceName' => [
'type' => self::STRING_TYPE,
'sentAs' => 'device_name',
'description' => 'Describes a path to the device for the volume you want to use to boot the server.',
],
'volumeSize' => [
'type' => self::INT_TYPE,
'sentAs' => 'volume_size',
'description' => 'Size of the volume created if we are doing vol creation',
],
]
],
];
}
public function filterHost(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::QUERY,
'description' => '',
];
}
public function filterName(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::QUERY,
'description' => '',
];
}
public function filterFlavor(): array
{
return [
'sentAs' => 'flavor',
'type' => self::STRING_TYPE,
'location' => self::QUERY,
'description' => '',
];
}
public function filterImage(): array
{
return [
'sentAs' => 'image',
'type' => self::STRING_TYPE,
'location' => self::QUERY,
'description' => '',
];
}
public function password(): array
{
return [
'sentAs' => 'adminPass',
'type' => self::STRING_TYPE,
'location' => self::JSON,
'required' => true,
'description' => '',
];
}
public function rebootType(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
'required' => true,
'description' => '',
];
}
public function nullAction(): array
{
return [
'type' => self::NULL_TYPE,
'location' => self::JSON,
'required' => true
];
}
public function networkLabel(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::URL,
'required' => true,
];
}
public function keyName(): array
{
return [
'type' => self::STRING_TYPE,
'required' => false,
'sentAs' => 'key_name',
'description' => 'The key name',
];
}
public function keypairPublicKey(): array
{
return [
'type' => self::STRING_TYPE,
'sentAs' => 'public_key',
'location' => self::JSON,
'description' => 'The public ssh key to import. If you omit this value, a key is generated.',
];
}
public function keypairName(): array
{
return [
'location' => self::URL,
];
}
public function flavorRam(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::JSON
];
}
public function flavorVcpus(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::JSON
];
}
public function flavorDisk(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::JSON
];
}
public function flavorSwap(): array
{
return [
'type' => self::INT_TYPE,
'location' => self::JSON
];
}
public function volumeId(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
];
}
public function attachmentId(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::URL,
'required' => true,
];
}
public function consoleType(): array
{
return [
'type' => self::STRING_TYPE,
'location' => self::JSON,
'required' => true
];
}
protected function quotaSetLimit($sentAs, $description): array
{
return [
'type' => self::INT_TYPE,
'location' => self::JSON,
'sentAs' => $sentAs,
'description' => $description
];
}
public function quotaSetLimitForce(): array
{
return [
'type' => self::BOOLEAN_TYPE,
'location' => self::JSON,
'sentAs' => 'force',
'description' => 'You can force the update even if the quota has already been used and the reserved quota exceeds the new quota'
];
}
public function quotaSetLimitInstances(): array
{
return $this->quotaSetLimit('instances', 'The number of allowed instances for each tenant.');
}
public function quotaSetLimitCores(): array
{
return $this->quotaSetLimit('cores', 'The number of allowed instance cores for each tenant.');
}
public function quotaSetLimitFixedIps(): array
{
return $this->quotaSetLimit('fixed_ips', 'The number of allowed fixed IP addresses for each tenant. Must be equal to or greater than the number of allowed instances.');
}
public function quotaSetLimitFloatingIps(): array
{
return $this->quotaSetLimit('floating_ips', 'The number of allowed floating IP addresses for each tenant.');
}
public function quotaSetLimitInjectedFileContentBytes(): array
{
return $this->quotaSetLimit('injected_file_content_bytes', 'The number of allowed bytes of content for each injected file.');
}
public function quotaSetLimitInjectedFilePathBytes(): array
{
return $this->quotaSetLimit('injected_file_path_bytes', 'The number of allowed bytes for each injected file path.');
}
public function quotaSetLimitInjectedFiles(): array
{
return $this->quotaSetLimit('injected_files', 'The number of allowed injected files for each tenant.');
}
public function quotaSetLimitKeyPairs(): array
{
return $this->quotaSetLimit('key_pairs', 'The number of allowed key pairs for each user.');
}
public function quotaSetLimitMetadataItems(): array
{
return $this->quotaSetLimit('metadata_items', 'The number of allowed metadata items for each instance.');
}
public function quotaSetLimitRam(): array
{
return $this->quotaSetLimit('ram', 'The amount of allowed instance RAM (in MB) for each tenant.');
}
public function quotaSetLimitSecurityGroupRules(): array
{
return $this->quotaSetLimit('security_group_rules', 'The number of allowed rules for each security group.');
}
public function quotaSetLimitSecurityGroups(): array
{
return $this->quotaSetLimit('security_groups', 'The number of allowed security groups for each tenant.');
}
public function quotaSetLimitServerGroups(): array
{
return $this->quotaSetLimit('server_groups', 'The number of allowed server groups for each tenant.');
}
public function quotaSetLimitServerGroupMembers(): array
{
return $this->quotaSetLimit('server_group_members', 'The number of allowed members for each server group.');
}
}