summaryrefslogtreecommitdiff
path: root/glanceclient/v2
diff options
context:
space:
mode:
authoreddie-sheffield <eddie.sheffield@rackspace.com>2013-07-31 12:21:41 -0400
committereddie-sheffield <eddie.sheffield@rackspace.com>2013-07-31 12:28:24 -0400
commite827c37a05687d4fdd9b81a4b241e199a790ef1a (patch)
tree85a465955af202acfc3c51c4ae93f70cc97607ee /glanceclient/v2
parent937b65b513ae53193c0c731a6d8e89ec310f1882 (diff)
downloadpython-glanceclient-e827c37a05687d4fdd9b81a4b241e199a790ef1a.tar.gz
Changes to allow image upload with V2 api
Related to bp glance-client-v2 Change-Id: I72a1d2825dd5c1ff4890e8be477cb4447d59f136
Diffstat (limited to 'glanceclient/v2')
-rw-r--r--glanceclient/v2/images.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index b3c5ff5..fe24b0a 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -88,6 +88,19 @@ class Controller(object):
else:
return body
+ def upload(self, image_id, image_data):
+ """
+ Upload the data for an image.
+
+ :param image_id: ID of the image to upload data for.
+ :param image_data: File-like object supplying the data to upload.
+ """
+ url = '/v2/images/%s/file' % image_id
+ hdrs = {'Content-Type': 'application/octet-stream'}
+ self.http_client.raw_request('PUT', url,
+ headers=hdrs,
+ body=image_data)
+
def delete(self, image_id):
"""Delete an image."""
self.http_client.json_request('DELETE', 'v2/images/%s' % image_id)