forked from thecodeteam/libstorage
-
Notifications
You must be signed in to change notification settings - Fork 1
/
libstorage.apib
2453 lines (1730 loc) · 72.5 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[:SERVICE]=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[:SERVICE]` | The name of the driver for which the instance ID is intended. An optional suffix of `:SERVICE` may also be present where `SERVICE` is the name of the service for which the instance ID is valid. This format takes precedence over another instance ID specified only by `DRIVER` type.
`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: ebs:ebs-00=i-5678,region=west
Libstorage-Instanceid: efs=i-1234,region%3Deast%2Czone%3D2
```
The first instance ID header is valid for all services
that use the `ebs` driver. However, because the second
instance ID specifies the service name `ebs-00`, the
second instance ID is used for that service in place
of the first, even though the first is valid for the
`ebs` driver type.
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.
## Security
The libStorage API is primarily hosted via HTTP-REST and therefore
an HTTP proxy such as [NGINX](https://www.nginx.com) can be leveraged
to provide security features such as authentication and authorization.
In the absence of an HTTP proxy, software that implements the
libStorage API should also support
[JSON Web Tokens (JWT)](https://jwt.io/) to restrict access to
API resources.
The payload of the libStorage API's JWT follows the below format:
```
{
"exp": 1493592581,
"iat": 1491000581,
"nbf": 1491000581,
"sub": "akutz",
}
```
The above payload's claims (fields) are:
Name | Description
-----|------------
`exp` | The time at which the token expires. A value of `0` means the token does not expire.
`iat` | The time at which the token was issued.
`nbf` | The time at which the token becomes valid.
`sub` | The principal for whom the token is intended.
All of the above time values are specified as UTC epochs in seconds.
A client transmits the JWT as a
[_Bearer_](https://tools.ietf.org/html/rfc6750#section-2.1)
token in the HTTP `Authorization` header. For example:
```
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MjI2ODg1NTAsImlhdCI6MTQ5MTIzODk1MCwibmJmIjoxNDkxMjM4OTUwLCJzdWIiOiJha3V0eiJ9.3eAA7AQZUGrwA42H64qKbu8QF_AHpSsJSMR0FALnKj8
```
If the provided token is invalid then the libStorage server should return an
HTTP status of 401, _Unauthorized_.
Implementations of the libStorage API should support restricting access via
JWTs both globally and per configured service.
If a `GET /volumes` request is issued and the provided token lacks access to
one of the services, a 401 `Unauthorized` status will be returned instead of a
partial dataset.
# 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": "sakutz@gmail.com"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"fields": {
"priority": 2,
"owner": "sakutz@gmail.com"
}
}
},
"ebs-01": {
"vol-000": {
"id": "vol-000",
"name": "Volume-000",
"size": 10240,
"fields": {
"priority": 2,
"owner": "sakutz@gmail.com"
}
}
}
}
+ 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": "sakutz@gmail.com"
}
},
"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": "sakutz@gmail.com"
}
}
},
"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": "sakutz@gmail.com"
}
}
}
}
+ 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": "sakutz@gmail.com"
}
},
"vol-001": {
"id": "vol-001",
"name": "Volume-001",
"size": 10240,
"fields": {
"priority": 2,
"owner": "sakutz@gmail.com"
}
}
}
+ 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": "sakutz@gmail.com"
}
},
"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": "sakutz@gmail.com"
}
}
}
+ 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