glance.api.v1.images
Moduleglance.api.v1.images
Module¶/images endpoint for Glance v1 API
glance.api.v1.images.
Controller
[source]¶Bases: glance.api.v1.controller.BaseController
WSGI controller for images resource in Glance v1 API
The images resource API is a RESTful web service for image data. The API is as follows:
GET /images -- Returns a set of brief metadata about images
GET /images/detail -- Returns a set of detailed metadata about
images
HEAD /images/<ID> -- Return metadata about an image with id <ID>
GET /images/<ID> -- Return image data for image with id <ID>
POST /images -- Store image data and return metadata about the
newly-stored image
PUT /images/<ID> -- Update image metadata and/or upload image
data for a previously-reserved image
DELETE /images/<ID> -- Delete the image with id <ID>
create
(req, *args, **kwargs)[source]¶Adds a new image to Glance. Four scenarios exist when creating an image:
The request body must be encoded as application/octet-stream, otherwise an HTTPBadRequest is returned.
Upon a successful save of the image data and metadata, a response containing metadata about the image is returned, including its opaque identifier.
Parameters: |
|
---|---|
Raises: | HTTPBadRequest – if x-image-meta-location is missing and the request body is not application/octet-stream image data. |
delete
(req, *args, **kwargs)[source]¶Deletes the image and all its chunks from the Glance
Parameters: |
|
---|---|
Raises: |
|
detail
(req)[source]¶Returns detailed information for all available images
Parameters: | req – The WSGI/Webob Request object |
---|---|
Returns: | The response body is a mapping of the following form |
{'images':
[{
'id': <ID>,
'name': <NAME>,
'size': <SIZE>,
'disk_format': <DISK_FORMAT>,
'container_format': <CONTAINER_FORMAT>,
'checksum': <CHECKSUM>,
'min_disk': <MIN_DISK>,
'min_ram': <MIN_RAM>,
'store': <STORE>,
'status': <STATUS>,
'created_at': <TIMESTAMP>,
'updated_at': <TIMESTAMP>,
'deleted_at': <TIMESTAMP>|<NONE>,
'properties': {'distro': 'Ubuntu 10.04 LTS', {...}}
}, {...}]
}
get_store_or_400
(request, scheme)[source]¶Grabs the storage backend for the supplied store name or raises an HTTPBadRequest (400) response
Parameters: |
|
---|---|
Raises: | HTTPBadRequest – if store does not exist |
index
(req)[source]¶Returns the following information for all public, available images:
- id – The opaque image identifier
- name – The name of the image
- disk_format – The disk image format
- container_format – The “container” format of the image
- checksum – MD5 checksum of the image data
- size – Size of image data in bytes
Parameters: | req – The WSGI/Webob Request object |
---|---|
Returns: | The response body is a mapping of the following form |
{'images': [
{'id': <ID>,
'name': <NAME>,
'disk_format': <DISK_FORMAT>,
'container_format': <DISK_FORMAT>,
'checksum': <CHECKSUM>,
'size': <SIZE>}, {...}]
}
meta
(req, id)[source]¶Returns metadata about an image in the HTTP headers of the response object
Parameters: |
|
---|---|
Returns: | similar to ‘show’ method but without image_data |
Raises: | HTTPNotFound – if image metadata is not available to user |
glance.api.v1.images.
ImageDeserializer
[source]¶Bases: glance.common.wsgi.JSONRequestDeserializer
Handles deserialization of specific controller method requests.
glance.api.v1.images.
ImageSerializer
[source]¶Bases: glance.common.wsgi.JSONResponseSerializer
Handles serialization of specific controller method responses.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.