pyrax
Python Bindings for the Rackspace Cloud
|
Manager class for an Image. More...
Public Member Functions | |
def | list |
Returns a list of resource objects. | |
def | list_all |
Returns all of the images in one call, rather than in paginated batches. | |
def | create |
Creates a new image with the specified name. | |
def | update |
Accepts an image reference (object or ID) and dictionary of key/value pairs, where the key is an attribute of the image, and the value is the desired new value for that image. | |
def | update_image_member |
Updates the image whose ID is given with the status specified. |
Manager class for an Image.
def create | ( | self, | |
name, | |||
img_format = None , |
|||
img_container_format = None , |
|||
data = None , |
|||
container = None , |
|||
obj = None , |
|||
metadata = None |
|||
) |
Creates a new image with the specified name.
The image data can either be supplied directly in the 'data' parameter, or it can be an image stored in the object storage service. In the case of the latter, you can either supply the container and object names, or simply a StorageObject reference.
You may specify the image and image container formats; if unspecified, the default of "vhd" for image format and "bare" for image container format will be used.
NOTE: This is blocking, and may take a while to complete.
def list | ( | self, | |
limit = None , |
|||
marker = None , |
|||
name = None , |
|||
visibility = None , |
|||
member_status = None , |
|||
owner = None , |
|||
tag = None , |
|||
status = None , |
|||
size_min = None , |
|||
size_max = None , |
|||
sort_key = None , |
|||
sort_dir = None , |
|||
return_raw = False |
|||
) |
Returns a list of resource objects.
Pagination is supported through the optional 'marker' and 'limit' parameters. Filtering the returned value is possible by specifying values for any of the other parameters.
def list_all | ( | self, | |
name = None , |
|||
visibility = None , |
|||
member_status = None , |
|||
owner = None , |
|||
tag = None , |
|||
status = None , |
|||
size_min = None , |
|||
size_max = None , |
|||
sort_key = None , |
|||
sort_dir = None |
|||
) |
Returns all of the images in one call, rather than in paginated batches.
The 'next' uri contains a redundant version number. We need to strip it to use in the method_get() call.
def update | ( | self, | |
img, | |||
value_dict | |||
) |
Accepts an image reference (object or ID) and dictionary of key/value pairs, where the key is an attribute of the image, and the value is the desired new value for that image.
NOTE: There is a bug in Glance where the 'add' operation returns a 409 if the property already exists, which conflicts with the spec. So to get around this a fresh copy of the image must be retrieved, and the value of 'op' must be determined based on whether this attribute exists or not.
def update_image_member | ( | self, | |
img_id, | |||
status | |||
) |
Updates the image whose ID is given with the status specified.
This must be called by the user whose project_id is in the members for the image. If called by the owner of the image, an InvalidImageMember exception will be raised.
Valid values for 'status' include: pending accepted rejected Any other value will result in an InvalidImageMemberStatus exception being raised.