/usr/lib/ruby/vendor_ruby/fog/compute/ecloud/models/environment.rb is in ruby-fog-ecloud 0.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | module Fog
module Compute
class Ecloud
class Environment < Fog::Ecloud::Model
identity :href
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
attribute :name
attribute :type
attribute :other_links, :aliases => :Links, :squash => :Link
def public_ips
@public_ips ||= Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => "#{service.base_path}/publicIps/environments/#{id}")
end
def internet_services
@internet_services ||= Fog::Compute::Ecloud::InternetServices.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}")
end
def node_services
@node_services ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => "#{service.base_path}/networkSummary/environments/#{id}")
end
def backup_internet_services
@backup_internet_services ||= Fog::Compute::Ecloud::BackupInternetServices.new(:service => service, :href => "#{service.base_path}/backupInternetServices/environments/#{id}")
end
def networks
@networks ||= self.service.networks(:href => "#{service.base_path}/networks/environments/#{id}")
end
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
def layout
@layout ||= self.service.layouts(:href => "#{service.base_path}/layout/environments/#{id}").first
end
def rows
@rows ||= layout.rows
end
def tasks
@tasks ||= Fog::Compute::Ecloud::Tasks.new(:service => service, :href => "#{service.base_path}/tasks/environments/#{id}")
end
def firewall_acls
@firewall_acls ||= Fog::Compute::Ecloud::FirewallAcls.new(:service => service, :href => "#{service.base_path}/firewallAcls/environments/#{id}")
end
def compute_pools
@compute_pools ||= Fog::Compute::Ecloud::ComputePools.new(:service => service, :href => "#{service.base_path}/computePools/environments/#{id}")
end
def physical_devices
@physical_devices ||= Fog::Compute::Ecloud::PhysicalDevices.new(:service => service, :href => "#{service.base_path}/physicalDevices/environments/#{id}")
end
def trusted_network_groups
@trusted_network_groups ||= Fog::Compute::Ecloud::TrustedNetworkGroups.new(:service => service, :href => "#{service.base_path}/trustedNetworkGroups/environments/#{id}")
end
def catalog
@catalog = service.catalog(:href => "#{service.base_path}/admin/catalog/organizations/#{organization.id}")
end
def rnats
@rnats ||= Fog::Compute::Ecloud::Rnats.new(:service => service, :href => "#{service.base_path}/rnats/environments/#{id}")
end
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
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
def id
href.scan(/\d+/)[0]
end
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
end
Vdc = Environment
end
end
end
|