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 Also known as: scp_upload



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

#scp_download(remote_path, local_path, download_options = {}) ⇒ Object



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

def scp_download(remote_path, local_path, download_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).download(remote_path, local_path, download_options)
end

#ssh(commands, options = {}) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/fog/compute/models/server.rb', line 27

def ssh(commands, options={})
  require 'net/ssh'
  requires :public_ip_address, :username

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