Class: VagrantPlugins::VCloud::Model::ForwardedPort
- Inherits:
-
Object
- Object
- VagrantPlugins::VCloud::Model::ForwardedPort
- Defined in:
- lib/vagrant-vcloud/model/forwarded_port.rb
Overview
Represents a single forwarded port for VirtualBox. This has various helpers and defaults for a forwarded port.
Instance Attribute Summary collapse
-
#auto_correct ⇒ Boolean
readonly
If true, this port should be auto-corrected.
-
#edge_network_id ⇒ String
readonly
The id of the parent network.
-
#edge_network_name ⇒ String
readonly
The network name to forward to.
-
#guest_ip ⇒ String
readonly
The IP that the forwarded port will connect to on the guest machine.
-
#guest_port ⇒ Integer
readonly
The port on the guest to be exposed on the host.
-
#host_ip ⇒ String
readonly
The IP that the forwarded port will bind to on the host machine.
-
#host_port ⇒ Integer
readonly
The port on the host used to access the port on the guest.
-
#id ⇒ String
readonly
The unique ID for the forwarded port.
-
#network_name ⇒ String
readonly
The network name to forward from.
-
#protocol ⇒ String
readonly
The protocol to forward.
-
#vmnic_id ⇒ Integer
readonly
The id of the vm nic.
Instance Method Summary collapse
-
#correct_host_port(new_port) ⇒ Object
This corrects the host port and changes it to the given new port.
-
#initialize(id, host_port, guest_port, network_name, edge_network_id, edge_network_name, options) ⇒ ForwardedPort
constructor
A new instance of ForwardedPort.
Constructor Details
#initialize(id, host_port, guest_port, network_name, edge_network_id, edge_network_name, options) ⇒ ForwardedPort
Returns a new instance of ForwardedPort.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 62 def initialize(id, host_port, guest_port, network_name, edge_network_id, edge_network_name, ) @id = id @guest_port = guest_port @host_port = host_port @network_name = network_name @edge_network_id = edge_network_id @edge_network_name = edge_network_name ||= {} @auto_correct = false if .key?(:auto_correct) @auto_correct = [:auto_correct] end @guest_ip = [:guest_ip] || nil @host_ip = [:host_ip] || nil @protocol = [:protocol] || 'tcp' @vmnic_id = [:vmnic_id] || 0 end |
Instance Attribute Details
#auto_correct ⇒ Boolean (readonly)
If true, this port should be auto-corrected.
10 11 12 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 10 def auto_correct @auto_correct end |
#edge_network_id ⇒ String (readonly)
The id of the parent network.
55 56 57 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 55 def edge_network_id @edge_network_id end |
#edge_network_name ⇒ String (readonly)
The network name to forward to.
50 51 52 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 50 def edge_network_name @edge_network_name end |
#guest_ip ⇒ String (readonly)
The IP that the forwarded port will connect to on the guest machine.
25 26 27 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 25 def guest_ip @guest_ip end |
#guest_port ⇒ Integer (readonly)
The port on the guest to be exposed on the host.
30 31 32 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 30 def guest_port @guest_port end |
#host_ip ⇒ String (readonly)
The IP that the forwarded port will bind to on the host machine.
35 36 37 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 35 def host_ip @host_ip end |
#host_port ⇒ Integer (readonly)
The port on the host used to access the port on the guest.
40 41 42 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 40 def host_port @host_port end |
#id ⇒ String (readonly)
The unique ID for the forwarded port.
15 16 17 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 15 def id @id end |
#network_name ⇒ String (readonly)
The network name to forward from.
45 46 47 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 45 def network_name @network_name end |
#protocol ⇒ String (readonly)
The protocol to forward.
20 21 22 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 20 def protocol @protocol end |
#vmnic_id ⇒ Integer (readonly)
The id of the vm nic.
60 61 62 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 60 def vmnic_id @vmnic_id end |
Instance Method Details
#correct_host_port(new_port) ⇒ Object
This corrects the host port and changes it to the given new port.
84 85 86 |
# File 'lib/vagrant-vcloud/model/forwarded_port.rb', line 84 def correct_host_port(new_port) @host_port = new_port end |