Module: Fog::Vcloud::Terremark::Ecloud::Mock
- Defined in:
- lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb
Instance Method Summary collapse
-
#get_vdc(vdc_uri) ⇒ Object
Based off of: support.theenterprisecloud.com/kb/default.asp?id=545&Lang=1&SID=.
Instance Method Details
#get_vdc(vdc_uri) ⇒ Object
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 |
# File 'lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb', line 24 def get_vdc(vdc_uri) if vdc = mock_data[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href] == vdc_uri } xml = Builder::XmlMarkup.new mock_it Fog::Parsers::Vcloud::Terremark::Ecloud::GetVdc.new, 200, xml.Vdc(xmlns.merge(:href => vdc[:href], :name => vdc[:name])) { xml.Link(:rel => "down", :href => vdc[:href] + "/catalog", :type => "application/vnd.vmware.vcloud.catalog+xml", :name => vdc[:name]) xml.Link(:rel => "down", :href => vdc[:href].gsub('/vdc','/extensions/vdc') + "/publicIps", :type => "application/vnd.tmrk.ecloud.publicIpsList+xml", :name => "Public IPs") xml.Link(:rel => "down", :href => vdc[:href] + "/internetServices", :type => "application/vnd.tmrk.ecloud.internetServicesList+xml", :name => "Internet Services") xml.Link(:rel => "down", :href => vdc[:href].sub('/vdc','/extensions/vdc') + "/firewallAcls", :type => "application/vnd.tmrk.ecloud.firewallAclsList+xml", :name => "Firewall Access List") xml.Description("") xml.StorageCapacity { xml.Units("bytes * 10^9") xml.Allocated(vdc[:storage][:allocated]) xml.Used(vdc[:storage][:used]) } xml.ComputeCapacity { xml.Cpu { xml.Units("hz * 10^6") xml.Allocated(vdc[:cpu][:allocated]) } xml.Memory { xml.Units("bytes * 2^20") xml.Allocated(vdc[:memory][:allocated]) } xml.DeployedVmsQuota { xml.Limit("-1") xml.Used("-1") } xml.InstantiatedVmsQuota { xml.Limit("-1") xml.Used("-1") } } xml.ResourceEntities { vdc[:vms].each do |vm| xml.ResourceEntity(:href => vm[:href], :type => "application/vnd.vmware.vcloud.vApp+xml", :name => vm[:name]) end } xml.AvailableNetworks { vdc[:networks].each do |network| xml.Network(:href => network[:href], :type => "application/vnd.vmware.vcloud.network+xml", :name => network[:name]) end } }, { 'Content-Type' => 'application/vnd.vmware.vcloud.vdc+xml'} else mock_error 200, "401 Unauthorized" end end |