Class: Fog::Compute::Ecloud::Environment
- Inherits:
-
Ecloud::Model
- Object
- Model
- Ecloud::Model
- Fog::Compute::Ecloud::Environment
- Defined in:
- lib/fog/compute/ecloud/models/environment.rb
Instance Attribute Summary
Attributes inherited from Ecloud::Model
Instance Method Summary collapse
- #backup_internet_services ⇒ Object
- #catalog ⇒ Object
- #compute_pools ⇒ Object
- #create_firewall_acl(options = {}) ⇒ Object
- #create_trusted_network_group(options = {}) ⇒ Object
- #firewall_acls ⇒ Object
- #id ⇒ Object
- #internet_services ⇒ Object
- #layout ⇒ Object
- #networks ⇒ Object
- #node_services ⇒ Object
- #organization ⇒ Object
- #physical_devices ⇒ Object
- #public_ips ⇒ Object
- #reload ⇒ Object
- #rnats ⇒ Object
- #rows ⇒ Object
- #servers ⇒ Object
- #tasks ⇒ Object
- #trusted_network_groups ⇒ Object
Methods inherited from Ecloud::Model
Instance Method Details
#backup_internet_services ⇒ Object
25 26 27 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 25 def backup_internet_services @backup_internet_services ||= Fog::Compute::Ecloud::BackupInternetServices.new(:service => service, :href => "#{service.base_path}/backupInternetServices/environments/#{id}") end |
#catalog ⇒ Object
74 75 76 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 74 def catalog @catalog = service.catalog(:href => "#{service.base_path}/admin/catalog/organizations/#{organization.id}") end |
#compute_pools ⇒ Object
62 63 64 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 62 def compute_pools @compute_pools ||= Fog::Compute::Ecloud::ComputePools.new(:service => service, :href => "#{service.base_path}/computePools/environments/#{id}") end |
#create_firewall_acl(options = {}) ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 88 def create_firewall_acl( = {}) [:uri] = "#{service.base_path}/firewallAcls/environments/#{id}/action/createFirewallAcl" [:permission] ||= "deny" [:protocol] ||= "any" data = service.firewall_acls_create().body acl = Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => data[:href])[0] end |
#create_trusted_network_group(options = {}) ⇒ Object
82 83 84 85 86 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 82 def create_trusted_network_group( = {}) [:uri] = "#{service.base_path}/trustedNetworkGroups/environments/#{id}/action/createTrustedNetworkGroup" data = service.trusted_network_groups_create().body tng = Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => data[:href])[0] end |
#firewall_acls ⇒ Object
58 59 60 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 58 def firewall_acls @firewall_acls ||= Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => "#{service.base_path}/firewallAcls/environments/#{id}") end |
#id ⇒ Object
96 97 98 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 96 def id href.scan(/\d+/)[0] end |
#internet_services ⇒ Object
17 18 19 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 17 def internet_services @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}") end |
#layout ⇒ Object
46 47 48 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 46 def layout @layout ||= self.service.layouts(:href => "#{service.base_path}/layout/environments/#{id}").first end |
#networks ⇒ Object
29 30 31 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 29 def networks @networks ||= self.service.networks(:href => "#{service.base_path}/networks/environments/#{id}") end |
#node_services ⇒ Object
21 22 23 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 21 def node_services @node_services ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}") end |
#organization ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 100 def organization @organization ||= begin reload unless other_links organization_link = other_links.find{|l| l[:type] == "application/vnd.tmrk.cloud.organization"} self.service.organizations.new(organization_link) end end |
#physical_devices ⇒ Object
66 67 68 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 66 def physical_devices @physical_devices ||= Fog::Compute::Ecloud::PhysicalDevices.new(:service => service, :href => "#{service.base_path}/physicalDevices/environments/#{id}") end |
#public_ips ⇒ Object
13 14 15 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 13 def public_ips @public_ips ||= Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => "#{service.base_path}/publicIps/environments/#{id}") end |
#reload ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 108 def reload @public_ips = nil @internet_services = nil @node_services = nil @backup_internet_services = nil @networks = nil @layout = nil @rows = nil @tasks = nil @firewall_acls = nil @compute_pools = nil @physical_devices = nil @trusted_network_groups = nil @rnats = nil @organization = nil super end |
#rnats ⇒ Object
78 79 80 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 78 def rnats @rnats ||= Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "#{service.base_path}/rnats/environments/#{id}") end |
#rows ⇒ Object
50 51 52 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 50 def rows @rows ||= layout.rows end |
#servers ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 33 def servers @servers = nil pools = compute_pools pools.each do |c| if pools.index(c) == 0 @servers = c.servers else c.servers.each { |s| @servers << s } end end @servers end |
#tasks ⇒ Object
54 55 56 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 54 def tasks @tasks ||= Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "#{service.base_path}/tasks/environments/#{id}") end |
#trusted_network_groups ⇒ Object
70 71 72 |
# File 'lib/fog/compute/ecloud/models/environment.rb', line 70 def trusted_network_groups @trusted_network_groups ||= Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => "#{service.base_path}/trustedNetworkGroups/environments/#{id}") end |