Class: Fog::OpenStack::Compute::Real
- Inherits:
-
Object
- Object
- Fog::OpenStack::Compute::Real
- Includes:
- Fog::OpenStack::Core
- Defined in:
- lib/fog/openstack/compute/requests/get_limits.rb,
lib/fog/openstack/compute.rb,
lib/fog/openstack/compute/requests/get_quota.rb,
lib/fog/openstack/compute/requests/get_usage.rb,
lib/fog/openstack/compute/requests/list_hosts.rb,
lib/fog/openstack/compute/requests/list_zones.rb,
lib/fog/openstack/compute/requests/set_tenant.rb,
lib/fog/openstack/compute/requests/delete_meta.rb,
lib/fog/openstack/compute/requests/get_address.rb,
lib/fog/openstack/compute/requests/list_images.rb,
lib/fog/openstack/compute/requests/list_usages.rb,
lib/fog/openstack/compute/requests/stop_server.rb,
lib/fog/openstack/compute/requests/update_meta.rb,
lib/fog/openstack/compute/requests/add_fixed_ip.rb,
lib/fog/openstack/compute/requests/create_image.rb,
lib/fog/openstack/compute/requests/delete_image.rb,
lib/fog/openstack/compute/requests/get_key_pair.rb,
lib/fog/openstack/compute/requests/get_metadata.rb,
lib/fog/openstack/compute/requests/list_flavors.rb,
lib/fog/openstack/compute/requests/list_servers.rb,
lib/fog/openstack/compute/requests/list_volumes.rb,
lib/fog/openstack/compute/requests/pause_server.rb,
lib/fog/openstack/compute/requests/set_metadata.rb,
lib/fog/openstack/compute/requests/start_server.rb,
lib/fog/openstack/compute/requests/update_quota.rb,
lib/fog/openstack/compute/requests/attach_volume.rb,
lib/fog/openstack/compute/requests/create_flavor.rb,
lib/fog/openstack/compute/requests/create_server.rb,
lib/fog/openstack/compute/requests/create_volume.rb,
lib/fog/openstack/compute/requests/delete_flavor.rb,
lib/fog/openstack/compute/requests/delete_server.rb,
lib/fog/openstack/compute/requests/delete_volume.rb,
lib/fog/openstack/compute/requests/detach_volume.rb,
lib/fog/openstack/compute/requests/get_aggregate.rb,
lib/fog/openstack/compute/requests/list_metadata.rb,
lib/fog/openstack/compute/requests/list_services.rb,
lib/fog/openstack/compute/requests/reboot_server.rb,
lib/fog/openstack/compute/requests/rescue_server.rb,
lib/fog/openstack/compute/requests/resize_server.rb,
lib/fog/openstack/compute/requests/resume_server.rb,
lib/fog/openstack/compute/requests/server_action.rb,
lib/fog/openstack/compute/requests/shelve_server.rb,
lib/fog/openstack/compute/requests/update_server.rb,
lib/fog/openstack/compute/requests/delete_service.rb,
lib/fog/openstack/compute/requests/enable_service.rb,
lib/fog/openstack/compute/requests/get_hypervisor.rb,
lib/fog/openstack/compute/requests/list_addresses.rb,
lib/fog/openstack/compute/requests/list_key_pairs.rb,
lib/fog/openstack/compute/requests/list_snapshots.rb,
lib/fog/openstack/compute/requests/migrate_server.rb,
lib/fog/openstack/compute/requests/rebuild_server.rb,
lib/fog/openstack/compute/requests/server_actions.rb,
lib/fog/openstack/compute/requests/suspend_server.rb,
lib/fog/openstack/compute/requests/unpause_server.rb,
lib/fog/openstack/compute/requests/create_key_pair.rb,
lib/fog/openstack/compute/requests/create_snapshot.rb,
lib/fog/openstack/compute/requests/delete_key_pair.rb,
lib/fog/openstack/compute/requests/delete_metadata.rb,
lib/fog/openstack/compute/requests/delete_snapshot.rb,
lib/fog/openstack/compute/requests/disable_service.rb,
lib/fog/openstack/compute/requests/evacuate_server.rb,
lib/fog/openstack/compute/requests/get_vnc_console.rb,
lib/fog/openstack/compute/requests/list_aggregates.rb,
lib/fog/openstack/compute/requests/release_address.rb,
lib/fog/openstack/compute/requests/remote_consoles.rb,
lib/fog/openstack/compute/requests/remove_fixed_ip.rb,
lib/fog/openstack/compute/requests/unshelve_server.rb,
lib/fog/openstack/compute/requests/update_metadata.rb,
lib/fog/openstack/compute/requests/allocate_address.rb,
lib/fog/openstack/compute/requests/create_aggregate.rb,
lib/fog/openstack/compute/requests/delete_aggregate.rb,
lib/fog/openstack/compute/requests/get_host_details.rb,
lib/fog/openstack/compute/requests/get_os_interface.rb,
lib/fog/openstack/compute/requests/get_server_group.rb,
lib/fog/openstack/compute/requests/list_hypervisors.rb,
lib/fog/openstack/compute/requests/update_aggregate.rb,
lib/fog/openstack/compute/requests/add_flavor_access.rb,
lib/fog/openstack/compute/requests/associate_address.rb,
lib/fog/openstack/compute/requests/get_image_details.rb,
lib/fog/openstack/compute/requests/add_aggregate_host.rb,
lib/fog/openstack/compute/requests/add_security_group.rb,
lib/fog/openstack/compute/requests/boot_from_snapshot.rb,
lib/fog/openstack/compute/requests/get_console_output.rb,
lib/fog/openstack/compute/requests/get_flavor_details.rb,
lib/fog/openstack/compute/requests/get_quota_defaults.rb,
lib/fog/openstack/compute/requests/get_security_group.rb,
lib/fog/openstack/compute/requests/get_server_details.rb,
lib/fog/openstack/compute/requests/get_server_volumes.rb,
lib/fog/openstack/compute/requests/get_volume_details.rb,
lib/fog/openstack/compute/requests/list_address_pools.rb,
lib/fog/openstack/compute/requests/list_all_addresses.rb,
lib/fog/openstack/compute/requests/list_images_detail.rb,
lib/fog/openstack/compute/requests/list_os_interfaces.rb,
lib/fog/openstack/compute/requests/list_server_groups.rb,
lib/fog/openstack/compute/requests/reset_server_state.rb,
lib/fog/openstack/compute/requests/server_diagnostics.rb,
lib/fog/openstack/compute/requests/create_os_interface.rb,
lib/fog/openstack/compute/requests/create_server_group.rb,
lib/fog/openstack/compute/requests/delete_os_interface.rb,
lib/fog/openstack/compute/requests/delete_server_group.rb,
lib/fog/openstack/compute/requests/get_flavor_metadata.rb,
lib/fog/openstack/compute/requests/get_server_password.rb,
lib/fog/openstack/compute/requests/list_flavors_detail.rb,
lib/fog/openstack/compute/requests/list_servers_detail.rb,
lib/fog/openstack/compute/requests/list_volumes_detail.rb,
lib/fog/openstack/compute/requests/list_zones_detailed.rb,
lib/fog/openstack/compute/requests/live_migrate_server.rb,
lib/fog/openstack/compute/requests/disassociate_address.rb,
lib/fog/openstack/compute/requests/get_snapshot_details.rb,
lib/fog/openstack/compute/requests/list_security_groups.rb,
lib/fog/openstack/compute/requests/remove_flavor_access.rb,
lib/fog/openstack/compute/requests/revert_resize_server.rb,
lib/fog/openstack/compute/requests/confirm_resize_server.rb,
lib/fog/openstack/compute/requests/create_security_group.rb,
lib/fog/openstack/compute/requests/delete_security_group.rb,
lib/fog/openstack/compute/requests/list_public_addresses.rb,
lib/fog/openstack/compute/requests/list_snapshots_detail.rb,
lib/fog/openstack/compute/requests/remove_aggregate_host.rb,
lib/fog/openstack/compute/requests/remove_security_group.rb,
lib/fog/openstack/compute/requests/shelve_offload_server.rb,
lib/fog/openstack/compute/requests/change_server_password.rb,
lib/fog/openstack/compute/requests/create_flavor_metadata.rb,
lib/fog/openstack/compute/requests/delete_flavor_metadata.rb,
lib/fog/openstack/compute/requests/list_private_addresses.rb,
lib/fog/openstack/compute/requests/update_flavor_metadata.rb,
lib/fog/openstack/compute/requests/get_security_group_rule.rb,
lib/fog/openstack/compute/requests/list_availability_zones.rb,
lib/fog/openstack/compute/requests/list_hypervisor_servers.rb,
lib/fog/openstack/compute/requests/list_hypervisors_detail.rb,
lib/fog/openstack/compute/requests/list_volume_attachments.rb,
lib/fog/openstack/compute/requests/get_hypervisor_statistics.rb,
lib/fog/openstack/compute/requests/update_aggregate_metadata.rb,
lib/fog/openstack/compute/requests/create_security_group_rule.rb,
lib/fog/openstack/compute/requests/delete_security_group_rule.rb,
lib/fog/openstack/compute/requests/disable_service_log_reason.rb,
lib/fog/openstack/compute/requests/list_tenants_with_flavor_access.rb
Overview
Instance Attribute Summary
Attributes included from Fog::OpenStack::Core
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_application_credential_id, #openstack_application_credential_secret, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_api_version, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token
Class Method Summary collapse
Instance Method Summary collapse
- #add_aggregate_host(uuid, host_uuid) ⇒ Object
-
#add_fixed_ip(server_id, network_id) ⇒ Object
Add an IP address on a network.
- #add_flavor_access(flavor_ref, tenant_id) ⇒ Object
- #add_security_group(server_id, group_name) ⇒ Object
- #allocate_address(pool = nil) ⇒ Object
- #associate_address(server_id, ip_address) ⇒ Object
- #attach_volume(volume_id, server_id, device) ⇒ Object
- #boot_from_snapshot(name, image_ref, flavor_ref, options = {}) ⇒ Object
- #change_server_password(server_id, admin_password) ⇒ Object
- #confirm_resize_server(server_id) ⇒ Object
- #create_aggregate(name, options = {}) ⇒ Object
-
#create_flavor(attributes) ⇒ Object
PARAMETERS # name = Name of flavor ram = Memory in MB vcpus = Number of VCPUs disk = Size of local disk in GB swap = Swap space in MB rxtx_factor = RX/TX factor.
- #create_flavor_metadata(flavor_ref, metadata) ⇒ Object
- #create_image(server_id, name, metadata = {}) ⇒ Object
- #create_key_pair(key_name, public_key = nil, user_id = nil) ⇒ Object
-
#create_os_interface(server_id, options = {}) ⇒ Object
Parameters * server_id <~String> * options <~Hash>.
- #create_security_group(name, description) ⇒ Object
- #create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id = nil) ⇒ Object
- #create_server(name, image_ref, flavor_ref, options = {}) ⇒ Object
- #create_server_group(name, policy) ⇒ Object
- #create_snapshot(volume_id, name, description, force = false) ⇒ Object
- #create_volume(name, description, size, options = {}) ⇒ Object
- #default_service_type ⇒ Object
- #delete_aggregate(uuid) ⇒ Object
- #delete_flavor(flavor_id) ⇒ Object
- #delete_flavor_metadata(flavor_ref, key) ⇒ Object
- #delete_image(image_id) ⇒ Object
- #delete_key_pair(key_name, user_id = nil) ⇒ Object
- #delete_meta(collection_name, parent_id, key) ⇒ Object
- #delete_metadata(collection_name, parent_id, key) ⇒ Object
-
#delete_os_interface(server_id, port_id) ⇒ Object
Parameters * server_id <~String> * port_id <~String>.
- #delete_security_group(security_group_id) ⇒ Object
- #delete_security_group_rule(security_group_rule_id) ⇒ Object
- #delete_server(server_id) ⇒ Object
- #delete_server_group(group_id) ⇒ Object
- #delete_service(uuid, optional_params = nil) ⇒ Object
- #delete_snapshot(snapshot_id) ⇒ Object
- #delete_volume(volume_id) ⇒ Object
- #detach_volume(server_id, attachment_id) ⇒ Object
- #disable_service(host, binary, optional_params = nil) ⇒ Object
- #disable_service_log_reason(host, binary, disabled_reason, optional_params = nil) ⇒ Object
- #disassociate_address(server_id, ip_address) ⇒ Object
- #enable_service(host, binary, optional_params = nil) ⇒ Object
- #evacuate_server(server_id, host = nil, on_shared_storage = nil, admin_password = nil) ⇒ Object
- #get_address(address_id) ⇒ Object
- #get_aggregate(uuid) ⇒ Object
- #get_console_output(server_id, log_length) ⇒ Object
- #get_flavor_details(flavor_ref) ⇒ Object
- #get_flavor_metadata(flavor_ref) ⇒ Object
- #get_host_details(host) ⇒ Object
- #get_hypervisor(hypervisor_id) ⇒ Object
- #get_hypervisor_statistics(_tenant_id) ⇒ Object
- #get_image_details(image_id) ⇒ Object
- #get_key_pair(key_name) ⇒ Object
- #get_limits(options = {}) ⇒ Object
- #get_metadata(collection_name, parent_id, key) ⇒ Object
- #get_os_interface(server_id, port_id) ⇒ Object
- #get_quota(tenant_id) ⇒ Object
- #get_quota_defaults(tenant_id) ⇒ Object
- #get_security_group(security_group_id) ⇒ Object
- #get_security_group_rule(security_group_rule_id) ⇒ Object
- #get_server_details(server_id) ⇒ Object
- #get_server_group(group_id) ⇒ Object
- #get_server_password(server_id) ⇒ Object
- #get_server_volumes(server_id) ⇒ Object
- #get_snapshot_details(snapshot_id) ⇒ Object
- #get_usage(tenant_id, date_start, date_end) ⇒ Object
-
#get_vnc_console(server_id, console_type) ⇒ Object
Get a vnc console for an instance.
- #get_volume_details(volume_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_address_pools ⇒ Object
- #list_addresses(server_id) ⇒ Object
- #list_aggregates(options = {}) ⇒ Object
- #list_all_addresses(options = {}) ⇒ Object
- #list_availability_zones(options = {}) ⇒ Object
- #list_flavors(options = {}) ⇒ Object
- #list_flavors_detail(options = {}) ⇒ Object
- #list_hosts(options = {}) ⇒ Object
- #list_hypervisor_servers(hypervisor_id, options = {}) ⇒ Object
- #list_hypervisors(options = {}) ⇒ Object
- #list_hypervisors_detail(options = {}) ⇒ Object
- #list_images ⇒ Object
- #list_images_detail(filters = {}) ⇒ Object
- #list_key_pairs(options = {}) ⇒ Object
- #list_metadata(collection_name, parent_id) ⇒ Object
- #list_os_interfaces(server_id) ⇒ Object
- #list_private_addresses(server_id) ⇒ Object
- #list_public_addresses(server_id) ⇒ Object
- #list_security_groups(options = {}) ⇒ Object
- #list_server_groups(options = {}) ⇒ Object
- #list_servers(options = {}) ⇒ Object
-
#list_servers_detail(options = {}) ⇒ Object
Available filters: name, status, image, flavor, changes_since, reservation_id.
- #list_services(parameters = nil) ⇒ Object
- #list_snapshots(options = true) ⇒ Object
- #list_snapshots_detail(options = {}) ⇒ Object
- #list_tenants_with_flavor_access(flavor_ref) ⇒ Object
- #list_usages(date_start = nil, date_end = nil, detailed = false) ⇒ Object
- #list_volume_attachments(server_id) ⇒ Object
- #list_volumes(options = true) ⇒ Object
- #list_volumes_detail(options = {}) ⇒ Object
- #list_zones(options = {}) ⇒ Object
- #list_zones_detailed(options = {}) ⇒ Object
- #live_migrate_server(server_id, host, block_migration, disk_over_commit) ⇒ Object
- #migrate_server(server_id) ⇒ Object
-
#pause_server(server_id) ⇒ Object
Pause the server.
- #reboot_server(server_id, type = 'SOFT') ⇒ Object
- #rebuild_server(server_id, image_ref, name, admin_pass = nil, metadata = nil, personality = nil) ⇒ Object
- #release_address(address_id) ⇒ Object
-
#remote_consoles(server_id, protocol, type) ⇒ Object
Get a vnc console for an instance.
- #remove_aggregate_host(uuid, host_uuid) ⇒ Object
-
#remove_fixed_ip(server_id, address) ⇒ Object
Remove an IP address.
- #remove_flavor_access(flavor_ref, tenant_id) ⇒ Object
- #remove_security_group(server_id, group_name) ⇒ Object
-
#rescue_server(server_id) ⇒ Object
Rescue the server.
- #reset_server_state(server_id, status) ⇒ Object
- #resize_server(server_id, flavor_ref) ⇒ Object
-
#resume_server(server_id) ⇒ Object
Resume the server.
- #revert_resize_server(server_id) ⇒ Object
- #server_action(server_id, body, expects = [200, 202]) ⇒ Object
-
#server_actions(server_id) ⇒ Object
Retrieve server actions.
-
#server_diagnostics(server_id) ⇒ Object
Retrieve server diagnostics.
- #set_metadata(collection_name, parent_id, metadata = {}) ⇒ Object
- #set_tenant(tenant) ⇒ Object
-
#shelve_offload_server(server_id) ⇒ Object
Shelve Off load the server.
-
#shelve_server(server_id) ⇒ Object
Shelve the server.
-
#start_server(server_id) ⇒ Object
Start the server.
-
#stop_server(server_id) ⇒ Object
Stop the server.
-
#suspend_server(server_id) ⇒ Object
Suspend the server.
-
#unpause_server(server_id) ⇒ Object
Unpause the server.
-
#unshelve_server(server_id) ⇒ Object
Unshelve the server.
- #update_aggregate(uuid, options = {}) ⇒ Object
- #update_aggregate_metadata(uuid, metadata = {}) ⇒ Object
- #update_flavor_metadata(flavor_ref, key, value) ⇒ Object
- #update_meta(collection_name, parent_id, key, value) ⇒ Object
- #update_metadata(collection_name, parent_id, metadata = {}) ⇒ Object
- #update_quota(tenant_id, options = {}) ⇒ Object
- #update_server(server_id, options = {}) ⇒ Object
Methods included from Fog::OpenStack::Core
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
384 385 386 387 388 389 |
# File 'lib/fog/openstack/compute.rb', line 384 def initialize( = {}) @supported_versions = SUPPORTED_VERSIONS @supported_microversion = SUPPORTED_MICROVERSION @microversion_key = 'X-OpenStack-Nova-API-Version' super end |
Class Method Details
Instance Method Details
#add_aggregate_host(uuid, host_uuid) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/openstack/compute/requests/add_aggregate_host.rb', line 5 def add_aggregate_host(uuid, host_uuid) data = {'add_host' => {'host' => host_uuid}} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end |
#add_fixed_ip(server_id, network_id) ⇒ Object
Add an IP address on a network.
Parameters
-
server_id <~String> - The ID of the server in which to add an IP to.
-
network_id <~String> - The ID of the network the IP should be on.
Returns
-
success <~Boolean>
12 13 14 15 16 17 18 19 |
# File 'lib/fog/openstack/compute/requests/add_fixed_ip.rb', line 12 def add_fixed_ip(server_id, network_id) body = { 'addFixedIp' => { 'networkId' => network_id } } server_action(server_id, body).status == 202 end |
#add_flavor_access(flavor_ref, tenant_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/add_flavor_access.rb', line 5 def add_flavor_access(flavor_ref, tenant_id) request( :body => Fog::JSON.encode("addTenantAccess" => { "tenant" => tenant_id }), :expects => [200, 203], :method => 'POST', :path => "flavors/#{flavor_ref}/action" ) end |
#add_security_group(server_id, group_name) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/add_security_group.rb', line 5 def add_security_group(server_id, group_name) body = {'addSecurityGroup' => {"name" => group_name}} server_action(server_id, body) end |
#allocate_address(pool = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/allocate_address.rb', line 5 def allocate_address(pool = nil) request( :body => Fog::JSON.encode('pool' => pool), :expects => [200, 202], :method => 'POST', :path => 'os-floating-ips' ) end |
#associate_address(server_id, ip_address) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/associate_address.rb', line 5 def associate_address(server_id, ip_address) body = {"addFloatingIp" => {"address" => ip_address}} server_action(server_id, body) end |
#attach_volume(volume_id, server_id, device) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/attach_volume.rb', line 5 def attach_volume(volume_id, server_id, device) data = { 'volumeAttachment' => { 'volumeId' => volume_id.to_s, 'device' => device } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "servers/%s/os-volume_attachments" % [server_id] ) end |
#boot_from_snapshot(name, image_ref, flavor_ref, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/openstack/compute/requests/boot_from_snapshot.rb', line 5 def boot_from_snapshot(name, image_ref, flavor_ref, = {}) data = { 'server' => { 'flavorRef' => flavor_ref, 'imageRef' => image_ref, 'name' => name } } = ['metadata', 'accessIPv4', 'accessIPv6', 'availability_zone', 'user_data', 'block_device_mapping', 'key_name', 'security_groups'] .select { |o| [o] }.each do |key| data['server'][key] = [key] end if ['personality'] data['server']['personality'] = [] ['personality'].each do |file| data['server']['personality'] << { 'contents' => Base64.encode64(file['contents']), 'path' => file['path'] } end end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => '/os-volumes_boot' ) end |
#change_server_password(server_id, admin_password) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/change_server_password.rb', line 5 def change_server_password(server_id, admin_password) body = {'changePassword' => {'adminPass' => admin_password}} server_action(server_id, body) end |
#confirm_resize_server(server_id) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/confirm_resize_server.rb', line 5 def confirm_resize_server(server_id) body = {'confirmResize' => nil} server_action(server_id, body, 204) end |
#create_aggregate(name, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/openstack/compute/requests/create_aggregate.rb', line 5 def create_aggregate(name, = {}) data = { 'aggregate' => { 'name' => name } } = [:availability_zone] .select { |o| [o] }.each do |key| data['aggregate'][key] = [key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates" ) end |
#create_flavor(attributes) ⇒ Object
PARAMETERS # name = Name of flavor ram = Memory in MB vcpus = Number of VCPUs disk = Size of local disk in GB swap = Swap space in MB rxtx_factor = RX/TX factor
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/openstack/compute/requests/create_flavor.rb', line 12 def create_flavor(attributes) data = { 'flavor' => { 'name' => attributes[:name], 'ram' => attributes[:ram], 'vcpus' => attributes[:vcpus], 'disk' => attributes[:disk], 'id' => attributes[:flavor_id], 'swap' => attributes[:swap], 'OS-FLV-EXT-DATA:ephemeral' => attributes[:ephemeral], 'os-flavor-access:is_public' => attributes[:is_public], 'rxtx_factor' => attributes[:rxtx_factor] } } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'flavors' ) end |
#create_flavor_metadata(flavor_ref, metadata) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/openstack/compute/requests/create_flavor_metadata.rb', line 5 def (flavor_ref, ) data = { 'extra_specs' => } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => "flavors/#{flavor_ref}/os-extra_specs" ) end |
#create_image(server_id, name, metadata = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/openstack/compute/requests/create_image.rb', line 5 def create_image(server_id, name, = {}) body = {'createImage' => { 'name' => name, 'metadata' => }} data = server_action(server_id, body) image_id = data.headers["Location"].scan(%r{.*/(.*)}).flatten[0] get_image_details(image_id) end |
#create_key_pair(key_name, public_key = nil, user_id = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/openstack/compute/requests/create_key_pair.rb', line 5 def create_key_pair(key_name, public_key = nil, user_id = nil) data = { 'keypair' => { 'name' => key_name } } data['keypair']['public_key'] = public_key unless public_key.nil? data['keypair']['user_id'] = user_id unless user_id.nil? request( :body => Fog::JSON.encode(data), :expects => [200, 201], :method => 'POST', :path => 'os-keypairs' ) end |
#create_os_interface(server_id, options = {}) ⇒ Object
Parameters
-
server_id <~String>
-
options <~Hash>
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/openstack/compute/requests/create_os_interface.rb', line 8 def create_os_interface(server_id, ={}) body = { 'interfaceAttachment' => {} } if [:port_id] body['interfaceAttachment']['port_id'] = [:port_id] elsif [:net_id] body['interfaceAttachment']['net_id'] = [:net_id] end if [:ip_address] body['interfaceAttachment']['fixed_ips'] = {ip_address: [:ip_address]} end request( :body => Fog::JSON.encode(body), :expects => [200, 201, 202, 204], :method => 'POST', :path => "servers/#{server_id}/os-interface" ) end |
#create_security_group(name, description) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/openstack/compute/requests/create_security_group.rb', line 5 def create_security_group(name, description) data = { 'security_group' => { 'name' => name, 'description' => description } } request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'os-security-groups' ) end |
#create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/openstack/compute/requests/create_security_group_rule.rb', line 5 def create_security_group_rule(parent_group_id, ip_protocol, from_port, to_port, cidr, group_id = nil) data = { 'security_group_rule' => { 'parent_group_id' => parent_group_id, 'ip_protocol' => ip_protocol, 'from_port' => from_port, 'to_port' => to_port, 'cidr' => cidr, 'group_id' => group_id } } request( :expects => 200, :method => 'POST', :body => Fog::JSON.encode(data), :path => 'os-security-group-rules' ) end |
#create_server(name, image_ref, flavor_ref, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fog/openstack/compute/requests/create_server.rb', line 5 def create_server(name, image_ref, flavor_ref, = {}) data = { 'server' => { 'flavorRef' => flavor_ref, 'name' => name } } data['server']['imageRef'] = image_ref if image_ref = ['metadata', 'accessIPv4', 'accessIPv6', 'availability_zone', 'user_data', 'key_name', 'adminPass', 'config_drive', 'min_count', 'max_count', 'return_reservation_id'] .select { |o| [o] }.each do |key| data['server'][key] = [key] end if ['security_groups'] # security names requires a hash with a name prefix data['server']['security_groups'] = Array(['security_groups']).map do |sg| name = if sg.kind_of?(Fog::OpenStack::Compute::SecurityGroup) sg.name else sg end {:name => name} end end if ['personality'] data['server']['personality'] = [] ['personality'].each do |file| data['server']['personality'] << { 'contents' => Base64.encode64(file['contents'] || file[:contents]), 'path' => file['path'] || file[:path] } end end if ['nics'] data['server']['networks'] = Array(['nics']).map do |nic| neti = {} neti['uuid'] = (nic['net_id'] || nic[:net_id]) unless (nic['net_id'] || nic[:net_id]).nil? neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil? neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil? neti end end if ['os:scheduler_hints'] data['os:scheduler_hints'] = ['os:scheduler_hints'] end if (block_device_mapping = ['block_device_mapping_v2']) data['server']['block_device_mapping_v2'] = [block_device_mapping].flatten.collect do |mapping| entered_block_device_mapping = {} [:boot_index, :delete_on_termination, :destination_type, :device_name, :device_type, :disk_bus, :guest_format, :source_type, :uuid, :volume_size].each do |index| entered_block_device_mapping[index.to_s] = mapping[index] if mapping.key?(index) end entered_block_device_mapping end elsif (block_device_mapping = ['block_device_mapping']) data['server']['block_device_mapping'] = [block_device_mapping].flatten.collect do |mapping| { 'delete_on_termination' => mapping[:delete_on_termination], 'device_name' => mapping[:device_name], 'volume_id' => mapping[:volume_id], 'volume_size' => mapping[:volume_size], } end end path = ['block_device_mapping'] ? 'os-volumes_boot' : 'servers' request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => path ) end |
#create_server_group(name, policy) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/create_server_group.rb', line 5 def create_server_group(name, policy) Fog::OpenStack::Compute::ServerGroup.validate_server_group_policy policy body = {'server_group' => { 'name' => name, 'policies' => [policy] }} request( :body => Fog::JSON.encode(body), :expects => 200, :method => 'POST', :path => 'os-server-groups' ) end |
#create_snapshot(volume_id, name, description, force = false) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/openstack/compute/requests/create_snapshot.rb', line 5 def create_snapshot(volume_id, name, description, force = false) data = { 'snapshot' => { 'volume_id' => volume_id, 'display_name' => name, 'display_description' => description, 'force' => force } } request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => "os-snapshots" ) end |
#create_volume(name, description, size, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fog/openstack/compute/requests/create_volume.rb', line 7 def create_volume(name, description, size, = {}) data = { 'volume' => { 'display_name' => name, 'display_description' => description, 'size' => size } } = [ :snapshot_id, :availability_zone, :volume_type, :metadata ] .select { |o| [o] }.each do |key| data['volume'][key] = [key] end request( :body => Fog::JSON.encode(data), :expects => [200, 202], :method => 'POST', :path => 'os-volumes' ) end |
#default_service_type ⇒ Object
380 381 382 |
# File 'lib/fog/openstack/compute.rb', line 380 def default_service_type %w[compute] end |
#delete_aggregate(uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_aggregate.rb', line 5 def delete_aggregate(uuid) request( :expects => [200, 202, 204], :method => 'DELETE', :path => "os-aggregates/#{uuid}" ) end |
#delete_flavor(flavor_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_flavor.rb', line 5 def delete_flavor(flavor_id) request( :expects => 202, :method => 'DELETE', :path => "flavors/#{flavor_id}" ) end |
#delete_flavor_metadata(flavor_ref, key) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_flavor_metadata.rb', line 5 def (flavor_ref, key) request( :expects => 200, :method => 'DELETE', :path => "flavors/#{flavor_ref}/os-extra_specs/#{key}" ) end |
#delete_image(image_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_image.rb', line 5 def delete_image(image_id) request( :expects => 204, :method => 'DELETE', :path => "images/#{image_id}" ) end |
#delete_key_pair(key_name, user_id = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/openstack/compute/requests/delete_key_pair.rb', line 5 def delete_key_pair(key_name, user_id = nil) = {} [:user_id] = user_id unless user_id.nil? request( :expects => [202, 204], :method => 'DELETE', :path => "os-keypairs/#{Fog::OpenStack.escape(key_name)}" ) end |
#delete_meta(collection_name, parent_id, key) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_meta.rb', line 5 def (collection_name, parent_id, key) request( :expects => 204, :method => 'DELETE', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end |
#delete_metadata(collection_name, parent_id, key) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_metadata.rb', line 5 def (collection_name, parent_id, key) request( :expects => 204, :method => 'DELETE', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end |
#delete_os_interface(server_id, port_id) ⇒ Object
Parameters
-
server_id <~String>
-
port_id <~String>
8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/delete_os_interface.rb', line 8 def delete_os_interface(server_id, port_id) request( :expects => [200, 202,204], :method => 'DELETE', :path => "servers/#{server_id}/os-interface/#{port_id}" ) end |
#delete_security_group(security_group_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_security_group.rb', line 5 def delete_security_group(security_group_id) request( :expects => 202, :method => 'DELETE', :path => "os-security-groups/#{security_group_id}" ) end |
#delete_security_group_rule(security_group_rule_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_security_group_rule.rb', line 5 def delete_security_group_rule(security_group_rule_id) request( :expects => 202, :method => 'DELETE', :path => "os-security-group-rules/#{security_group_rule_id}" ) end |
#delete_server(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_server.rb', line 5 def delete_server(server_id) request( :expects => 204, :method => 'DELETE', :path => "servers/#{server_id}" ) end |
#delete_server_group(group_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_server_group.rb', line 5 def delete_server_group(group_id) request( :expects => 204, :method => 'DELETE', :path => "os-server-groups/#{group_id}" ) end |
#delete_service(uuid, optional_params = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/openstack/compute/requests/delete_service.rb', line 5 def delete_service(uuid, optional_params = nil) # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI.encode(v) } if optional_params request( :expects => [202, 204], :method => 'DELETE', :path => "os-services/#{uuid}", :query => optional_params ) end |
#delete_snapshot(snapshot_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_snapshot.rb', line 5 def delete_snapshot(snapshot_id) request( :expects => 202, :method => 'DELETE', :path => "os-snapshots/#{snapshot_id}" ) end |
#delete_volume(volume_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/delete_volume.rb', line 5 def delete_volume(volume_id) request( :expects => 202, :method => 'DELETE', :path => "os-volumes/#{volume_id}" ) end |
#detach_volume(server_id, attachment_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/detach_volume.rb', line 5 def detach_volume(server_id, ) request( :expects => 202, :method => 'DELETE', :path => "servers/%s/os-volume_attachments/%s" % [server_id, ] ) end |
#disable_service(host, binary, optional_params = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/disable_service.rb', line 5 def disable_service(host, binary, optional_params = nil) data = {"host" => host, "binary" => binary} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI.encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/disable", :query => optional_params ) end |
#disable_service_log_reason(host, binary, disabled_reason, optional_params = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/disable_service_log_reason.rb', line 5 def disable_service_log_reason(host, binary, disabled_reason, optional_params = nil) data = {"host" => host, "binary" => binary, "disabled_reason" => disabled_reason} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI.encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/disable-log-reason", :query => optional_params ) end |
#disassociate_address(server_id, ip_address) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/disassociate_address.rb', line 5 def disassociate_address(server_id, ip_address) body = {"removeFloatingIp" => {"address" => ip_address}} server_action(server_id, body) end |
#enable_service(host, binary, optional_params = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/enable_service.rb', line 5 def enable_service(host, binary, optional_params = nil) data = {"host" => host, "binary" => binary} # Encode all params optional_params = optional_params.each { |k, v| optional_params[k] = URI.encode(v) } if optional_params request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "os-services/enable", :query => optional_params ) end |
#evacuate_server(server_id, host = nil, on_shared_storage = nil, admin_password = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/evacuate_server.rb', line 5 def evacuate_server(server_id, host = nil, on_shared_storage = nil, admin_password = nil) evacuate = {} evacuate['host'] = host if host if !microversion_newer_than?('2.13') && on_shared_storage evacuate['onSharedStorage'] = on_shared_storage end evacuate['adminPass'] = admin_password if admin_password body = { 'evacuate' => evacuate } server_action(server_id, body) end |
#get_address(address_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_address.rb', line 5 def get_address(address_id) request( :expects => [200], :method => 'GET', :path => "os-floating-ips/#{address_id}" ) end |
#get_aggregate(uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_aggregate.rb', line 5 def get_aggregate(uuid) request( :expects => [200], :method => 'GET', :path => "os-aggregates/#{uuid}" ) end |
#get_console_output(server_id, log_length) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/get_console_output.rb', line 5 def get_console_output(server_id, log_length) body = { 'os-getConsoleOutput' => { 'length' => log_length } } server_action(server_id, body) end |
#get_flavor_details(flavor_ref) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_flavor_details.rb', line 5 def get_flavor_details(flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}" ) end |
#get_flavor_metadata(flavor_ref) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_flavor_metadata.rb', line 5 def (flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}/os-extra_specs" ) end |
#get_host_details(host) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_host_details.rb', line 5 def get_host_details(host) request( :expects => [200, 203], :method => 'GET', :path => "os-hosts/#{host}" ) end |
#get_hypervisor(hypervisor_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_hypervisor.rb', line 5 def get_hypervisor(hypervisor_id) request( :expects => 200, :method => 'GET', :path => "os-hypervisors/#{hypervisor_id}" ) end |
#get_hypervisor_statistics(_tenant_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_hypervisor_statistics.rb', line 5 def get_hypervisor_statistics(_tenant_id) request( :expects => 200, :method => 'GET', :path => "os-hypervisors/statistics" ) end |
#get_image_details(image_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_image_details.rb', line 5 def get_image_details(image_id) request( :expects => [200, 203], :method => 'GET', :path => "images/#{image_id}" ) end |
#get_key_pair(key_name) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_key_pair.rb', line 5 def get_key_pair(key_name) request( :expects => 200, :method => 'GET', :path => "os-keypairs/#{Fog::OpenStack.escape(key_name)}" ) end |
#get_limits(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/get_limits.rb', line 7 def get_limits( = {}) request( :expects => 200, :method => 'GET', :path => '/limits', :query => ) end |
#get_metadata(collection_name, parent_id, key) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_metadata.rb', line 5 def (collection_name, parent_id, key) request( :expects => [200, 203], :method => 'GET', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end |
#get_os_interface(server_id, port_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_os_interface.rb', line 5 def get_os_interface(server_id,port_id) request( :expects => [200, 202, 203], :method => 'GET', :path => "servers/#{server_id}/os-interface/#{port_id}" ) end |
#get_quota(tenant_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_quota.rb', line 5 def get_quota(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}" ) end |
#get_quota_defaults(tenant_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_quota_defaults.rb', line 5 def get_quota_defaults(tenant_id) request( :expects => 200, :method => 'GET', :path => "/os-quota-sets/#{tenant_id}/defaults" ) end |
#get_security_group(security_group_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_security_group.rb', line 5 def get_security_group(security_group_id) request( :expects => [200], :method => 'GET', :path => "os-security-groups/#{security_group_id}" ) end |
#get_security_group_rule(security_group_rule_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_security_group_rule.rb', line 5 def get_security_group_rule(security_group_rule_id) request( :expects => [200], :method => 'GET', :path => "os-security-group-rules/#{security_group_rule_id}" ) end |
#get_server_details(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_server_details.rb', line 5 def get_server_details(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}" ) end |
#get_server_group(group_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_server_group.rb', line 5 def get_server_group(group_id) request( :expects => 200, :method => 'GET', :path => "/os-server-groups/#{group_id}" ) end |
#get_server_password(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_server_password.rb', line 5 def get_server_password(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/os-server-password" ) end |
#get_server_volumes(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_server_volumes.rb', line 5 def get_server_volumes(server_id) request( :expects => 200, :method => 'GET', :path => "servers/#{server_id}/os-volume_attachments" ) end |
#get_snapshot_details(snapshot_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_snapshot_details.rb', line 5 def get_snapshot_details(snapshot_id) request( :expects => 200, :method => 'GET', :path => "os-snapshots/#{snapshot_id}" ) end |
#get_usage(tenant_id, date_start, date_end) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/openstack/compute/requests/get_usage.rb', line 5 def get_usage(tenant_id, date_start, date_end) params = {} params[:start] = date_start.utc.iso8601.chop! params[:end] = date_end.utc.iso8601.chop! request( :expects => [200, 203], :method => 'GET', :path => "os-simple-tenant-usage/#{tenant_id}", :query => params ) end |
#get_vnc_console(server_id, console_type) ⇒ Object
Get a vnc console for an instance. For microversion < 2.6 as it has been replaced with remote-consoles
Parameters
-
server_id <~String> - The ID of the server.
-
console_type <~String> - Type of vnc console to get (‘novnc’ or ‘xvpvnc’).
Returns
-
response <~Excon::Response>:
-
body <~Hash>:
-
url <~String>
-
type <~String>
-
-
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/openstack/compute/requests/get_vnc_console.rb', line 16 def get_vnc_console(server_id, console_type) fixed_microversion = nil if microversion_newer_than?('2.5') fixed_microversion = @microversion @microversion = '2.5' end body = { 'os-getVNCConsole' => { 'type' => console_type } } result = server_action(server_id, body) @microversion = fixed_microversion if fixed_microversion result end |
#get_volume_details(volume_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/get_volume_details.rb', line 5 def get_volume_details(volume_id) request( :expects => 200, :method => 'GET', :path => "os-volumes/#{volume_id}" ) end |
#list_address_pools ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_address_pools.rb', line 5 def list_address_pools request( :expects => [200, 203], :method => 'GET', :path => "os-floating-ip-pools" ) end |
#list_addresses(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_addresses.rb', line 5 def list_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips" ) end |
#list_aggregates(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_aggregates.rb', line 5 def list_aggregates( = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-aggregates', :query => ) end |
#list_all_addresses(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_all_addresses.rb', line 5 def list_all_addresses( = {}) request( :expects => [200, 203], :method => 'GET', :path => "os-floating-ips", :query => ) end |
#list_availability_zones(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/list_availability_zones.rb', line 5 def list_availability_zones( = {}) params = request( :expects => [200], :method => 'GET', :path => "os-availability-zone", :query => params ) end |
#list_flavors(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_flavors.rb', line 5 def list_flavors( = {}) request( :expects => [200, 203], :method => 'GET', :path => 'flavors', :query => ) end |
#list_flavors_detail(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_flavors_detail.rb', line 5 def list_flavors_detail( = {}) request( :expects => [200, 203], :method => 'GET', :path => 'flavors/detail', :query => ) end |
#list_hosts(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_hosts.rb', line 5 def list_hosts( = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-hosts', :query => ) end |
#list_hypervisor_servers(hypervisor_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_hypervisor_servers.rb', line 5 def list_hypervisor_servers(hypervisor_id, = {}) request( :expects => 200, :method => 'GET', :path => "os-hypervisors/#{hypervisor_id}/servers", :query => ) end |
#list_hypervisors(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_hypervisors.rb', line 5 def list_hypervisors( = {}) request( :expects => 200, :method => 'GET', :path => 'os-hypervisors', :query => ) end |
#list_hypervisors_detail(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_hypervisors_detail.rb', line 5 def list_hypervisors_detail( = {}) request( :expects => 200, :method => 'GET', :path => 'os-hypervisors/detail', :query => ) end |
#list_images ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_images.rb', line 5 def list_images request( :expects => [200, 203], :method => 'GET', :path => 'images' ) end |
#list_images_detail(filters = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_images_detail.rb', line 5 def list_images_detail(filters = {}) request( :expects => [200, 203], :method => 'GET', :path => 'images/detail', :query => filters ) end |
#list_key_pairs(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_key_pairs.rb', line 5 def list_key_pairs( = {}) request( :expects => [200, 203], :method => 'GET', :path => 'os-keypairs', :query => ) end |
#list_metadata(collection_name, parent_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_metadata.rb', line 5 def (collection_name, parent_id) request( :expects => [200, 203], :method => 'GET', :path => "/#{collection_name}/#{parent_id}/metadata" ) end |
#list_os_interfaces(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_os_interfaces.rb', line 5 def list_os_interfaces(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/os-interface" ) end |
#list_private_addresses(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_private_addresses.rb', line 5 def list_private_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips/private" ) end |
#list_public_addresses(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_public_addresses.rb', line 5 def list_public_addresses(server_id) request( :expects => [200, 203], :method => 'GET', :path => "servers/#{server_id}/ips/public" ) end |
#list_security_groups(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/openstack/compute/requests/list_security_groups.rb', line 5 def list_security_groups( = {}) path = "os-security-groups" if .kind_of?(Hash) server_id = .delete(:server_id) query = else # Backwards compatibility layer, only server_id was passed as first parameter previously Fog::Logger.deprecation('Calling OpenStack[:compute].list_security_groups(server_id) is deprecated, use .list_security_groups(:server_id => value) instead') server_id = query = {} end if server_id path = "servers/#{server_id}/#{path}" end request( :expects => [200], :method => 'GET', :path => path, :query => query ) end |
#list_server_groups(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_server_groups.rb', line 5 def list_server_groups( = {}) request( :expects => 200, :method => 'GET', :path => 'os-server-groups', :query => ) end |
#list_servers(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/fog/openstack/compute/requests/list_servers.rb', line 5 def list_servers( = {}) params = .dup if params[:all_tenants] params['all_tenants'] = 'True' params.delete(:all_tenants) end request( :expects => [200, 203], :method => 'GET', :path => 'servers', :query => params ) end |
#list_servers_detail(options = {}) ⇒ Object
Available filters: name, status, image, flavor, changes_since, reservation_id
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/openstack/compute/requests/list_servers_detail.rb', line 6 def list_servers_detail( = {}) params = .dup if params[:all_tenants] params['all_tenants'] = 'True' params.delete(:all_tenants) end request( :expects => [200, 203], :method => 'GET', :path => 'servers/detail', :query => params ) end |
#list_services(parameters = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_services.rb', line 5 def list_services(parameters = nil) request( :expects => [200, 203], :method => 'GET', :path => 'os-services', :query => parameters ) end |
#list_snapshots(options = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/openstack/compute/requests/list_snapshots.rb', line 5 def list_snapshots( = true) if .kind_of?(Hash) path = 'os-snapshots' query = else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(true) is deprecated, use .list_snapshots_detail instead') else Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(false) is deprecated, use .list_snapshots({}) instead') end path = ? 'os-snapshots/detail' : 'os-snapshots' query = {} end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end |
#list_snapshots_detail(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_snapshots_detail.rb', line 5 def list_snapshots_detail( = {}) request( :expects => 200, :method => 'GET', :path => 'os-snapshots/detail', :query => ) end |
#list_tenants_with_flavor_access(flavor_ref) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_tenants_with_flavor_access.rb', line 5 def list_tenants_with_flavor_access(flavor_ref) request( :expects => [200, 203], :method => 'GET', :path => "flavors/#{flavor_ref}/os-flavor-access" ) end |
#list_usages(date_start = nil, date_end = nil, detailed = false) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fog/openstack/compute/requests/list_usages.rb', line 5 def list_usages(date_start = nil, date_end = nil, detailed = false) params = {} params[:start] = date_start.iso8601.gsub(/\+.*/, '') if date_start params[:end] = date_end.iso8601.gsub(/\+.*/, '') if date_end params[:detailed] = (detailed ? '1' : '0') if detailed request( :expects => [200, 203], :method => 'GET', :path => 'os-simple-tenant-usage', :query => params ) end |
#list_volume_attachments(server_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/list_volume_attachments.rb', line 5 def (server_id) request( :expects => 200, :method => 'GET', :path => format('servers/%s/os-volume_attachments', server_id) ) end |
#list_volumes(options = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/openstack/compute/requests/list_volumes.rb', line 5 def list_volumes( = true) if .kind_of?(Hash) path = 'os-volumes' query = else # Backwards compatibility layer, when 'detailed' boolean was sent as first param if Fog::Logger.deprecation('Calling OpenStack[:compute].list_volumes(true) is deprecated, use .list_volumes_detail instead') else Fog::Logger.deprecation('Calling OpenStack[:compute].list_volumes(false) is deprecated, use .list_volumes({}) instead') end path = ? 'os-volumes/detail' : 'os-volumes' query = {} end request( :expects => 200, :method => 'GET', :path => path, :query => query ) end |
#list_volumes_detail(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_volumes_detail.rb', line 5 def list_volumes_detail( = {}) request( :expects => 200, :method => 'GET', :path => 'os-volumes/detail', :query => ) end |
#list_zones(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_zones.rb', line 5 def list_zones( = {}) request( :expects => 200, :method => 'GET', :path => 'os-availability-zone', :query => ) end |
#list_zones_detailed(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/list_zones_detailed.rb', line 5 def list_zones_detailed( = {}) request( :expects => 200, :method => 'GET', :path => 'os-availability-zone/detail', :query => ) end |
#live_migrate_server(server_id, host, block_migration, disk_over_commit) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/live_migrate_server.rb', line 5 def live_migrate_server(server_id, host, block_migration, disk_over_commit) body = { 'os-migrateLive' => { 'host' => host, 'block_migration' => block_migration, 'disk_over_commit' => disk_over_commit, } } server_action(server_id, body) end |
#migrate_server(server_id) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/migrate_server.rb', line 5 def migrate_server(server_id) body = {'migrate' => nil} server_action(server_id, body) end |
#pause_server(server_id) ⇒ Object
Pause the server.
Parameters
-
server_id <~String> - The ID of the server to pause.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/pause_server.rb', line 11 def pause_server(server_id) body = {'pause' => nil} server_action(server_id, body).status == 202 end |
#reboot_server(server_id, type = 'SOFT') ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/reboot_server.rb', line 5 def reboot_server(server_id, type = 'SOFT') body = {'reboot' => {'type' => type}} server_action(server_id, body) end |
#rebuild_server(server_id, image_ref, name, admin_pass = nil, metadata = nil, personality = nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/openstack/compute/requests/rebuild_server.rb', line 5 def rebuild_server(server_id, image_ref, name, admin_pass = nil, = nil, personality = nil) body = {'rebuild' => { 'imageRef' => image_ref, 'name' => name }} body['rebuild']['adminPass'] = admin_pass if admin_pass body['rebuild']['metadata'] = if if personality body['rebuild']['personality'] = [] personality.each do |file| body['rebuild']['personality'] << { 'contents' => Base64.encode64(file['contents']), 'path' => file['path'] } end end server_action(server_id, body, 202) end |
#release_address(address_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/openstack/compute/requests/release_address.rb', line 5 def release_address(address_id) request( :expects => [200, 202], :method => 'DELETE', :path => "os-floating-ips/#{address_id}" ) end |
#remote_consoles(server_id, protocol, type) ⇒ Object
Get a vnc console for an instance. For microversion >= 2.6
Parameters
-
server_id <~String> - The ID of the server.
-
protocol <~String> - The protocol of remote console. The valid values are vnc, spice, rdp, serial and mks. The protocol mks is added since Microversion 2.8.
-
type <~String> - The type of remote console. The valid values are novnc, xvpvnc, rdp-html5, spice-html5, serial, and webmks. The type webmks is added since Microversion 2.8.
Returns
-
response <~Excon::Response>:
-
body <~Hash>:
-
url <~String>
-
type <~String>
-
protocol <~String>
-
-
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fog/openstack/compute/requests/remote_consoles.rb', line 20 def remote_consoles(server_id, protocol, type) if microversion_newer_than?('2.6') body = { 'remote_console' => { 'protocol' => protocol, 'type' => type } } request( :body => Fog::JSON.encode(body), :expects => 200, :method => 'POST', :path => "servers/#{server_id}/remote-consoles" ) end end |
#remove_aggregate_host(uuid, host_uuid) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/openstack/compute/requests/remove_aggregate_host.rb', line 5 def remove_aggregate_host(uuid, host_uuid) data = {'remove_host' => {'host' => host_uuid}} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end |
#remove_fixed_ip(server_id, address) ⇒ Object
Remove an IP address.
Parameters
-
server_id <~String> - The ID of the server in which to remove an IP from.
-
address <~String> - The IP address to be removed.
Returns
-
success <~Boolean>
12 13 14 15 16 17 18 19 |
# File 'lib/fog/openstack/compute/requests/remove_fixed_ip.rb', line 12 def remove_fixed_ip(server_id, address) body = { 'removeFixedIp' => { 'address' => address } } server_action(server_id, body).status == 202 end |
#remove_flavor_access(flavor_ref, tenant_id) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/remove_flavor_access.rb', line 5 def remove_flavor_access(flavor_ref, tenant_id) request( :body => Fog::JSON.encode("removeTenantAccess" => { "tenant" => tenant_id.to_s }), :expects => [200, 203], :method => 'POST', :path => "flavors/#{flavor_ref}/action" ) end |
#remove_security_group(server_id, group_name) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/remove_security_group.rb', line 5 def remove_security_group(server_id, group_name) body = {'removeSecurityGroup' => {"name" => group_name}} server_action(server_id, body) end |
#rescue_server(server_id) ⇒ Object
Rescue the server.
Parameters
-
server_id <~String> - The ID of the server to be rescued.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/rescue_server.rb', line 11 def rescue_server(server_id) body = {'rescue' => nil} server_action(server_id, body) == 202 end |
#reset_server_state(server_id, status) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/reset_server_state.rb', line 5 def reset_server_state(server_id, status) body = {'os-resetState' => {'state' => status}} server_action(server_id, body, 202) end |
#resize_server(server_id, flavor_ref) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/resize_server.rb', line 5 def resize_server(server_id, flavor_ref) body = {'resize' => {'flavorRef' => flavor_ref}} server_action(server_id, body) end |
#resume_server(server_id) ⇒ Object
Resume the server.
Parameters
-
server_id <~String> - The ID of the server to be resumed.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/resume_server.rb', line 11 def resume_server(server_id) body = {'resume' => nil} server_action(server_id, body).status == 202 end |
#revert_resize_server(server_id) ⇒ Object
5 6 7 8 |
# File 'lib/fog/openstack/compute/requests/revert_resize_server.rb', line 5 def revert_resize_server(server_id) body = {'revertResize' => nil} server_action(server_id, body) end |
#server_action(server_id, body, expects = [200, 202]) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/server_action.rb', line 5 def server_action(server_id, body, expects = [200, 202]) request( :body => Fog::JSON.encode(body), :expects => expects, :method => 'POST', :path => "servers/#{server_id}/action" ) end |
#server_actions(server_id) ⇒ Object
Retrieve server actions.
Parameters
-
server_id <~String> - The ID of the server to query for available actions.
Returns
-
actions <~Array>
11 12 13 14 15 16 17 |
# File 'lib/fog/openstack/compute/requests/server_actions.rb', line 11 def server_actions(server_id) request( :expects => 200, :method => 'GET', :path => "servers/#{server_id}/os-instance-actions" ).body['instanceActions'] end |
#server_diagnostics(server_id) ⇒ Object
Retrieve server diagnostics.
Parameters
-
server_id <~String> - The ID of the server to retrieve diagnostics.
Returns
-
actions <~Array>
11 12 13 14 15 16 |
# File 'lib/fog/openstack/compute/requests/server_diagnostics.rb', line 11 def server_diagnostics(server_id) request( :method => 'GET', :path => "servers/#{server_id}/diagnostics" ) end |
#set_metadata(collection_name, parent_id, metadata = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/set_metadata.rb', line 5 def (collection_name, parent_id, = {}) request( :body => Fog::JSON.encode('metadata' => ), :expects => 200, :method => 'PUT', :path => "#{collection_name}/#{parent_id}/metadata" ) end |
#set_tenant(tenant) ⇒ Object
5 6 7 8 9 |
# File 'lib/fog/openstack/compute/requests/set_tenant.rb', line 5 def set_tenant(tenant) @openstack_must_reauthenticate = true @openstack_tenant = tenant.to_s authenticate end |
#shelve_offload_server(server_id) ⇒ Object
Shelve Off load the server. Data and resource associations are deleted.
Parameters
-
server_id <~String> - The ID of the server to be shelve off loaded
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/shelve_offload_server.rb', line 11 def shelve_offload_server(server_id) body = {'shelveOffload' => nil} server_action(server_id, body).status == 202 end |
#shelve_server(server_id) ⇒ Object
Shelve the server.
Parameters
-
server_id <~String> - The ID of the server to be shelved
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/shelve_server.rb', line 11 def shelve_server(server_id) body = {'shelve' => nil} server_action(server_id, body).status == 202 end |
#start_server(server_id) ⇒ Object
Start the server.
Parameters
-
server_id <~String> - The ID of the server to be started.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/start_server.rb', line 11 def start_server(server_id) body = {'os-start' => nil} server_action(server_id, body).status == 202 end |
#stop_server(server_id) ⇒ Object
Stop the server.
Parameters
-
server_id <~String> - The ID of the server to be stopped.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/stop_server.rb', line 11 def stop_server(server_id) body = {'os-stop' => nil} server_action(server_id, body).status == 202 end |
#suspend_server(server_id) ⇒ Object
Suspend the server.
Parameters
-
server_id <~String> - The ID of the server to suspend.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/suspend_server.rb', line 11 def suspend_server(server_id) body = {'suspend' => nil} server_action(server_id, body).status == 202 end |
#unpause_server(server_id) ⇒ Object
Unpause the server.
Parameters
-
server_id <~String> - The ID of the server to unpause.
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/unpause_server.rb', line 11 def unpause_server(server_id) body = {'unpause' => nil} server_action(server_id, body).status == 202 end |
#unshelve_server(server_id) ⇒ Object
Unshelve the server.
Parameters
-
server_id <~String> - The ID of the server to be unshelved
Returns
-
success <~Boolean>
11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/unshelve_server.rb', line 11 def unshelve_server(server_id) body = {'unshelve' => nil} server_action(server_id, body).status == 202 end |
#update_aggregate(uuid, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/openstack/compute/requests/update_aggregate.rb', line 5 def update_aggregate(uuid, = {}) = [:name, :availability_zone] data = {'aggregate' => {}} .select { |o| [o] }.each do |key| data['aggregate'][key] = [key] end request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'PUT', :path => "os-aggregates/#{uuid}" ) end |
#update_aggregate_metadata(uuid, metadata = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/fog/openstack/compute/requests/update_aggregate_metadata.rb', line 5 def (uuid, = {}) data = {'set_metadata' => {'metadata' => }} request( :body => Fog::JSON.encode(data), :expects => [200], :method => 'POST', :path => "os-aggregates/#{uuid}/action" ) end |
#update_flavor_metadata(flavor_ref, key, value) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/openstack/compute/requests/update_flavor_metadata.rb', line 5 def (flavor_ref, key, value) data = {key => value} request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "flavors/#{flavor_ref}/os-extra_specs/#{key}" ) end |
#update_meta(collection_name, parent_id, key, value) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/update_meta.rb', line 5 def (collection_name, parent_id, key, value) request( :body => Fog::JSON.encode('meta' => {key => value}), :expects => 200, :method => 'PUT', :path => "#{collection_name}/#{parent_id}/metadata/#{key}" ) end |
#update_metadata(collection_name, parent_id, metadata = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/update_metadata.rb', line 5 def (collection_name, parent_id, = {}) request( :body => Fog::JSON.encode('metadata' => ), :expects => 200, :method => 'POST', :path => "#{collection_name}/#{parent_id}/metadata" ) end |
#update_quota(tenant_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/update_quota.rb', line 5 def update_quota(tenant_id, = {}) request( :body => Fog::JSON.encode('quota_set' => ), :expects => 200, :method => 'PUT', :path => "/os-quota-sets/#{tenant_id}" ) end |
#update_server(server_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/openstack/compute/requests/update_server.rb', line 5 def update_server(server_id, = {}) request( :body => Fog::JSON.encode('server' => ), :expects => 200, :method => 'PUT', :path => "servers/#{server_id}" ) end |