Class: Bosh::Director::DeploymentPlan::Network
- Includes:
- Bosh::Director::DnsHelper, ValidationHelper
- Defined in:
- lib/bosh/director/deployment_plan/network.rb
Overview
Represents a logical deployment network.
Direct Known Subclasses
Constant Summary collapse
- VALID_DEFAULTS =
%w(dns gateway).sort
Constants included from Bosh::Director::DnsHelper
Bosh::Director::DnsHelper::SOA, Bosh::Director::DnsHelper::TTL_4H, Bosh::Director::DnsHelper::TTL_5M
Instance Attribute Summary collapse
-
#canonical_name ⇒ String
Canonical network name.
-
#deployment ⇒ DeploymentPlan
Associated deployment.
-
#name ⇒ String
Network name.
Instance Method Summary collapse
-
#initialize(deployment, network_spec) ⇒ Network
constructor
Creates a new network.
-
#network_settings(reservation, default_properties = VALID_DEFAULTS) ⇒ Hash
Returns the network settings for the specific reservation.
-
#release(reservation) ⇒ void
Releases a previous reservation that had been fulfilled.
-
#reserve(reservation) ⇒ Boolean
Reserves a network resource.
-
#reserve!(reservation, origin) ⇒ Object
Reserves a network resource, raises an error if reservation failed.
Methods included from ValidationHelper
Methods included from Bosh::Director::DnsHelper
#add_default_dns_server, #canonical, #default_dns_server, #delete_dns_records, #delete_empty_domain, #dns_domain_name, #dns_ns_record, #dns_servers, #invalid_dns, #reverse_domain, #reverse_host, #update_dns_a_record, #update_dns_ptr_record
Constructor Details
#initialize(deployment, network_spec) ⇒ Network
Creates a new network.
27 28 29 30 31 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 27 def initialize(deployment, network_spec) @deployment = deployment @name = safe_property(network_spec, "name", :class => String) @canonical_name = canonical(@name) end |
Instance Attribute Details
#canonical_name ⇒ String
Returns canonical network name.
20 21 22 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 20 def canonical_name @canonical_name end |
#deployment ⇒ DeploymentPlan
Returns associated deployment.
14 15 16 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 14 def deployment @deployment end |
#name ⇒ String
Returns network name.
17 18 19 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 17 def name @name end |
Instance Method Details
#network_settings(reservation, default_properties = VALID_DEFAULTS) ⇒ Hash
Returns the network settings for the specific reservation.
68 69 70 71 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 68 def network_settings(reservation, default_properties = VALID_DEFAULTS) raise NotImplementedError, "#network_settings not implemented for #{self.class}" end |
#release(reservation) ⇒ void
This method returns an undefined value.
Releases a previous reservation that had been fulfilled.
58 59 60 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 58 def release(reservation) raise NotImplementedError, "#release not implemented for #{self.class}" end |
#reserve(reservation) ⇒ Boolean
Reserves a network resource.
Will update the passed in reservation if it can be fulfilled.
50 51 52 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 50 def reserve(reservation) raise NotImplementedError, "#reserve not implemented for #{self.class}" end |
#reserve!(reservation, origin) ⇒ Object
Reserves a network resource, raises an error if reservation failed
37 38 39 40 41 42 |
# File 'lib/bosh/director/deployment_plan/network.rb', line 37 def reserve!(reservation, origin) reserve(reservation) unless reservation.reserved? reservation.handle_error(origin) end end |