forked from thecodeteam/libstorage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libstorage.apib
2379 lines (1676 loc) · 69.8 KB
/
libstorage.apib
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
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
# libStorage
`libStorage` provides a vendor agnostic storage orchestration model, API, and
reference client and server implementations.
## Headers
The libStorage API supports custom headers for sending information
about a client's instance ID and local devices as well as other
pieces of data.
### Request Headers
libStorage supports the following request headers:
Name | Description
-----|------------
`Libstorage-Instanceid` | A client's instance ID
`Libstorage-Localdevices` | The client's local device map
`Libstorage-Txid` | A transaction ID
`Libstorage-Txcr` | The timestamp (epoch) at which the transaction was created.
Please note the header names are case sensitive and must comply with the above,
listed values. This is in adherence to the
[canonical header](https://golang.org/pkg/net/http/#CanonicalHeaderKey) format.
<a name="def-instance-id"></a>
#### Instance ID
A client's instance ID must be provided to the remote libStorage
server in order for certain storage operations to succeed. Because
there are API operations using the GET method, a header is the only
logical choice for encapsulating the instance ID.
The name of the header is `Libstorage-Instanceid` and it adheres to
the following format:
```
Libstorage-Instanceid: DRIVER=ID,FIELDS,METADATA
```
The header's value is made up of several pieces of information, as
illustrated in the above example format:
Name | Description
------|------------
`DRIVER` | The driver for which the instance ID is intended.
`ID` | The instance ID. This is a string value.
`FIELDS` | A URL-encoded string of key-value pairs.
`METADATA` | A base-64 encoded buffer that can be used to transport temporary "seed" data to a driver's `InstanceInspect` function in order to generate the real instance ID.
The following is an example of headers for sending
instance ID information generated by EBS and EFS:
```
Libstorage-Instanceid: ebs=i-1234,region=west
Libstorage-Instanceid: efs=i-1234,region%3Deast%2Czone%3D2
```
Notice that the instance ID for the EFS driver contains
encoded characters. That's because the `FIELDS` component
of an instance ID is URL encoded like a query string in
order to escape `=` and `,` characters.
The instance ID's `METADATA` component is temporary and
used only by storage platforms that are not able to fully
generate an instance ID on the client-side. For example,
the ScaleIO platform generates the client's ScaleIO GUID
and uses the libStorage server's `InstanceInspect` API
to build the actual instance ID. Thus the initial instance
ID might be sent as :
```
Libstorage-Instanceid: scaleio=,,MWJiOTFmMDctODU2ZC00YWY5LWFjZWQtM2UzZmMzOTY0MDU5
```
The above instance ID lacks an actual ID and any fields. The only data
present is the `METADATA`, a base-64 encoded value that the remote
storage driver knows how to unmarshal.
On the server-side the ScaleIO driver would take the metadata and use
it to generate the actual instance ID, responding to the client with
a response header:
```
Libstorage-Instanceid: scaleio=client-123
```
Subsequent calls from the client to the server would then use the
fully-formed instance ID where required.
Please note that the `InstanceInspect` call will also return any
`FIELD` data in the response header. Only the `METADATA` is stripped.
<a name="def-local-devices"></a>
#### Local Devices
The client must also transmit information about its local devices. The
header adheres to the following format:
```
Libstorage-Localdevices: DRIVER=VOLUME_ID::DEVICE_PATH[,VOLUME_ID::DEVICE_PATH,...]
```
Name | Description
------|------------
`DRIVER` | The driver for which the local devices map is intended.
`VOLUME_ID` | A piece of information obtainable on the client that can be used on the server-side to identify a volume.
`DEVICE_PATH` | The path to the device on the client at which the volume is attached.
The following is an example of headers for sending
local device maps generated by EBS and ScaleIO:
```
Libstorage-Localdevices: ebs=/dev/xvdf::/dev/xvdf,/dev/xvdg::/dev/xvdg
Libstorage-Localdevices: scaleio=vol-1235::/dev/scini1,vol-8973::/dev/scini2
```
Note that the EBS driver's local device map appears to be incorrect with
the `DEVICE_PATH` used as the `VOLUME_ID` key. Some drivers, such as EBS,
actually provide a device path at the time a volume is attached, meaning
that the remote storage platform can map a volume based on a provided
device path. Thus for the EBS platform the device path is the piece of
information used to map to a remote volume as well as the path to which
said volume is attached as a device on a given client.
This is in contrast to to the ScaleIO local devices map which uses
volume IDs unrelated to the device at which a volume is attached.
#### Transaction ID
The transaction ID is a UUID/GUID that is used to track an operation
from the time it originates on a client, through the server, and back
to the client again. The header name is `Libstorage-Txid`:
```
Libstorage-Txid: 959716fa-6a76-4e48-6243-1dd328c0f313
```
#### Transaction Created
The header `Libstorage-Txcr` is a UTC epoch timestamp that notes when
the original client-side operation was created:
```
Libstorage-Txcr: 1461644872
```
### Response Headers
libStorage supports the following response headers:
Name | Description
-----|------------
`Libstorage-Instanceid` | A client's instance ID.
`Libstorage-Servername` | The server's name.
Please note the header names are case sensitive and must comply with the above,
listed values. This is in adherence to the
[canonical header](https://golang.org/pkg/net/http/#CanonicalHeaderKey) format.
#### Instance ID (Response)
Please see [this section](#def-instance-id) for more information.
#### Server Name
The `Libstorage-Servername` header is returned with every response for
clients that use it for logging purposes.
# Group Root
# Root Resource [/]
The root resource.
## Get [GET]
Gets a list of the API's top-level resources.
+ Response 200 (application/json)
+ Body
[
"/executors",
"/services",
"/volumes",
"/snapshots"
]
# Group Services
# Services Collection [/services?{instance}]
## Get [GET]
Gets information about all of the configured services.
+ Parameters
+ instance: `false` (boolean, optional)
When the instance query string is specified the instance ID header
is required. This flag indicates that the services' instances should
be retrieved along with standard service information.
+ Response 200 (application/json)
+ Body
{
"ebs-00": {
"name": "ebs-00",
"driver": {
"name": "ebs",
"type": "block"
}
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceInfoMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
# Service Inspector [/services/{service}?{instance}]
+ Parameters
+ service: `ebs-00` (string, required)
+ instance: `false` (boolean, optional)
When the instance query string is specified the instance ID header
is required. This flag indicates that the service's instance should
be retrieved along with standard service information.
## Inspect [GET]
Gets information about the service with the specified name.
+ Response 200 (application/json)
+ Attributes (ServiceInfo)
+ Body
{
"name": "ebs-00",
"driver": {
"name": "ebs",
"type": "block"
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceInfo" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 404 (application/json)
The specified resource was not found
+ Body
{
"type": "resourceNotFound",
"httpStatus": 404,
"message": "The requested resource was not found"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/resourceNotFoundError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
# Group Executors
A collection of resources and actions related to libStorage's client-side
executors.
# Executors Collection [/executors]
## Get [GET]
Gets the executors collection.
+ Response 200 (application/json)
+ Body
{
"lsx-darwin": {
"name": "lsx-darwin",
"md5checksum": "6f491e62fe434adb15606bd0a2b6a938",
"size": 11572748
},
"lsx-linux": {
"name": "lsx-linux",
"md5checksum": "52c108e3ef6b936e10148fa7c3882be8",
"size": 11626296
},
"lsx-windows.exe": {
"name": "lsx-windows.exe",
"md5checksum": "2d5d2facad103b3cb53ebf1423e2ec3b",
"size": 11495424
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/executorInfoMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
## Download [GET /executors/{executor}]
Downloads an executor.
+ Parameters
+ executor: `lsx-windows.exe` (string, required)
+ Response 200
+ Headers
Accept-Ranges: bytes
Content-Length: 11495424
Content-Md5: LV0vrK0QOzy1Pr8UI+LsOw==
Content-Type: application/octet-stream
Last-Modified: Thu, 14 Apr 2016 20:54:17 CDT
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 404 (application/json)
The specified resource was not found
+ Body
{
"type": "resourceNotFound",
"httpStatus": 404,
"message": "The requested resource was not found"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/resourceNotFoundError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
## Inspect [HEAD /executors/{executor}]
Inspects an executor. This operation is functionally equivalent to downloading an executor, except the body is not returned, only the headers.
+ Parameters
+ executor: `lsx-windows.exe` (string, required)
+ Response 200
+ Headers
Accept-Ranges: bytes
Content-Length: 11495424
Content-Md5: LV0vrK0QOzy1Pr8UI+LsOw==
Content-Type: application/octet-stream
Last-Modified: Thu, 14 Apr 2016 20:54:17 CDT
+ Response 401
+ Response 404
+ Response 500
# Group Volumes
A collection of resources and actions related to libStorage Volumes.
# Volumes Collection [/volumes]
A collection of Volume objects for all configured services.
## Get [GET /volumes]
Gets a list of Volume resources for all configured services.
+ Response 200 (application/json)
+ Body
{
"ebs-00": {
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
},
"ebs-01": {
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceVolumeMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
## Get with Attachments [GET /volumes?{attachments}]
Gets a list of Volume resources and their attached resources for all configured
services.
+ Parameters
+ attachments (string,optional)
A value that indicates how and if volume attachments should be retrieved.
<br/><br/>
The `attachments` parameter can be any of the following values:
<br/>
Value | Description
------|------------
0 | No attachment information is requested. This is the default value and the same as omitting this parameter altogether.
1 | Attachment information is requested. This value indicates attachment information should be returned for all volumes.
2 | _My_ attachment information is requested. This value indicates attachment information should be returned for volumes attached to the instance specified in the [instance ID request header](#def-instance-id). If this bit is set then the instance ID header is required.
4 | Attempt to map devices provided via the [local devices](#def-local-devices) request header to the appropriate attachment information. If this bit is set then the instance ID and local device headers are required.
8 | Return only volumes that are attached.
16 | Return only volumes that are unattached.
<br/><br/>
The use of a bitmask for the `attachments` parameter means that
different combinations of the above values can be used to
indicate different results:
<br/>
Mask | Description
-----|------------
5 | A mask of `1|4` that indicates to return all volumes with their attachment data (if any) and perform a device mapping where possible.
9 | A mask of `1|8` that indicates to return only volumes that are attached to some instance.
10 | A mask of `2|8` that indicates to return only volumes attached to the instance provided via the instance ID header.
+ Request
+ Headers
Libstorage-Instanceid: ebs-00=i-123,region%3Dwest,ebs-01:eyJpZCI6ImlpZC0wMDEiLCJtZXRhZGF0YSI6eyJtYXgiOjIwLCJtaW4iOjUsInJhZCI6ImhvdCJ9fQ==
+ Response 200 (application/json)
+ Body
{
"ebs-00": {
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"attachments": [
{
"instanceID": {
"id": "iid-000"
},
"volumeID": "vol-000",
"deviceName": "/dev/xvd00"
}
],
"fields": {
"priority": 2,
"owner": "[email protected]"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"attachments": [
{
"instanceID": {
"id": "iid-001"
},
"volumeID": "vol-001",
"deviceName": "/dev/xvd01"
}
],
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
},
"ebs-01": {
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"attachments": [
{
"instanceID": {
"id": "iid-000"
},
"volumeID": "vol-000",
"deviceName": "/dev/xvd00"
}
],
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceVolumeMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
## Detach All [POST /volumes?{detach}]
Detaches all volumes for all services.
+ Parameters
+ detach (required)
A flag indicating that the detach operation should be issued for
all volumes across all configured services.
+ Request (application/json)
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/volumeDetachAllRequest" }
+ Response 200 (application/json)
A list of the detached volumes.
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceVolumeMap" }
+ Response 400 (application/json)
Invalid request
+ Body
{
"type": "invalidRequest",
"httpStatus": 400,
"message": "An invalid request was made"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/invalidRequestError" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
# Volumes by Service Collection [/volumes/{service}]
+ Parameters
+ service: `ebs-00` (string, required)
The service name
## Get [GET]
Gets a list of Volume objects for a single Service resource.
+ Response 200 (application/json)
+ Body
{
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/volumeMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
## Get with Attachments [GET /volumes/{service}?{attachments}]
Gets a list of Volume resources and their attached resources for a single
service.
+ Parameters
+ service: `ebs-00` (string, required)
The service name
+ attachments (string,optional)
A value that indicates how and if volume attachments should be retrieved.
<br/><br/>
The `attachments` parameter can be any of the following values:
<br/>
Value | Description
------|------------
0 | No attachment information is requested. This is the default value and the same as omitting this parameter altogether.
1 | Attachment information is requested. This value indicates attachment information should be returned for all volumes.
2 | _My_ attachment information is requested. This value indicates attachment information should be returned for volumes attached to the instance specified in the [instance ID request header](#def-instance-id). If this bit is set then the instance ID header is required.
4 | Attempt to map devices provided via the [local devices](#def-local-devices) request header to the appropriate attachment information. If this bit is set then the instance ID and local device headers are required.
8 | Return only volumes that are attached.
16 | Return only volumes that are unattached.
<br/><br/>
The use of a bitmask for the `attachments` parameter means that
different combinations of the above values can be used to
indicate different results:
<br/>
Mask | Description
-----|------------
5 | A mask of `1|4` that indicates to return all volumes with their attachment data (if any) and perform a device mapping where possible.
9 | A mask of `1|8` that indicates to return only volumes that are attached to some instance.
10 | A mask of `2|8` that indicates to return only volumes attached to the instance provided via the instance ID header.
+ Request
+ Headers
Libstorage-Instanceid: ebs-00=i-123,region%3Dwest
+ Response 200 (application/json)
+ Body
{
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"attachments": [
{
"instanceID": {
"id": "iid-000"
},
"volumeID": "vol-000",
"deviceName": "/dev/xvd00"
}
],
"fields": {
"priority": 2,
"owner": "[email protected]"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"attachments": [
{
"instanceID": {
"id": "iid-001"
},
"volumeID": "vol-001",
"deviceName": "/dev/xvd01"
}
],
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/serviceVolumeMap" }
+ Response 401 (application/json)
Unauthorized request
+ Body
{
"type": "unauthorizedRequest",
"httpStatus": 401,
"message": "The requestor is unauthorized to access this resource"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/unauthorizedRequestError" }
+ Response 500 (application/json)
Internal server error
+ Body
{
"type": "internalServerError",
"httpStatus": 500,
"message": "An internal server error occurred"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/internalServerError" }
## Create [POST]
Create a new volume.
+ Request (application/json)
+ Attributes
+ name (string, required) - The volume name
+ availabilityZone (string, optional) - The zone for which the volume is available
+ encrypted (boolean, optional) - A flag that indicates whether or not to request volume encryption.
+ encryptionKey (string, optional) - The encryption key to use when encrypting the volume.
+ iops (number, optional) - The volume IOPs
+ size (number, optional) - The volume size (GB)
+ type (string, optional) - The volume type
+ opts (object) - Optional request data
+ Body
{
"name": "Volume-001",
"size": 10240,
"opts": {
"priority": 2,
"owner": "[email protected]"
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/volumeCreateRequest" }
+ Response 200 (application/json)
The newly created volume object.
+ Attributes (Volume)
+ Headers
Location: /volumes/ebs-00/vol-001
+ Body
{
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"fields": {
"priority": 2,
"owner": "[email protected]"
}
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/volume" }
+ Response 400 (application/json)
Invalid request
+ Body
{
"type": "invalidRequest",
"httpStatus": 400,
"message": "An invalid request was made"
}
+ Schema
{ "$ref": "https://raw.githubusercontent.com/codedellemc/libstorage/master/libstorage.json#/definitions/invalidRequestError" }
+ Response 401 (application/json)
Unauthorized request