Class: Fog::Compute::RackspaceV2::Real
- Inherits:
-
Rackspace::Service
- Object
- Rackspace::Service
- Fog::Compute::RackspaceV2::Real
- Defined in:
- lib/fog/rackspace/compute_v2.rb,
lib/fog/rackspace/requests/compute_v2/get_image.rb,
lib/fog/rackspace/requests/compute_v2/get_flavor.rb,
lib/fog/rackspace/requests/compute_v2/get_server.rb,
lib/fog/rackspace/requests/compute_v2/get_keypair.rb,
lib/fog/rackspace/requests/compute_v2/get_network.rb,
lib/fog/rackspace/requests/compute_v2/list_images.rb,
lib/fog/rackspace/requests/compute_v2/create_image.rb,
lib/fog/rackspace/requests/compute_v2/delete_image.rb,
lib/fog/rackspace/requests/compute_v2/list_flavors.rb,
lib/fog/rackspace/requests/compute_v2/list_servers.rb,
lib/fog/rackspace/requests/compute_v2/set_metadata.rb,
lib/fog/rackspace/requests/compute_v2/attach_volume.rb,
lib/fog/rackspace/requests/compute_v2/create_server.rb,
lib/fog/rackspace/requests/compute_v2/delete_server.rb,
lib/fog/rackspace/requests/compute_v2/list_keypairs.rb,
lib/fog/rackspace/requests/compute_v2/list_metadata.rb,
lib/fog/rackspace/requests/compute_v2/list_networks.rb,
lib/fog/rackspace/requests/compute_v2/reboot_server.rb,
lib/fog/rackspace/requests/compute_v2/rescue_server.rb,
lib/fog/rackspace/requests/compute_v2/resize_server.rb,
lib/fog/rackspace/requests/compute_v2/update_server.rb,
lib/fog/rackspace/requests/compute_v2/create_keypair.rb,
lib/fog/rackspace/requests/compute_v2/create_network.rb,
lib/fog/rackspace/requests/compute_v2/delete_keypair.rb,
lib/fog/rackspace/requests/compute_v2/delete_network.rb,
lib/fog/rackspace/requests/compute_v2/get_attachment.rb,
lib/fog/rackspace/requests/compute_v2/list_addresses.rb,
lib/fog/rackspace/requests/compute_v2/rebuild_server.rb,
lib/fog/rackspace/requests/compute_v2/unrescue_server.rb,
lib/fog/rackspace/requests/compute_v2/update_metadata.rb,
lib/fog/rackspace/requests/compute_v2/list_attachments.rb,
lib/fog/rackspace/requests/compute_v2/delete_attachment.rb,
lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb,
lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb,
lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb,
lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb,
lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb,
lib/fog/rackspace/requests/compute_v2/change_server_password.rb,
lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb
Instance Method Summary collapse
-
#attach_volume(server_id, volume_id, device) ⇒ Excon::Response
This operation attaches a volume to the specified server.
- #authenticate(options = {}) ⇒ Object
-
#change_server_password(server_id, password) ⇒ Excon::Response
Changes server admin password.
-
#confirm_resize_server(server_id) ⇒ Excon::Response
Confirm server resize operation * Status Transition: * VERIFY_RESIZE -> ACTIVE * VERIFY_RESIZE -> ERROR (on error).
-
#create_image(server_id, name, options = {}) ⇒ Excon::Response
Create an image from a running server.
-
#create_keypair(key_name, public_key = nil) ⇒ Excon::Response
Request a new keypair to be created.
- #create_network(label, cidr) ⇒ Object
-
#create_server(name, image_id, flavor_id, min_count, max_count, options = {}) ⇒ Excon::Response
Create server * State Transitions * BUILD -> ACTIVE * BUILD -> ERROR (on error).
-
#delete_attachment(server_id, volume_id) ⇒ Excon::Response
Deletes a specified volume attachment from a specified server instance.
-
#delete_image(image_id) ⇒ Excon::Response
Delete an image.
-
#delete_keypair(key_name) ⇒ Excon::Response
Delete the key specified with key_name.
-
#delete_metadata_item(collection, obj_id, key) ⇒ Excon::Response
Deletes a metadata item.
- #delete_network(id) ⇒ Object
-
#delete_server(server_id) ⇒ Excon::Response
Deletes a specified server instance from the system.
- #endpoint_uri(service_endpoint_url = nil) ⇒ Object
-
#get_attachment(server_id, volume_id) ⇒ Excon::Response
Retrieves attachment.
-
#get_flavor(flavor_id) ⇒ Excon::Response
Retrieves flavor detail.
-
#get_image(image_id) ⇒ Excon::Response
Retrieves image detail.
-
#get_keypair(key_name) ⇒ Excon::Response
Retreive single keypair details.
-
#get_metadata_item(collection, obj_id, key) ⇒ Excon::Response
Retrieves single metadatum item by key.
- #get_network(id) ⇒ Object
-
#get_server(server_id) ⇒ Excon::Response
Retrieves server detail.
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#list_addresses(server_id) ⇒ Excon::Response
Lists all networks and addresses associated with a specified server.
-
#list_addresses_by_network(server_id, network_id) ⇒ Excon::Response
Lists all addresses associated with a specified server and network.
-
#list_attachments(server_id) ⇒ Excon::Response
Retrieves list of attached volumes.
-
#list_flavors ⇒ Excon::Response
Retrieves a list of flavors.
-
#list_images ⇒ Excon::Response
Retrieves a list of images.
-
#list_keypairs ⇒ Excon::Response
Returns a list of all key pairs associated with an account.
-
#list_metadata(collection, obj_id) ⇒ Excon::Response
Retrieves all metadata associated with a server or an image.
- #list_networks ⇒ Object
-
#list_servers ⇒ Excon::Response
Retrieves list of servers.
-
#reboot_server(server_id, type) ⇒ Object
Reboots server.
-
#rebuild_server(server_id, image_id, options = {}) ⇒ Excon::Response
The rebuild operation removes all data on the server and replaces it with the specified image.
- #region ⇒ Object
- #request(params, parse_json = true, &block) ⇒ Object
- #request_id_header ⇒ Object
-
#rescue_server(server_id) ⇒ Excon::Response
Puts server into rescue mode * Status Transition: * PREP_RESCUE -> RESCUE * PREP_RESCUE -> ACTIVE (on error).
-
#resize_server(server_id, flavor_id) ⇒ Excon::Response
Reverts server resize operation * Status Transition: * VERIFY_RESIZE -> ACTIVE * VERIFY_RESIZE -> ERROR (on error).
-
#revert_resize_server(server_id) ⇒ Excon::Response
Reverts server resize operation * Status Transition: * VERIFY_RESIZE -> ACTIVE * VERIFY_RESIZE -> ERROR (on error).
- #service_name ⇒ Object
-
#set_metadata(collection, obj_id, metadata = {}) ⇒ Excon::Response
Sets metadata associated with a server or an image.
-
#set_metadata_item(collection, obj_id, key, value) ⇒ Excon::Response
Sets a single metadatum item by key.
-
#unrescue_server(server_id) ⇒ Excon::Response
Take server out of rescue mode * Status Transition: * RESCUE -> PREP_UNRESCUE -> ACTIVE * RESCUE -> ERROR (on error).
-
#update_metadata(collection, obj_id, metadata = {}) ⇒ Excon::Response
Updates metadata items for a specified server or image.
-
#update_server(server_id, options = {}) ⇒ Object
Update the editable attributes of a specified server.
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/fog/rackspace/compute_v2.rb', line 133 def initialize( = {}) @rackspace_api_key = [:rackspace_api_key] @rackspace_username = [:rackspace_username] @rackspace_auth_url = [:rackspace_auth_url] setup_custom_endpoint() @rackspace_must_reauthenticate = false @connection_options = [:connection_options] || {} authenticate deprecation_warnings() @persistent = [:persistent] || false @connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options) end |
Instance Method Details
#attach_volume(server_id, volume_id, device) ⇒ Excon::Response
This operation attaches a volume to the specified server.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/rackspace/requests/compute_v2/attach_volume.rb', line 22 def attach_volume(server_id, volume_id, device) data = { 'volumeAttachment' => { 'volumeId' => volume_id } } data['volumeAttachment']['device'] = device if device request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "servers/#{server_id}/os-volume_attachments" ) end |
#authenticate(options = {}) ⇒ Object
161 162 163 164 165 166 167 168 |
# File 'lib/fog/rackspace/compute_v2.rb', line 161 def authenticate(={}) super({ :rackspace_api_key => @rackspace_api_key, :rackspace_username => @rackspace_username, :rackspace_auth_url => @rackspace_auth_url, :connection_options => @connection_options }) end |
#change_server_password(server_id, password) ⇒ Excon::Response
Though Rackspace does not enforce complexity requirements for the password, the operating system might. If the password is not complex enough, the server might enter an ERROR state.
Changes server admin password
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/rackspace/requests/compute_v2/change_server_password.rb', line 16 def change_server_password(server_id, password) data = { 'changePassword' => { 'adminPass' => password } } request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#confirm_resize_server(server_id) ⇒ Excon::Response
All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
Confirm server resize operation
-
Status Transition:
-
VERIFY_RESIZE -> ACTIVE
-
VERIFY_RESIZE -> ERROR (on error)
-
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/rackspace/requests/compute_v2/confirm_resize_server.rb', line 19 def confirm_resize_server(server_id) data = { 'confirmResize' => nil } request( :body => Fog::JSON.encode(data), :expects => [204], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#create_image(server_id, name, options = {}) ⇒ Excon::Response
Create an image from a running server
-
State Transition:
-
SAVING -> ACTIVE
-
SAVING -> ERROR (on error)
-
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/rackspace/requests/compute_v2/create_image.rb', line 22 def create_image(server_id, name, = {}) data = { 'createImage' => { 'name' => name } } data['createImage'].merge!() request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#create_keypair(key_name, public_key = nil) ⇒ Excon::Response
Request a new keypair to be created
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fog/rackspace/requests/compute_v2/create_keypair.rb', line 21 def create_keypair(key_name, public_key=nil) data = { 'keypair' => { 'name' => key_name } } request( :method => 'POST', :expects => 200, :path => '/os-keypairs', :body => Fog::JSON.encode(data) ) end |
#create_network(label, cidr) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/rackspace/requests/compute_v2/create_network.rb', line 5 def create_network(label, cidr) data = { 'network' => { 'label' => label, 'cidr' => cidr } } request( :method => 'POST', :body => Fog::JSON.encode(data), :path => "os-networksv2", :expects => 200 ) end |
#create_server(name, image_id, flavor_id, min_count, max_count, options = {}) ⇒ Excon::Response
Create server
-
State Transitions
-
BUILD -> ACTIVE
-
BUILD -> ERROR (on error)
-
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fog/rackspace/requests/compute_v2/create_server.rb', line 44 def create_server(name, image_id, flavor_id, min_count, max_count, = {}) data = { 'server' => { 'name' => name, 'imageRef' => image_id, 'flavorRef' => flavor_id, 'minCount' => min_count, 'maxCount' => max_count } } data['server']['OS-DCF:diskConfig'] = [:disk_config] unless [:disk_config].nil? data['server']['metadata'] = [:metadata] unless [:metadata].nil? data['server']['personality'] = [:personality] unless [:personality].nil? data['server']['networks'] = [:networks] || [ { :uuid => '00000000-0000-0000-0000-000000000000' }, { :uuid => '11111111-1111-1111-1111-111111111111' } ] data['server']['key_name'] = [:keypair] unless [:keypair].nil? request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers" ) end |
#delete_attachment(server_id, volume_id) ⇒ Excon::Response
Deletes a specified volume attachment from a specified server instance.
15 16 17 18 19 20 21 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_attachment.rb', line 15 def (server_id, volume_id) request( :expects => [202], :method => 'DELETE', :path => "servers/#{server_id}/os-volume_attachments/#{volume_id}" ) end |
#delete_image(image_id) ⇒ Excon::Response
Delete an image
14 15 16 17 18 19 20 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_image.rb', line 14 def delete_image(image_id) request( :expects => 204, :method => 'DELETE', :path => "images/#{image_id}" ) end |
#delete_keypair(key_name) ⇒ Excon::Response
Delete the key specified with key_name
14 15 16 17 18 19 20 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_keypair.rb', line 14 def delete_keypair(key_name) request( :method => 'DELETE', :expects => 202, :path => "/os-keypairs/#{key_name}" ) end |
#delete_metadata_item(collection, obj_id, key) ⇒ Excon::Response
Deletes a metadata item.
16 17 18 19 20 21 22 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_metadata_item.rb', line 16 def (collection, obj_id, key) request( :expects => 204, :method => 'DELETE', :path => "/#{collection}/#{obj_id}/metadata/#{key}" ) end |
#delete_network(id) ⇒ Object
5 6 7 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_network.rb', line 5 def delete_network(id) request(:method => 'DELETE', :path => "os-networksv2/#{id}", :expects => 202) end |
#delete_server(server_id) ⇒ Excon::Response
Deletes a specified server instance from the system.
14 15 16 17 18 19 20 |
# File 'lib/fog/rackspace/requests/compute_v2/delete_server.rb', line 14 def delete_server(server_id) request( :expects => [204], :method => 'DELETE', :path => "servers/#{server_id}" ) end |
#endpoint_uri(service_endpoint_url = nil) ⇒ Object
182 183 184 |
# File 'lib/fog/rackspace/compute_v2.rb', line 182 def endpoint_uri(service_endpoint_url=nil) @uri = super(@rackspace_endpoint || service_endpoint_url, :rackspace_compute_url) end |
#get_attachment(server_id, volume_id) ⇒ Excon::Response
Retrieves attachment
21 22 23 24 25 26 27 |
# File 'lib/fog/rackspace/requests/compute_v2/get_attachment.rb', line 21 def (server_id, volume_id) request( :expects => [200, 203, 300], :method => 'GET', :path => "servers/#{server_id}/os-volume_attachments/#{volume_id}" ) end |
#get_flavor(flavor_id) ⇒ Excon::Response
Retrieves flavor detail
23 24 25 26 27 28 29 |
# File 'lib/fog/rackspace/requests/compute_v2/get_flavor.rb', line 23 def get_flavor(flavor_id) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_id}" ) end |
#get_image(image_id) ⇒ Excon::Response
Retrieves image detail
27 28 29 30 31 32 33 |
# File 'lib/fog/rackspace/requests/compute_v2/get_image.rb', line 27 def get_image(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end |
#get_keypair(key_name) ⇒ Excon::Response
Retreive single keypair details
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/get_keypair.rb', line 19 def get_keypair(key_name) request( :method => 'GET', :expects => 200, :path => "/os-keypairs/#{key_name}" ) end |
#get_metadata_item(collection, obj_id, key) ⇒ Excon::Response
Retrieves single metadatum item by key.
18 19 20 21 22 23 24 |
# File 'lib/fog/rackspace/requests/compute_v2/get_metadata_item.rb', line 18 def (collection, obj_id, key) request( :expects => 200, :method => 'GET', :path => "/#{collection}/#{obj_id}/metadata/#{key}" ) end |
#get_network(id) ⇒ Object
5 6 7 |
# File 'lib/fog/rackspace/requests/compute_v2/get_network.rb', line 5 def get_network(id) request(:method => 'GET', :path => "os-networksv2/#{id}", :expects => 200) end |
#get_server(server_id) ⇒ Excon::Response
Retrieves server detail
41 42 43 44 45 46 47 |
# File 'lib/fog/rackspace/requests/compute_v2/get_server.rb', line 41 def get_server(server_id) request( :expects => [200, 203, 300], :method => 'GET', :path => "servers/#{server_id}" ) end |
#list_addresses(server_id) ⇒ Excon::Response
Lists all networks and addresses associated with a specified server.
15 16 17 18 19 20 21 |
# File 'lib/fog/rackspace/requests/compute_v2/list_addresses.rb', line 15 def list_addresses(server_id) request( :method => 'GET', :expects => 200, :path => "/servers/#{server_id}/ips" ) end |
#list_addresses_by_network(server_id, network_id) ⇒ Excon::Response
Lists all addresses associated with a specified server and network
22 23 24 25 26 27 28 |
# File 'lib/fog/rackspace/requests/compute_v2/list_addresses_by_network.rb', line 22 def list_addresses_by_network(server_id, network_id) request( :method => 'GET', :expects => 200, :path => "servers/#{server_id}/ips/#{network_id}" ) end |
#list_attachments(server_id) ⇒ Excon::Response
Retrieves list of attached volumes
21 22 23 24 25 26 27 |
# File 'lib/fog/rackspace/requests/compute_v2/list_attachments.rb', line 21 def (server_id) request( :expects => [200, 203, 300], :method => 'GET', :path => "servers/#{server_id}/os-volume_attachments" ) end |
#list_flavors ⇒ Excon::Response
Retrieves a list of flavors
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/list_flavors.rb', line 19 def list_flavors request( :expects => [200, 203], :method => 'GET', :path => 'flavors' ) end |
#list_images ⇒ Excon::Response
Retrieves a list of images
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/list_images.rb', line 19 def list_images request( :expects => [200, 203], :method => 'GET', :path => 'images' ) end |
#list_keypairs ⇒ Excon::Response
Returns a list of all key pairs associated with an account.
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/list_keypairs.rb', line 19 def list_keypairs request( :method => 'GET', :expects => 200, :path => '/os-keypairs' ) end |
#list_metadata(collection, obj_id) ⇒ Excon::Response
Retrieves all metadata associated with a server or an image.
17 18 19 20 21 22 23 |
# File 'lib/fog/rackspace/requests/compute_v2/list_metadata.rb', line 17 def (collection, obj_id) request( :expects => [200, 203], :method => 'GET', :path => "/#{collection}/#{obj_id}/metadata" ) end |
#list_networks ⇒ Object
5 6 7 |
# File 'lib/fog/rackspace/requests/compute_v2/list_networks.rb', line 5 def list_networks request(:method => 'GET', :path => 'os-networksv2', :expects => 200) end |
#list_servers ⇒ Excon::Response
Retrieves list of servers
40 41 42 43 44 45 46 |
# File 'lib/fog/rackspace/requests/compute_v2/list_servers.rb', line 40 def list_servers request( :expects => [200, 203, 300], :method => 'GET', :path => 'servers/detail' ) end |
#reboot_server(server_id, type) ⇒ Object
Reboots server
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fog/rackspace/requests/compute_v2/reboot_server.rb', line 14 def reboot_server(server_id, type) data = { 'reboot' => { 'type' => type } } request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#rebuild_server(server_id, image_id, options = {}) ⇒ Excon::Response
The rebuild operation removes all data on the server and replaces it with the specified image. The serverRef and all IP addresses remain the same. If you specify name, metadata, accessIPv4, or accessIPv6 in the rebuild request, new values replace existing values. Otherwise, these values do not change.
-
Status Transition:
-
ACTIVE -> REBUILD -> ACTIVE
-
ACTIVE -> REBUILD -> ERROR (on error)
-
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fog/rackspace/requests/compute_v2/rebuild_server.rb', line 46 def rebuild_server(server_id, image_id, ={}) data = { 'rebuild' => || {} } data['rebuild']['imageRef'] = image_id request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#region ⇒ Object
178 179 180 |
# File 'lib/fog/rackspace/compute_v2.rb', line 178 def region @rackspace_region end |
#request(params, parse_json = true, &block) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/fog/rackspace/compute_v2.rb', line 149 def request(params, parse_json = true, &block) super(params, parse_json, &block) rescue Excon::Errors::NotFound => error raise NotFound.slurp(error, self) rescue Excon::Errors::BadRequest => error raise BadRequest.slurp(error, self) rescue Excon::Errors::InternalServerError => error raise InternalServerError.slurp(error, self) rescue Excon::Errors::HTTPStatusError => error raise ServiceError.slurp(error, self) end |
#request_id_header ⇒ Object
174 175 176 |
# File 'lib/fog/rackspace/compute_v2.rb', line 174 def request_id_header "X-Compute-Request-Id" end |
#rescue_server(server_id) ⇒ Excon::Response
Rescue mode is only guaranteed to be active for 90 minutes
Puts server into rescue mode
-
Status Transition:
-
PREP_RESCUE -> RESCUE
-
PREP_RESCUE -> ACTIVE (on error)
-
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/rackspace/requests/compute_v2/rescue_server.rb', line 18 def rescue_server(server_id) data = { 'rescue' => nil } request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#resize_server(server_id, flavor_id) ⇒ Excon::Response
All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
Reverts server resize operation
-
Status Transition:
-
VERIFY_RESIZE -> ACTIVE
-
VERIFY_RESIZE -> ERROR (on error)
-
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/rackspace/requests/compute_v2/resize_server.rb', line 20 def resize_server(server_id, flavor_id) data = { 'resize' => { 'flavorRef' => flavor_id } } request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#revert_resize_server(server_id) ⇒ Excon::Response
All resizes are automatically confirmed after 24 hours if you do not explicitly confirm or revert the resize.
Reverts server resize operation
-
Status Transition:
-
VERIFY_RESIZE -> ACTIVE
-
VERIFY_RESIZE -> ERROR (on error)
-
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/rackspace/requests/compute_v2/revert_resize_server.rb', line 20 def revert_resize_server(server_id) data = { 'revertResize' => nil } request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#service_name ⇒ Object
170 171 172 |
# File 'lib/fog/rackspace/compute_v2.rb', line 170 def service_name :cloudServersOpenStack end |
#set_metadata(collection, obj_id, metadata = {}) ⇒ Excon::Response
Sets metadata associated with a server or an image.
18 19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/set_metadata.rb', line 18 def (collection, obj_id, = {}) request( :expects => [200, 203], :method => 'PUT', :path => "/#{collection}/#{obj_id}/metadata", :body => Fog::JSON.encode('metadata' => ) ) end |
#set_metadata_item(collection, obj_id, key, value) ⇒ Excon::Response
Sets a single metadatum item by key.
19 20 21 22 23 24 25 26 |
# File 'lib/fog/rackspace/requests/compute_v2/set_metadata_item.rb', line 19 def (collection, obj_id, key, value) request( :expects => 200, :method => 'PUT', :path => "/#{collection}/#{obj_id}/metadata/#{key}", :body => Fog::JSON.encode('meta' => { key => value }) ) end |
#unrescue_server(server_id) ⇒ Excon::Response
Take server out of rescue mode
-
Status Transition:
-
RESCUE -> PREP_UNRESCUE -> ACTIVE
-
RESCUE -> ERROR (on error)
-
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/rackspace/requests/compute_v2/unrescue_server.rb', line 17 def unrescue_server(server_id) data = { 'unrescue' => nil } request( :body => Fog::JSON.encode(data), :expects => [202], :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#update_metadata(collection, obj_id, metadata = {}) ⇒ Excon::Response
Updates metadata items for a specified server or image.
18 19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/compute_v2/update_metadata.rb', line 18 def (collection, obj_id, = {}) request( :expects => [200, 203], :method => 'POST', :path => "/#{collection}/#{obj_id}/metadata", :body => Fog::JSON.encode('metadata' => ) ) end |
#update_server(server_id, options = {}) ⇒ Object
If you edit the server name, the server host name does not change. Also, server names are not guaranteed to be unique.
Update the editable attributes of a specified server.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fog/rackspace/requests/compute_v2/update_server.rb', line 18 def update_server(server_id, ={}) data = .is_a?(Hash) ? : { 'name' => } #LEGACY - second parameter was previously server name request( :body => Fog::JSON.encode('server' => data), :expects => [200], :method => 'PUT', :path => "servers/#{server_id}" ) end |