Class: Fog::Compute::Ecloud::Environment

Inherits:
Ecloud::Model show all
Defined in:
lib/fog/ecloud/models/compute/environment.rb

Instance Attribute Summary

Attributes inherited from Ecloud::Model

#loaded

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Ecloud::Model

#load_unless_loaded!, #reload

Methods inherited from Model

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

Methods included from Attributes::ClassMethods

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

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

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

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#backup_internet_servicesObject



26
27
28
# File 'lib/fog/ecloud/models/compute/environment.rb', line 26

def backup_internet_services
  @backup_internet_services ||= Fog::Compute::Ecloud::BackupInternetServices.new(:service => service, :href => "#{service.base_path}/backupInternetServices/environments/#{id}")
end

#catalogObject



75
76
77
# File 'lib/fog/ecloud/models/compute/environment.rb', line 75

def catalog
  @catalog = service.catalog(:href => "#{service.base_path}/admin/catalog/organizations/#{organization.id}")
end

#compute_poolsObject



63
64
65
# File 'lib/fog/ecloud/models/compute/environment.rb', line 63

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



89
90
91
92
93
94
95
# File 'lib/fog/ecloud/models/compute/environment.rb', line 89

def create_firewall_acl(options = {})
  options[:uri] = "#{service.base_path}/firewallAcls/environments/#{id}/action/createFirewallAcl"
  options[:permission] ||= "deny"
  options[:protocol] ||= "any"
  data = service.firewall_acls_create(options).body
  acl = Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => data[:href])[0]
end

#create_trusted_network_group(options = {}) ⇒ Object



83
84
85
86
87
# File 'lib/fog/ecloud/models/compute/environment.rb', line 83

def create_trusted_network_group(options = {})
  options[:uri] = "#{service.base_path}/trustedNetworkGroups/environments/#{id}/action/createTrustedNetworkGroup"
  data = service.trusted_network_groups_create(options).body
  tng = Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => data[:href])[0]
end

#firewall_aclsObject



59
60
61
# File 'lib/fog/ecloud/models/compute/environment.rb', line 59

def firewall_acls
  @firewall_acls ||= Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => "#{service.base_path}/firewallAcls/environments/#{id}")
end

#idObject



97
98
99
# File 'lib/fog/ecloud/models/compute/environment.rb', line 97

def id
  href.scan(/\d+/)[0]
end

#internet_servicesObject



18
19
20
# File 'lib/fog/ecloud/models/compute/environment.rb', line 18

def internet_services
  @internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}")
end

#layoutObject



47
48
49
# File 'lib/fog/ecloud/models/compute/environment.rb', line 47

def layout
  @layout ||= self.service.layouts(:href => "#{service.base_path}/layout/environments/#{id}").first
end

#networksObject



30
31
32
# File 'lib/fog/ecloud/models/compute/environment.rb', line 30

def networks
  @networks ||= self.service.networks(:href => "#{service.base_path}/networks/environments/#{id}")
end

#node_servicesObject



22
23
24
# File 'lib/fog/ecloud/models/compute/environment.rb', line 22

def node_services
  @node_services ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}")
end

#organizationObject



101
102
103
104
105
106
107
# File 'lib/fog/ecloud/models/compute/environment.rb', line 101

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_devicesObject



67
68
69
# File 'lib/fog/ecloud/models/compute/environment.rb', line 67

def physical_devices
  @physical_devices ||= Fog::Compute::Ecloud::PhysicalDevices.new(:service => service, :href => "#{service.base_path}/physicalDevices/environments/#{id}")
end

#public_ipsObject



14
15
16
# File 'lib/fog/ecloud/models/compute/environment.rb', line 14

def public_ips
  @public_ips ||= Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => "#{service.base_path}/publicIps/environments/#{id}")
end

#rnatsObject



79
80
81
# File 'lib/fog/ecloud/models/compute/environment.rb', line 79

def rnats
  @rnats ||= Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "#{service.base_path}/rnats/environments/#{id}")
end

#rowsObject



51
52
53
# File 'lib/fog/ecloud/models/compute/environment.rb', line 51

def rows
  @rows ||= layout.rows
end

#serversObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/ecloud/models/compute/environment.rb', line 34

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

#tasksObject



55
56
57
# File 'lib/fog/ecloud/models/compute/environment.rb', line 55

def tasks
  @tasks ||= Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "#{service.base_path}/tasks/environments/#{id}")
end

#trusted_network_groupsObject



71
72
73
# File 'lib/fog/ecloud/models/compute/environment.rb', line 71

def trusted_network_groups
  @trusted_network_groups ||= Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => "#{service.base_path}/trustedNetworkGroups/environments/#{id}")
end