AttachVolumeToServer

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 86)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=='''POST''' /servers/'''id'''/os-volume_attachments==
 
 
This operation will attach an already existing volume to the specified [[Server]].
 
This operation will attach an already existing volume to the specified [[Server]].
  
=== Parameters ===
+
='''POST''' /accounts/''{accountId}''/flexcloud/servers/''{id}''/os-volume_attachments=
 +
 
 +
== Parameters ==
 +
; accountId - ''string''
 +
: The selected account Id.
 +
 
 
; id
 
; id
 
: The unique identifier of the server.
 
: The unique identifier of the server.
  
=== Request===
+
== Request==
==== JSON ====
+
=== JSON ===
 +
<nowiki>
 
  {
 
  {
 
     "volumeAttachment" : {
 
     "volumeAttachment" : {
Line 13: Line 18:
 
       "device": "{device_path}"
 
       "device": "{device_path}"
 
     }
 
     }
  }
+
  }</nowiki>
  
 
; volumeId- ''string''
 
; volumeId- ''string''
Line 21: Line 26:
 
: The device path specified.
 
: The device path specified.
  
=== Response Codes ===
+
== Response Codes ==
 
; Success:  
 
; Success:  
 
:''HTTP/1.1 200 OK''
 
:''HTTP/1.1 200 OK''
Line 29: Line 34:
 
: ''HTTP/1.1 409 Conflict''
 
: ''HTTP/1.1 409 Conflict''
  
=== Examples ===
+
== Examples ==
 
'''Successfully attach a volume to specified server'''
 
'''Successfully attach a volume to specified server'''
:'''POST''' http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments
  
 
''Request Headers:''
 
''Request Headers:''
Line 39: Line 44:
  
 
''Request Body:''
 
''Request Body:''
  {
+
  <nowiki>
 +
{
 
     "volumeAttachment" : {
 
     "volumeAttachment" : {
 
       "volumeId" : "hbs2012May08_61EfdIZ3Y",
 
       "volumeId" : "hbs2012May08_61EfdIZ3Y",
 
       "device": "/dev/test"
 
       "device": "/dev/test"
 
     }
 
     }
  }
+
  }</nowiki>
  
 
''Response Code:''
 
''Response Code:''
Line 50: Line 56:
  
 
'''Failure while trying to attach a volume that is already attached to the server'''
 
'''Failure while trying to attach a volume that is already attached to the server'''
:'''POST''' http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments
  
 
''Request Headers:''
 
''Request Headers:''
Line 58: Line 64:
  
 
''Request Body:''
 
''Request Body:''
 +
<nowiki>
 
  {
 
  {
 
     "volumeAttachment" : {
 
     "volumeAttachment" : {
       "volumeId" : "<span style="color:red">hbs2012May08_61EfdIZ3Y</span>",
+
       "volumeId" : </nowiki>"<span style="color:red">hbs2012May08_61EfdIZ3Y</span>"<nowiki>,
 
       "device": "/dev/test"
 
       "device": "/dev/test"
 
     }
 
     }
  }
+
  }</nowiki>
  
 
''Response Code:''
 
''Response Code:''
Line 74: Line 81:
 
       "message": "VolumeAlreadyAttached",  
 
       "message": "VolumeAlreadyAttached",  
 
       "code": 409,  
 
       "code": 409,  
       "details": "hbs is already attached"
+
       "details": "hbs is already attached",
 +
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 
   }
 
   }
 
  }</nowiki>
 
  }</nowiki>
  
 
'''Failure while trying to attach a volume that does not exist'''
 
'''Failure while trying to attach a volume that does not exist'''
:'''POST''' http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments
  
 
''Request Headers:''
 
''Request Headers:''
Line 87: Line 95:
  
 
''Request Body:''
 
''Request Body:''
 +
<nowiki>
 
  {
 
  {
 
     "volumeAttachment" : {
 
     "volumeAttachment" : {
       "volumeId" : "<span style="color:red">fake_volume_id</span>",
+
       "volumeId" : </nowiki>"<span style="color:red">fake_volume_id</span>"<nowiki>,
 
       "device": "/dev/test"
 
       "device": "/dev/test"
 
     }
 
     }
  }
+
  }</nowiki>
  
 
''Response Code:''
 
''Response Code:''
Line 103: Line 112:
 
       "message": "VolumeNotFound",  
 
       "message": "VolumeNotFound",  
 
       "code": 404,  
 
       "code": 404,  
       "details": "hostway block store not found"}
+
       "details": "hostway block store not found",
 +
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"}
 
     }
 
     }
 
  }</nowiki>
 
  }</nowiki>
  
 
'''Unauthorized access'''
 
'''Unauthorized access'''
:'''POST''' http(s)://{api_server}/servers/test_server_0013/os-volume_attachments
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments
  
 
''Request Headers:''
 
''Request Headers:''
Line 125: Line 135:
 
     does not understand how to supply the credentials required.
 
     does not understand how to supply the credentials required.
  
 +
'''Failure while trying to pass invalid account number'''
 +
:'''POST''' http(s)://{api_server}/accounts/fake/flexcloud/servers/{id}/os-volume_attachments
  
[[Category:Hostway API]]
+
''Response Code:''
[[Category:FlexCloud Server API]]
+
<pre>HTTP/1.1 404 Not Found</pre>
  
<!-- THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
+
''Response Body:''
 +
<nowiki>
 +
  {
 +
    "itemNotFound" : {
 +
      "message": "Resource not found",
 +
      "code": 404,
 +
      "details": "",
 +
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
    }
 +
}</nowiki>
  
{{#widget:DISQUS
+
== Alternative URI /servers/{id}/os-volume_attachments ==
|id=hostway
+
An alternative way to execute this call is to omit the ''accountId'' portion of the URI. In this case the system assumes the request is executed for the account identified in the [[Authentication|authorization header]].
|uniqid={{PAGENAME}}
+
|url={{fullurl:{{PAGENAME}}}}
+
}}
+
  
<!--  ########################################################################### -->
+
<code>POST /servers/{id}/os-volume_attachments</code>
 +
 
 +
[[Category:Hostway API]]
 +
[[Category:FlexCloud Server API]]

Latest revision as of 11:00, 11 October 2013

This operation will attach an already existing volume to the specified Server.

Contents

[edit] POST /accounts/{accountId}/flexcloud/servers/{id}/os-volume_attachments

[edit] Parameters

accountId - string
The selected account Id.
id
The unique identifier of the server.

[edit] Request

[edit] JSON

 {
    "volumeAttachment" : {
       "volumeId" : "{volume_id}",
       "device": "{device_path}"
    }
 }
volumeId- string
The unique identifier of the volume.
device- string
The device path specified.

[edit] Response Codes

Success
HTTP/1.1 200 OK
Failure
HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 404 Not Found
HTTP/1.1 409 Conflict

[edit] Examples

Successfully attach a volume to specified server

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

 
{
    "volumeAttachment" : {
       "volumeId" : "hbs2012May08_61EfdIZ3Y",
       "device": "/dev/test"
    }
 }

Response Code:

HTTP/1.1 200 OK

Failure while trying to attach a volume that is already attached to the server

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

 {
    "volumeAttachment" : {
       "volumeId" : "hbs2012May08_61EfdIZ3Y",
       "device": "/dev/test"
    }
 }

Response Code:

HTTP/1.1 409 Conflict

Response Body:

 {
   "conflict": {
      "message": "VolumeAlreadyAttached", 
      "code": 409, 
      "details": "hbs is already attached",
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
   }
 }

Failure while trying to attach a volume that does not exist

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

 {
    "volumeAttachment" : {
       "volumeId" : "fake_volume_id",
       "device": "/dev/test"
    }
 }

Response Code:

HTTP/1.1 404 Not Found

Response Body:

 {
    "notFound": {
       "message": "VolumeNotFound", 
       "code": 404, 
       "details": "hostway block store not found",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"}
    }
 }

Unauthorized access

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-volume_attachments

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded fake_authentication_string

Response Code:

HTTP/1.1 401 Unauthorized

Response Body:

    401 Unauthorized
    This server could not verify that you are authorized to
    access the document you requested.  Either you supplied the
    wrong credentials (e.g., bad password), or your browser
    does not understand how to supply the credentials required.

Failure while trying to pass invalid account number

POST http(s)://{api_server}/accounts/fake/flexcloud/servers/{id}/os-volume_attachments

Response Code:

HTTP/1.1 404 Not Found

Response Body:

 {
    "itemNotFound" : {
       "message": "Resource not found", 
       "code": 404, 
       "details": "",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
    }
 }

[edit] Alternative URI /servers/{id}/os-volume_attachments

An alternative way to execute this call is to omit the accountId portion of the URI. In this case the system assumes the request is executed for the account identified in the authorization header.

POST /servers/{id}/os-volume_attachments

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox