Class: Fog::Compute::Server

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/models/server.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#scp(local_path, remote_path, upload_options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/fog/compute/models/server.rb', line 7

def scp(local_path, remote_path, upload_options = {})
  require 'net/scp'
  requires :public_ip_address, :username

  scp_options = {}
  scp_options[:key_data] = [private_key] if private_key
  Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options)
end

#ssh(commands) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/fog/compute/models/server.rb', line 16

def ssh(commands)
  require 'net/ssh'
  requires :public_ip_address, :username

  options = {}
  options[:key_data] = [private_key] if private_key
  Fog::SSH.new(public_ip_address, username, options).run(commands)
end