module Ropenstack::Image::Version1
-
Name: ImageVersion1
-
Description: Implementation of the Glance V1.0 API Client in Ruby
-
Author: Sam ‘Tehsmash’ Betts, John Davidge
-
Date: 30/06/2014
Public Instance Methods
Adds a member to an image. @param member_id The member to be added @param can_share Optional boolean specifiying can_share value. Will default to false.
# File lib/ropenstack/image/v1.rb, line 69 def add_member(id, member_id, can_share, tenant_id) if can_share.nil? data = { :member => {:can_share => false} } else data = { :member => {:can_share => can_share} } end put_request(address(tenant_id, "images/" + id + "/members/" + member_id), data, @token) end
Returns the v1 address location of an endpoint.
# File lib/ropenstack/image/v1.rb, line 99 def address(tenant_id, endpoint) address("/v1/#{tenant_id}/#{endpoint}") end
Removes a member from an image
# File lib/ropenstack/image/v1.rb, line 85 def delete_member(id, member_id, tenant_id) delete_request(address(tenant_id, "images/" + id + "/members/" + member_id), @token) end
Registers a virtual machine image.
# File lib/ropenstack/image/v1.rb, line 25 def image_create(name, disk_format, container_format, create_image, tenant_id) data = { :name => name, :disk_format => disk_format, :container_format => container_format } unless create_image.nil? data[:create_image] = create_image end post_request(address(tenant_id, "images"), data, @token) end
Deletes the specified image.
# File lib/ropenstack/image/v1.rb, line 49 def image_delete(id, tenant_id) delete_request(address(tenant_id, "images/" + id), @token) end
Updates an image, uploads an image file, or updates metadata for an image. NOT IMPLEMENTED
# File lib/ropenstack/image/v1.rb, line 42 def image_update(id, tenant_id) raise Ropenstack::RopenstackError, "Update Method Not Implemented." end
No ID provided - Lists details for available images. ID provided - Shows the image details as headers and the image binary in the body.
# File lib/ropenstack/image/v1.rb, line 14 def images(id, tenant_id) if id.nil? return get_request(address(tenant_id, "images/detail"), @token) else return get_request(address(tenant_id, "images/" + id), @token) end end
Replaces the membership list for an image. @param memberships List of memberships in format [{‘member_id’: ‘tenant1’, ‘can_share’: ‘false’}]
# File lib/ropenstack/image/v1.rb, line 57 def replace_memberships(id, memberships, tenant_id) data = { :memberships => memberships } put_request(address(tenant_id, "images/" + id + "/members"), data, @token) end
# File lib/ropenstack/image/v1.rb, line 103 def version "V1" end