class Fog::Compute::OneAndOne::Server

Constants

GOOD_STATES

Globals

Public Instance Methods

add_firewall(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 176
def add_firewall(options = {})
  requires :id

  response = service.add_firewall(server_id: id,
                                  ip_id: options[:ip_id],
                                  firewall_id:options[:firewall_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
add_hdds(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 102
def add_hdds(options = {})
  requires :id

  response = service.add_hdds(server_id: id,
                              hdds: options[:hdds])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
add_ip() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 153
def add_ip
  requires :id

  response = service.add_server_ip(server_id: id)

  # Merge Attributes
  merge_attributes(response.body)

  true
end
add_load_balancer(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 201
def add_load_balancer(options = {})
  requires :id

  response = service.add_load_balancer(server_id: id,
                                       ip_id: options[:ip_id],
                                       load_balancer_id: options[:load_balancer_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
add_private_network(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 288
def add_private_network(options = {})
  requires :id

  response = service.add_private_network(server_id: id,
                                         private_network_id: options[:private_network_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
clone(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 347
def clone(options = {})
  requires :id

  response = service.clone_server(server_id: id, name: options[:name],
                                  datacenter_id: options[:datacenter_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
create_snapshot() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 312
def create_snapshot
  requires :id

  response = service.create_snapshot(server_id: id)

  # Merge Attributes
  merge_attributes(response.body)

  true
end
delete_hdd(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 114
def delete_hdd(options = {})
  requires :id

  response = service.delete_hdd(server_id: id,
                                hdd_id: options[:hdd_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
delete_ip(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 164
def delete_ip(options = {})
  requires :id

  response = service.delete_server_ip(server_id: id,
                                      ip_id: options[:ip_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
delete_snapshot(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 335
def delete_snapshot(options = {})
  requires :id

  response = service.delete_snapshot(server_id: id,
                                     snapshot_id: options[:snapshot_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
destroy() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 359
def destroy
  requires :id

  service.delete_server(id)

  true
end
eject_dvd() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 277
def eject_dvd
  requires :id

  response = service.eject_dvd(server_id: id)

  # Merge Attributes
  merge_attributes(response.body)

  true
end
install_image(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 139
def install_image(options = {})
  requires :id

  response = service.install_server_image(server_id: id,
                                          image_id: options[:image_id],
                                          password: options[:password],
                                          firewall_id: options[:firewall_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
load_dvd(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 266
def load_dvd(options = {})
  requires :id

  response = service.load_dvd(server_id: id, dvd_id: options[:dvd_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
off() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 240
def off
  requires :id

  response = service.change_status(server_id: id,
                                   action: 'POWER_OFF',
                                   method: 'SOFTWARE')

  # Merge Attributes
  merge_attributes(response.body)

  true
end
on() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 227
def on
  requires :id

  response = service.change_status(server_id: id,
                                   action: 'POWER_ON',
                                   method: 'SOFTWARE')

  # Merge Attributes
  merge_attributes(response.body)

  true
end
ready?() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 367
def ready?
  (GOOD_STATES.include? status['state']) && status['percent'].nil?
end
reboot() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 253
def reboot
  requires :id

  response = service.change_status(server_id: id,
                                   action: 'REBOOT',
                                   method: 'SOFTWARE')

  # Merge Attributes
  merge_attributes(response.body)

  true
end
remove_firewall(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 189
def remove_firewall(options = {})
  requires :id

  response = service.remove_firewall(server_id: id,
                                     ip_id: options[:ip_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
remove_load_balancer(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 214
def remove_load_balancer(options = {})
  requires :id

  response = service.remove_load_balancer(server_id: id,
                                          ip_id: options[:ip_id],
                                          load_balancer_id: options[:load_balancer_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
remove_private_network(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 300
def remove_private_network(options = {})
  requires :id

  response = service.remove_private_network(server_id: id,
                                            private_network_id: options[:private_network_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
resize_hdd(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 126
def resize_hdd(options = {})
  requires :id

  response = service.update_hdd(server_id: id,
                                hdd_id: options[:hdd_id],
                                size: options[:size])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
restore_snapshot(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 323
def restore_snapshot(options = {})
  requires :id

  response = service.restore_snapshot(server_id: id,
                                      snapshot_id: options[:snapshot_id])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
save() click to toggle source
# File lib/oneandone/models/compute/server.rb, line 47
def save
  server_type ||= 'cloud'

  requires :name, :appliance_id

  # Check for Additional Required Parameters
  if (!fixed_instance_id)
    requires :ram, :vcore, :cores_per_processor, :hdds
  end

  requires :baremetal_model_id if server_type == 'baremetal'

  # Perform Request
  response = service.create_server(name: name, description: description,
    rsa_key: rsa_key, fixed_instance_id: fixed_instance_id,
    vcore: vcore, cores_per_processor: cores_per_processor, ram: ram,
    appliance_id: appliance_id, hdds: hdds, datacenter_id: datacenter_id,
    password: password, power_on: power_on, firewall_id: firewall_id,
    ip_id: ip_id, load_balancer_id: load_balancer_id,
    monitoring_policy_id: monitoring_policy_id, public_key: public_key,
    server_type: server_type, baremetal_model_id: baremetal_model_id)

  # Merge Attributes
  merge_attributes(response.body)

  true
end
update(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 75
def update(options = {})
  requires :id

  response = service.update_server(server_id: id, name: options[:name],
                                   description: options[:description])

  # Merge Attributes
  merge_attributes(response.body)

  true
end
update_hardware(options = {}) click to toggle source
# File lib/oneandone/models/compute/server.rb, line 87
def update_hardware(options = {})
  requires :id

  response = service.update_hardware(server_id: id,
                                     fixed_instance_id: options[:fixed_instance_id],
                                     vcore: options[:vcore],
                                     ram: options[:ram],
                                     cores_per_processor: options[:cores_per_processor])

  # Merge Attributes
  merge_attributes(response.body)

  true
end