fog 0.0.93 → 0.0.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +2 -1
- data/Gemfile.lock +13 -7
- data/bin/fog +6 -0
- data/fog.gemspec +40 -3
- data/lib/fog.rb +2 -1
- data/lib/fog/aws.rb +12 -8
- data/lib/fog/aws/parsers/s3/get_bucket_logging.rb +40 -0
- data/lib/fog/aws/parsers/s3/get_bucket_object_versions.rb +88 -0
- data/lib/fog/aws/parsers/s3/get_bucket_versioning.rb +24 -0
- data/lib/fog/aws/requests/ec2/associate_address.rb +3 -0
- data/lib/fog/aws/requests/ec2/describe_instances.rb +4 -3
- data/lib/fog/aws/requests/ec2/disassociate_address.rb +4 -0
- data/lib/fog/aws/requests/s3/get_bucket.rb +6 -5
- data/lib/fog/aws/requests/s3/get_bucket_logging.rb +53 -0
- data/lib/fog/aws/requests/s3/get_bucket_object_versions.rb +83 -0
- data/lib/fog/aws/requests/s3/get_bucket_versioning.rb +43 -0
- data/lib/fog/aws/requests/s3/get_object.rb +6 -1
- data/lib/fog/aws/requests/s3/get_object_acl.rb +8 -2
- data/lib/fog/aws/requests/s3/head_object.rb +4 -1
- data/lib/fog/aws/requests/s3/put_bucket_acl.rb +1 -1
- data/lib/fog/aws/requests/s3/put_bucket_logging.rb +87 -0
- data/lib/fog/aws/requests/s3/put_bucket_versioning.rb +40 -0
- data/lib/fog/aws/s3.rb +9 -1
- data/lib/fog/bin.rb +1 -1
- data/lib/fog/credentials.rb +6 -2
- data/lib/fog/vcloud.rb +288 -0
- data/lib/fog/vcloud/bin.rb +57 -0
- data/lib/fog/vcloud/parser.rb +34 -0
- data/lib/fog/vcloud/parsers/get_organization.rb +37 -0
- data/lib/fog/vcloud/parsers/get_vdc.rb +37 -0
- data/lib/fog/vcloud/parsers/get_versions.rb +46 -0
- data/lib/fog/vcloud/parsers/login.rb +40 -0
- data/lib/fog/vcloud/requests/get_organization.rb +55 -0
- data/lib/fog/vcloud/requests/get_vdc.rb +59 -0
- data/lib/fog/vcloud/requests/get_versions.rb +43 -0
- data/lib/fog/vcloud/requests/login.rb +46 -0
- data/lib/fog/vcloud/terremark/all.rb +9 -0
- data/lib/fog/vcloud/terremark/ecloud.rb +47 -0
- data/lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb +59 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vdc.rb +94 -0
- data/lib/fog/vcloud/terremark/ecloud/requests/login.rb +27 -0
- data/lib/fog/vcloud/terremark/vcloud.rb +43 -0
- data/lib/fog/vcloud/terremark/vcloud/parsers/get_vdc.rb +34 -0
- data/lib/fog/vcloud/terremark/vcloud/requests/get_vdc.rb +65 -0
- data/spec/aws/requests/ec2/describe_instances_spec.rb +4 -4
- data/spec/spec_helper.rb +3 -1
- data/spec/vcloud/bin_spec.rb +31 -0
- data/spec/vcloud/requests/get_organization_spec.rb +46 -0
- data/spec/vcloud/requests/get_vdc_spec.rb +50 -0
- data/spec/vcloud/requests/get_versions_spec.rb +28 -0
- data/spec/vcloud/requests/login_spec.rb +8 -0
- data/spec/vcloud/spec_helper.rb +184 -0
- data/spec/vcloud/terremark/ecloud/requests/get_vdc_spec.rb +135 -0
- data/spec/vcloud/terremark/ecloud/requests/login_spec.rb +7 -0
- data/spec/vcloud/terremark/vcloud/requests/get_vdc_spec.rb +74 -0
- data/spec/vcloud/vcloud_spec.rb +17 -0
- data/tests/aws/requests/ec2/address_tests.rb +3 -0
- metadata +42 -5
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module Vcloud
|
|
4
|
+
|
|
5
|
+
class GetVdc < Fog::Parsers::Vcloud::Base
|
|
6
|
+
#WARNING: Incomplete
|
|
7
|
+
#Based off of:
|
|
8
|
+
#vCloud API Guide v0.9 - Page 27
|
|
9
|
+
|
|
10
|
+
def reset
|
|
11
|
+
@response = Struct::VcloudVdc.new([])
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def start_element(name, attributes)
|
|
15
|
+
@value = ''
|
|
16
|
+
case name
|
|
17
|
+
when 'Link'
|
|
18
|
+
@response.links << generate_link(attributes)
|
|
19
|
+
when 'Vdc'
|
|
20
|
+
handle_root(attributes)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def end_element(name)
|
|
25
|
+
case name
|
|
26
|
+
when "AllocationModel"
|
|
27
|
+
@response.allocation_model = @value
|
|
28
|
+
when "Description"
|
|
29
|
+
@response.description = @value
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module Vcloud
|
|
4
|
+
|
|
5
|
+
class GetVersions < Fog::Parsers::Base
|
|
6
|
+
#
|
|
7
|
+
# Based off of:
|
|
8
|
+
# http://support.theenterprisecloud.com/kb/default.asp?id=535&Lang=1&SID=
|
|
9
|
+
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/02-get-versions.aspx
|
|
10
|
+
# vCloud API Guide v0.9 - Page 89
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
def reset
|
|
14
|
+
@response = []
|
|
15
|
+
@supported = false
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def start_element(name, attributes = {})
|
|
19
|
+
@value = ''
|
|
20
|
+
case name
|
|
21
|
+
when "Version"
|
|
22
|
+
@version = Struct::VcloudVersion.new
|
|
23
|
+
when "SupportedVersions"
|
|
24
|
+
@supported = true
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def end_element(name)
|
|
29
|
+
case name
|
|
30
|
+
when "Version"
|
|
31
|
+
@version.version = @value
|
|
32
|
+
@version.supported = @supported
|
|
33
|
+
when "LoginUrl"
|
|
34
|
+
@version.login_url = @value
|
|
35
|
+
when "VersionInfo"
|
|
36
|
+
@response << @version
|
|
37
|
+
when "SupportedVersions"
|
|
38
|
+
@supported = false
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module Vcloud
|
|
4
|
+
|
|
5
|
+
class Login < Fog::Parsers::Base
|
|
6
|
+
#
|
|
7
|
+
# Based off of:
|
|
8
|
+
# http://support.theenterprisecloud.com/kb/default.asp?id=536&Lang=1&SID=
|
|
9
|
+
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/01-get-login-token.aspx
|
|
10
|
+
# vCloud API Guide v0.9 - Page 17
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
def reset
|
|
14
|
+
@response = Struct::VcloudOrgList.new([])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def start_element(name, attributes)
|
|
18
|
+
@value = ''
|
|
19
|
+
case name
|
|
20
|
+
when 'OrgList'
|
|
21
|
+
until attributes.empty?
|
|
22
|
+
if at = attributes.shift
|
|
23
|
+
if at[0] == "xmlns"
|
|
24
|
+
@response.xmlns = at[1]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
when 'Org'
|
|
29
|
+
organization = Struct::VcloudOrgLink.new
|
|
30
|
+
until attributes.empty?
|
|
31
|
+
organization[attributes.shift.downcase.to_sym] = attributes.shift
|
|
32
|
+
end
|
|
33
|
+
@response.organizations << organization
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Vcloud
|
|
3
|
+
|
|
4
|
+
class Real
|
|
5
|
+
def get_organization(organization_uri)
|
|
6
|
+
response = request(
|
|
7
|
+
:expects => 200,
|
|
8
|
+
:method => 'GET',
|
|
9
|
+
:parser => Fog::Parsers::Vcloud::GetOrganization.new,
|
|
10
|
+
:uri => organization_uri
|
|
11
|
+
)
|
|
12
|
+
response
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Mock
|
|
18
|
+
|
|
19
|
+
def get_organization(organization_uri)
|
|
20
|
+
#
|
|
21
|
+
# Based off of:
|
|
22
|
+
# http://support.theenterprisecloud.com/kb/default.asp?id=540&Lang=1&SID=
|
|
23
|
+
#
|
|
24
|
+
# vCloud API Guide v0.9 - Page 26
|
|
25
|
+
#
|
|
26
|
+
if org = DATA[:organizations].detect { |org| org[:info][:href] == organization_uri.to_s }
|
|
27
|
+
xml = Builder::XmlMarkup.new
|
|
28
|
+
|
|
29
|
+
mock_it Fog::Parsers::Vcloud::GetOrganization.new, 200,
|
|
30
|
+
xml.Org(xmlns.merge(:href => org[:info][:href], :name => org[:info][:name])) {
|
|
31
|
+
|
|
32
|
+
org[:vdcs].each do |vdc|
|
|
33
|
+
xml.Link(:rel => "down",
|
|
34
|
+
:href => vdc[:href],
|
|
35
|
+
:type => "application/vnd.vmware.vcloud.vdc+xml",
|
|
36
|
+
:name => vdc[:name])
|
|
37
|
+
xml.Link(:rel => "down",
|
|
38
|
+
:href => "#{vdc[:href]}/catalog",
|
|
39
|
+
:type => "application/vnd.vmware.vcloud.catalog+xml",
|
|
40
|
+
:name => "#{vdc[:name]} Catalog")
|
|
41
|
+
xml.Link(:rel => "down",
|
|
42
|
+
:href => "#{vdc[:href]}/tasksList",
|
|
43
|
+
:type => "application/vnd.vmware.vcloud.tasksList+xml",
|
|
44
|
+
:name => "#{vdc[:name]} Tasks List")
|
|
45
|
+
end
|
|
46
|
+
},
|
|
47
|
+
{'Content-Type' => "application/vnd.vmware.vcloud.org+xml" }
|
|
48
|
+
else
|
|
49
|
+
mock_error 200, "401 Unauthorized"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Vcloud
|
|
3
|
+
|
|
4
|
+
class Real
|
|
5
|
+
# Get details of a vdc
|
|
6
|
+
def get_vdc(vdc_uri)
|
|
7
|
+
request(
|
|
8
|
+
:expects => 200,
|
|
9
|
+
:method => 'GET',
|
|
10
|
+
:parser => Fog::Parsers::Vcloud::GetVdc.new,
|
|
11
|
+
:uri => vdc_uri
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Mock
|
|
18
|
+
# WARNING: Incomplete
|
|
19
|
+
#Based off of:
|
|
20
|
+
#vCloud API Guide v0.9 - Page 27
|
|
21
|
+
|
|
22
|
+
def get_vdc(vdc_uri)
|
|
23
|
+
if vdc = DATA[:organizations].map { |org| org[:vdcs] }.flatten.detect { |vdc| vdc[:href] == vdc_uri }
|
|
24
|
+
xml = Builder::XmlMarkup.new
|
|
25
|
+
mock_it Fog::Parsers::Vcloud::GetVdc.new, 200,
|
|
26
|
+
xml.Vdc(xmlns.merge(:href => vdc[:href], :name => vdc[:name])) {
|
|
27
|
+
xml.Link(:rel => "up",
|
|
28
|
+
:href => DATA[:organizations].detect { |org| org[:vdcs].detect { |_vdc| vdc[:href] == _vdc[:href] }[:href] == vdc[:href] }[:info][:href],
|
|
29
|
+
:type => "application/vnd.vmware.vcloud.org+xml")
|
|
30
|
+
xml.Link(:rel => "add",
|
|
31
|
+
:href => vdc[:href] + "/action/uploadVAppTemplate",
|
|
32
|
+
:type => "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml")
|
|
33
|
+
xml.Link(:rel => "add",
|
|
34
|
+
:href => vdc[:href] + "/media",
|
|
35
|
+
:type => "application/vnd.vmware.vcloud.media+xml")
|
|
36
|
+
xml.Link(:rel => "add",
|
|
37
|
+
:href => vdc[:href] + "/action/instantiateVAppTemplate",
|
|
38
|
+
:type => "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
|
39
|
+
xml.Link(:rel => "add",
|
|
40
|
+
:type => "application/vnd.vmware.vcloud.cloneVAppParams+xml",
|
|
41
|
+
:href => vdc[:href] + "/action/cloneVApp")
|
|
42
|
+
xml.Link(:rel => "add",
|
|
43
|
+
:type => "application/vnd.vmware.vcloud.captureVAppParams+xml",
|
|
44
|
+
:href => vdc[:href] + "/action/captureVApp")
|
|
45
|
+
xml.Link(:rel => "add",
|
|
46
|
+
:type => "application/vnd.vmware.vcloud.composeVAppParams+xml",
|
|
47
|
+
:href => vdc[:href] + "/action/composeVApp")
|
|
48
|
+
xml.AllocationModel("AllocationPool")
|
|
49
|
+
xml.Description(vdc[:name] + " VDC")
|
|
50
|
+
#FIXME: Incomplete
|
|
51
|
+
}, { 'Content-Type' => 'application/vnd.vmware.vcloud.vdc+xml' }
|
|
52
|
+
else
|
|
53
|
+
mock_error 200, "401 Unauthorized"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Vcloud
|
|
3
|
+
|
|
4
|
+
class Real
|
|
5
|
+
|
|
6
|
+
def get_versions
|
|
7
|
+
unauthenticated_request({
|
|
8
|
+
:expects => 200,
|
|
9
|
+
:method => 'GET',
|
|
10
|
+
:parser => Fog::Parsers::Vcloud::GetVersions.new,
|
|
11
|
+
:uri => @versions_uri
|
|
12
|
+
})
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Mock
|
|
18
|
+
|
|
19
|
+
def get_versions
|
|
20
|
+
#
|
|
21
|
+
# Based off of:
|
|
22
|
+
# http://support.theenterprisecloud.com/kb/default.asp?id=535&Lang=1&SID=
|
|
23
|
+
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/02-get-versions.aspx
|
|
24
|
+
# vCloud API Guide v0.9 - Page 89
|
|
25
|
+
#
|
|
26
|
+
xml = Builder::XmlMarkup.new
|
|
27
|
+
|
|
28
|
+
mock_it Fog::Parsers::Vcloud::GetVersions.new, 200,
|
|
29
|
+
xml.SupportedVersions( xmlns.merge("xmlns" => "http://www.vmware.com/vcloud/versions")) {
|
|
30
|
+
|
|
31
|
+
DATA[:versions].select {|version| version[:supported] }.each do |version|
|
|
32
|
+
xml.VersionInfo {
|
|
33
|
+
xml.Version(version[:version])
|
|
34
|
+
xml.LoginUrl(version[:login_url])
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Vcloud
|
|
3
|
+
|
|
4
|
+
class Real
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def login
|
|
8
|
+
unauthenticated_request({
|
|
9
|
+
:expects => 200,
|
|
10
|
+
:headers => {
|
|
11
|
+
'Authorization' => authorization_header
|
|
12
|
+
},
|
|
13
|
+
:method => 'POST',
|
|
14
|
+
:parser => Fog::Parsers::Vcloud::Login.new,
|
|
15
|
+
:uri => @login_uri
|
|
16
|
+
})
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Mock
|
|
22
|
+
|
|
23
|
+
def login
|
|
24
|
+
#
|
|
25
|
+
# Based off of:
|
|
26
|
+
# http://support.theenterprisecloud.com/kb/default.asp?id=536&Lang=1&SID=
|
|
27
|
+
# https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/01-get-login-token.aspx
|
|
28
|
+
# vCloud API Guide v0.9 - Page 17
|
|
29
|
+
#
|
|
30
|
+
xml = Builder::XmlMarkup.new
|
|
31
|
+
|
|
32
|
+
mock_it Fog::Parsers::Vcloud::Login.new, 200,
|
|
33
|
+
xml.OrgList(xmlns) {
|
|
34
|
+
DATA[:organizations].each do |org|
|
|
35
|
+
xml.Org( org[:info].merge( "type" => "application/vnd.vmware.vcloud.org+xml" ) ) {}
|
|
36
|
+
end
|
|
37
|
+
},
|
|
38
|
+
{ 'Set-Cookie' => 'vcloud-token=fc020a05-21d7-4f33-9b2a-25d8cd05a44e; path=/',
|
|
39
|
+
'Content-Type' => 'application/vnd.vmware.vcloud.orgslist+xml' }
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Vcloud
|
|
3
|
+
module Terremark
|
|
4
|
+
module Ecloud
|
|
5
|
+
|
|
6
|
+
module Versions
|
|
7
|
+
SUPPORTED = ["v0.8", "v0.8a-ext2.0"]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.extended(klass)
|
|
11
|
+
#Do anything we need to do here that's specific to ecloud
|
|
12
|
+
unless @required
|
|
13
|
+
require 'fog/vcloud/terremark/all'
|
|
14
|
+
require 'fog/vcloud/terremark/ecloud/parsers/get_vdc'
|
|
15
|
+
require 'fog/vcloud/terremark/ecloud/requests/login'
|
|
16
|
+
require 'fog/vcloud/terremark/ecloud/requests/get_vdc'
|
|
17
|
+
Struct.new("TmrkEcloudVdc", :links, :resource_entities, :networks,
|
|
18
|
+
:cpu_capacity, :storage_capacity, :memory_capacity, :deployed_vm_quota, :instantiated_vm_quota,
|
|
19
|
+
:href, :type, :name, :xmlns, :description)
|
|
20
|
+
Struct.new("TmrkEcloudXCapacity", :units, :allocated, :used, :limit)
|
|
21
|
+
@required = true
|
|
22
|
+
end
|
|
23
|
+
if Fog.mocking?
|
|
24
|
+
klass.extend Fog::Vcloud::Terremark::Ecloud::Mock
|
|
25
|
+
else
|
|
26
|
+
klass.extend Fog::Vcloud::Terremark::Ecloud::Real
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
# If we don't support any versions the service does, then raise an error.
|
|
33
|
+
# If the @version that super selected isn't in our supported list, then select one that is.
|
|
34
|
+
def check_versions
|
|
35
|
+
super
|
|
36
|
+
unless (supported_version_ids & Versions::SUPPORTED).length > 0
|
|
37
|
+
raise UnsupportedVersion.new("\nService @ #{@versions_uri} supports: #{supported_version_ids.join(', ')}\n" +
|
|
38
|
+
"Fog::Vcloud::Terremark::Ecloud supports: #{Versions::SUPPORTED.join(', ')}")
|
|
39
|
+
end
|
|
40
|
+
unless supported_version_ids.include?(@version)
|
|
41
|
+
@version = (supported_version_ids & Versions::SUPPORTED).sort.first
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Fog
|
|
2
|
+
module Parsers
|
|
3
|
+
module Vcloud
|
|
4
|
+
module Terremark
|
|
5
|
+
module Ecloud
|
|
6
|
+
|
|
7
|
+
class GetVdc < Fog::Parsers::Vcloud::Base
|
|
8
|
+
|
|
9
|
+
def reset
|
|
10
|
+
@target = nil
|
|
11
|
+
@response = Struct::TmrkEcloudVdc.new([],[],[],Struct::TmrkEcloudXCapacity.new,Struct::TmrkEcloudXCapacity.new,
|
|
12
|
+
Struct::TmrkEcloudXCapacity.new,Struct::TmrkEcloudXCapacity.new,
|
|
13
|
+
Struct::TmrkEcloudXCapacity.new)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def start_element(name, attributes)
|
|
17
|
+
@value = ''
|
|
18
|
+
case name
|
|
19
|
+
when 'Cpu'
|
|
20
|
+
@target = :cpu_capacity
|
|
21
|
+
when 'DeployedVmsQuota'
|
|
22
|
+
@target = :deployed_vm_quota
|
|
23
|
+
when 'InstantiatedVmsQuota'
|
|
24
|
+
@target = :instantiated_vm_quota
|
|
25
|
+
when 'Memory'
|
|
26
|
+
@target = :memory_capacity
|
|
27
|
+
when 'StorageCapacity'
|
|
28
|
+
@target = :storage_capacity
|
|
29
|
+
when 'Link'
|
|
30
|
+
@response.links << generate_link(attributes)
|
|
31
|
+
when 'Network'
|
|
32
|
+
@response.networks << generate_link(attributes)
|
|
33
|
+
when 'ResourceEntity'
|
|
34
|
+
@response.resource_entities << generate_link(attributes)
|
|
35
|
+
when 'Vdc'
|
|
36
|
+
handle_root(attributes)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def end_element(name)
|
|
41
|
+
case name
|
|
42
|
+
when 'Allocated', 'Limit', 'Used'
|
|
43
|
+
@response[@target][name.downcase] = @value.to_i
|
|
44
|
+
when 'Units'
|
|
45
|
+
@response[@target][name.downcase] = @value
|
|
46
|
+
when 'Cpu', 'DeployedVmsQuota', 'InstantiatedVmsQuota', 'Memory', 'StorageCapacity'
|
|
47
|
+
@target = nil
|
|
48
|
+
when 'Description'
|
|
49
|
+
@response.description = @value
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|