Class: Fog::Compute::VcloudDirector::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/vcloud_director/compute.rb,
lib/fog/vcloud_director/requests/compute/get_vdc.rb,
lib/fog/vcloud_director/requests/compute/get_disk.rb,
lib/fog/vcloud_director/requests/compute/get_task.rb,
lib/fog/vcloud_director/requests/compute/get_media.rb,
lib/fog/vcloud_director/requests/compute/get_vcloud.rb,
lib/fog/vcloud_director/requests/compute/delete_disk.rb,
lib/fog/vcloud_director/requests/compute/get_catalog.rb,
lib/fog/vcloud_director/requests/compute/get_network.rb,
lib/fog/vcloud_director/requests/compute/delete_media.rb,
lib/fog/vcloud_director/requests/compute/get_task_list.rb,
lib/fog/vcloud_director/requests/compute/delete_network.rb,
lib/fog/vcloud_director/requests/compute/get_disk_owner.rb,
lib/fog/vcloud_director/requests/compute/get_media_owner.rb,
lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb,
lib/fog/vcloud_director/requests/compute/get_organization.rb,
lib/fog/vcloud_director/requests/compute/post_cancel_task.rb,
lib/fog/vcloud_director/requests/compute/post_clone_media.rb,
lib/fog/vcloud_director/requests/compute/post_upload_disk.rb,
lib/fog/vcloud_director/requests/compute/get_execute_query.rb,
lib/fog/vcloud_director/requests/compute/get_organizations.rb,
lib/fog/vcloud_director/requests/compute/post_upload_media.rb,
lib/fog/vcloud_director/requests/compute/get_current_session.rb,
lib/fog/vcloud_director/requests/compute/get_org_vdc_gateways.rb,
lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb,
lib/fog/vcloud_director/requests/compute/get_supported_versions.rb,
lib/fog/vcloud_director/requests/compute/get_vms_disk_attached_to.rb,
lib/fog/vcloud_director/requests/compute/get_supported_systems_info.rb,
lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb,
lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mock

Returns a new instance of Mock.



660
661
662
663
664
665
666
667
668
669
670
671
672
# File 'lib/fog/vcloud_director/compute.rb', line 660

def initialize(options={})
  @vcloud_director_password = options[:vcloud_director_password]
  @vcloud_director_username = options[:vcloud_director_username]
  #@connection_options = options[:connection_options] || {}
  @host = options[:vcloud_director_host]
  @path = options[:path] || Fog::Compute::VcloudDirector::Defaults::PATH
  @persistent = options[:persistent] || false
  @port = options[:port] || Fog::Compute::VcloudDirector::Defaults::PORT
  @scheme = options[:scheme] || Fog::Compute::VcloudDirector::Defaults::SCHEME
  #@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
  @end_point = "#{@scheme}://#{@host}#{@path}/"
  @api_version = options[:vcloud_director_api_version] || Fog::Compute::VcloudDirector::Defaults::API_VERSION
end

Instance Attribute Details

#api_versionObject (readonly)

Returns the value of attribute api_version.



469
470
471
# File 'lib/fog/vcloud_director/compute.rb', line 469

def api_version
  @api_version
end

#end_pointObject (readonly)

Returns the value of attribute end_point.



469
470
471
# File 'lib/fog/vcloud_director/compute.rb', line 469

def end_point
  @end_point
end

Instance Method Details

#add_id_from_href!(data = {}) ⇒ Object



760
761
762
# File 'lib/fog/vcloud_director/compute.rb', line 760

def add_id_from_href!(data={})
  data[:id] = data[:href].split('/').last
end

#dataObject



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/fog/vcloud_director/compute.rb', line 471

def data
  @@data ||= Hash.new do |hash, key|

    vdc1_uuid = uuid
    vdc2_uuid = uuid
    default_network_uuid = uuid
    uplink_network_uuid  = uuid
    isolated_vdc1_network_uuid = uuid
    isolated_vdc2_network_uuid = uuid

    hash[key] = {
      :catalogs => {
        uuid => {
          :name => 'Default Catalog'
        }
      },
      :catalog_items => {
        uuid => {
          :type => 'vAppTemplate',
          :name => 'vAppTemplate 1'
        }
      },
      :disks => {},
      :edge_gateways => {
        uuid => {
          :name => 'MockEdgeGateway',
          :networks => [uplink_network_uuid, default_network_uuid],
          :vdc => vdc1_uuid,
          :Configuration => {
            :GatewayBackingConfig => "compact",
            :GatewayInterfaces => {
              :GatewayInterface => []},
            :EdgeGatewayServiceConfiguration => {
              :FirewallService => {
                :IsEnabled => "true",
                :DefaultAction => "drop",
                :LogDefaultAction => "false",
                :FirewallRule => []
              },
              :NatService => {:IsEnabled => "true"}},
            :HaEnabled => "false",
            :UseDefaultRouteForDnsRelay => "false"
          }
        }
      },

      :medias => {},

      :networks => {

        default_network_uuid => {
          :IsShared => true,
          :vdc => vdc1_uuid,
          :FenceMode => 'natRouted',
          :ApplyRateLimit => "false",
          :Description => 'Org Network for mocking',
          :Dns1 => '8.8.8.8',
          :Dns2 => '8.8.4.4',
          :DnsSuffix => 'example.com',
          :Gateway => '192.168.1.1',
          :InterfaceType => "internal",
          :IpRanges => [{
            :StartAddress=>'192.168.1.2',
            :EndAddress=>'192.168.1.254'
          }],
          :IsInherited => false,
          :Netmask => '255.255.255.0',
          :name => 'Default Network',
          :SubnetParticipation => {
              :Gateway => "192.168.1.0",
              :Netmask => "255.255.0.0",
              :IpAddress => "192.168.1.0"
          },
          :UseForDefaultRoute => "false"
        },

        isolated_vdc1_network_uuid => {
          :IsShared => false,
          :vdc => vdc1_uuid,
          :ApplyRateLimit => "false",
          :FenceMode => 'isolated',
          :Description => 'Org Network for mocking',
          :Dns1 => '8.8.8.8',
          :Dns2 => '8.8.4.4',
          :DnsSuffix => 'example.com',
          :InterfaceType => "internal",
          :IpRanges => [{
            :StartAddress=>'10.1.0.100',
            :EndAddress=>'10.1.0.200'
          }],
          :IsInherited => false,
          :Netmask => '255.255.255.0',
          :name => 'vDC1 backend network',
          :SubnetParticipation => {
              :Gateway => "192.168.1.0",
              :Netmask => "255.255.0.0",
              :IpAddress => "192.168.1.0"
          },
          :UseForDefaultRoute => "false"
        },

        isolated_vdc2_network_uuid => {
          :IsShared => false,
          :vdc => vdc2_uuid,
          :ApplyRateLimit => "false",
          :Description => 'Org Network for mocking',
          :Dns1 => '8.8.8.8',
          :Dns2 => '8.8.4.4',
          :DnsSuffix => 'example.com',
          :InterfaceType => "internal",
          :IpRanges => [{
            :StartAddress=>'10.2.0.100',
            :EndAddress=>'10.2.0.200'
          }],
          :IsInherited => false,
          :Netmask => '255.255.255.0',
          :name => 'vDC2 backend network',
          :SubnetParticipation => {
              :Gateway => "192.168.1.0",
              :Netmask => "255.255.0.0",
              :IpAddress => "192.168.1.0"
          },
          :UseForDefaultRoute => "false"
        },

        uplink_network_uuid => {
          :IsShared => false,
          :vdc => vdc1_uuid,
          :ApplyRateLimit => "false",
          :FenceMode => 'bridged',
          :Description => 'Uplink Network for mocking',
          :Dns1 => '8.8.8.8',
          :Dns2 => '8.8.4.4',
          :DnsSuffix => 'example.com',
          :Gateway => '198.51.100.1',
          :InterfaceType => "uplink",
          :IpRanges => [{
            :StartAddress=>'198.51.100.2',
            :EndAddress=>'198.51.100.254'
          }],
          :IsInherited => false,
          :Netmask => '255.255.255.0',
          :name => 'uplink Network',
          :SubnetParticipation => {
            :Gateway => "198.51.100.81",
            :Netmask => "255.255.255.248",
            :IpAddress => "198.51.100.83",
            :IpRanges => {
              :IpRange => {
                :StartAddress => "198.51.100.84",
                :EndAddress => "198.51.100.86"
              }
            }
          },
          :UseForDefaultRoute => "true"
        }

      },
      :org => {
        :description => 'Organization for mocking',
        :full_name => 'Mock Organization',
        :name => org_name,
        :uuid => uuid
      },
      :tasks => {},
      :vdc_storage_classes => {
        uuid => {
          :default => true,
          :enabled => true,
          :limit => 2 * 1024 * 1024,
          :name => 'DefaultMockStorageClass',
          :units => 'MB',
          :vdc => vdc1_uuid,
        }
      },
      :vdcs => {
        vdc1_uuid => {
          :description => 'vDC1 for mocking',
          :name => 'MockVDC 1'
        },
        vdc2_uuid => {
          :description => 'vDC2 for mocking',
          :name => 'MockVDC 2'
        },
      }
    }
  end[@vcloud_director_username]
end

#delete_disk(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/delete_disk.rb', line 27

def delete_disk(id)
  unless data[:disks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.disk:#{id})\""
    )
  end

  owner = {
    :href => make_href("disk/#{id}"),
    :type => 'application/vnd.vmware.vcloud.disk+xml'
  }
  task_id = enqueue_task(
    "Deleting Disk(#{id})", 'vdcDeleteDisk', owner,
    :on_success => lambda do
      data[:disks].delete(id)
    end
  )

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
  }.merge(task_body(task_id))

  Excon::Response.new(
    :status => 202,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#delete_media(id) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/fog/vcloud_director/requests/compute/delete_media.rb', line 90

def delete_media(id)
  unless media = data[:medias][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.media:#{id})\""
    )
  end

  owner = {
    :href => make_href("media/#{id}"),
    :type => 'application/vnd.vmware.vcloud.media+xml'
  }
  task_id = enqueue_task(
    "Deleting Media File(#{media[:file][:uuid]})", 'vdcDeleteMedia', owner,
    :on_success => lambda do
      data[:medias].delete(id)
    end
  )
  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
  }.merge(task_body(task_id))

  Excon::Response.new(
    :status => 202,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#delete_network(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/delete_network.rb', line 29

def delete_network(id)

  unless data[:networks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.orgVdcNetwork:#{id})\""
    )
  end

  owner = {
    :href => make_href("network/#{id}"),
    :type => 'application/vnd.vmware.vcloud.network+xml'
  }
  task_id = enqueue_task(
    "Deleting Network(#{id})", 'DeleteNetwork', owner,
    :on_success => lambda do
      data[:networks].delete(id)
    end
  )

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
  }.merge(task_body(task_id))

  Excon::Response.new(
    :status => 202,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#enqueue_task(operation, operation_name, owner, options = {}) ⇒ String

Create a task.

Parameters:

  • operation (String)

    A message describing the operation that is tracked by this task.

  • operation_name (String)

    The short name of the operation that is tracked by this task.

  • owner (Hash)

    Reference to the owner of the task. This is typically the object that the task is creating or updating.

    • :href<~String> - Contains the URI to the entity.

    • :type<~String> - Contains the MIME type of the entity.

Returns:

  • (String)

    Object identifier of the task.



714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/fog/vcloud_director/compute.rb', line 714

def enqueue_task(operation, operation_name, owner, options={})
  task_id = uuid
  now = DateTime.now

  data[:tasks][task_id] = {
    :cancel_requested => false,
    :details => '',
    :expiry_time => now + 86400, # in 24 hours
    :name => 'task',
    :progress => 1,
    :service_namespace => 'com.vmware.vcloud',
    :start_time => now,
    :status => 'running',
  }.merge(options).merge(
    :operation => operation,
    :operation_name => operation_name,
    :owner => owner
  )

  task_id
end

#get_catalog(id) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/vcloud_director/requests/compute/get_catalog.rb', line 29

def get_catalog(id)
  unless catalog = data[:catalogs][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.catalog:#{id})\"."
    )
  end

  Fog::Mock.not_implemented
  catalog.is_used_here # avoid warning from syntax checker
end

#get_current_sessionObject



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
# File 'lib/fog/vcloud_director/requests/compute/get_current_session.rb', line 42

def get_current_session
  body =
    {:href => make_href('session/'),
     :type => 'application/vnd.vmware.vcloud.session+xml',
     :org => data[:org][:name],
     :user => user_name,
     :Link =>
      [{:href => make_href('org/'),
        :type => 'application/vnd.vmware.vcloud.orgList+xml',
        :rel => 'down'},
       {:href => make_href('admin/'),
        :type => 'application/vnd.vmware.admin.vcloud+xml',
        :rel => 'down'},
       {:href => make_href("org/#{data[:org][:uuid]}"),
        :name => data[:org][:name],
        :type => 'application/vnd.vmware.vcloud.org+xml',
        :rel => 'down'},
       {:href => make_href('query'),
        :type => 'application/vnd.vmware.vcloud.query.queryList+xml',
        :rel => 'down'},
       {:href => make_href('entity/'),
        :type => 'application/vnd.vmware.vcloud.entity+xml',
        :rel => 'entityResolver'}]}

  if @api_version.to_f >= 5.1
    body[:Link] << {
      :href => make_href('extensibility'),
      :type => 'application/vnd.vmware.vcloud.apiextensibility+xml',
      :rel => 'down:extensibility'
    }
  end

  Excon::Response.new(
    :body => body,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :status => 200
  )
end

#get_disk(id) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/vcloud_director/requests/compute/get_disk.rb', line 44

def get_disk(id)
  unless data[:disks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(disk_body(id))

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"},
    :body => body
  )
end

#get_disk_owner(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_disk_owner.rb', line 38

def get_disk_owner(id)
  unless data[:disks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
    :Link => {
      :href => make_href("disk/#{id}"),
      :type => 'application/vnd.vmware.vcloud.disk+xml',
      :rel => 'up'
    },
    :User => {
      :href => make_href("admin/user/#{user_uuid}"),
      :name => user_name,
      :type => 'application/vnd.vmware.admin.user+xml',
    }
  }

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"},
    :body => body
  )
end

#get_edge_gateway(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_edge_gateway.rb', line 54

def get_edge_gateway(id)
  unless edge_gateway = data[:edge_gateways][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.gateway:#{id})\""
    )
  end

  vdc_id = edge_gateway[:vdc]
  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :status => "1",
    :name => edge_gateway[:name],
    :id => "urn:vcloud:gateway:#{id}",
    :type => "application/vnd.vmware.admin.edgeGateway+xml",
    :href => make_href("admin/edgeGateway/#{id}"),
    :xsi_schemaLocation => xsi_schema_location,
    :Link =>[{:rel => "up",
              :type => "application/vnd.vmware.vcloud.vdc+xml",
              :href => make_href("vdc/#{vdc_id}")},
             {:rel => "edgeGateway:redeploy",
              :href => make_href("admin/edgeGateway/#{id}/action/redeploy")},
             {:rel => "edgeGateway:configureServices",
              :type => "application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml",
              :href => make_href("admin/edgeGateway/#{id}/action/configureServices")},
             {:rel => "edgeGateway:reapplyServices",
              :href => make_href("admin/edgeGateway/#{id}/action/reapplyServices")},
             {:rel => "edgeGateway:syncSyslogSettings",
              :href => make_href("admin/edgeGateway/#{id}/action/syncSyslogServerSettings")}],
    :Description => "vCloud CI (nft00052i2)",
    :Configuration => edge_gateway[:Configuration].dup
  }

  body[:Configuration][:GatewayInterfaces][:GatewayInterface] += edge_gateway[:networks].map do |network|
    extras = {
      :Network => {
        :type => "application/vnd.vmware.admin.network+xml",
        :name => "anything",
        :href => make_href("admin/network/#{network}")
      },
      :Name => data[:networks][network][:name],
      :DisplayName => data[:networks][network][:name]
    }
    data[:networks][network].merge extras
  end

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_execute_query(type = nil, options = {}) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/fog/vcloud_director/requests/compute/get_execute_query.rb', line 120

def get_execute_query(type=nil, options={})

  unless options[:fields].nil?
    Fog::Mock.not_implemented("Fields are not yet implemented in get_execute_query Mock for #{type}")
  end

  unless options[:format].nil? || options[:format] == 'records'
    Fog::Mock.not_implemented("Formats #{options[:format]} is not yet implemented in get_execute_query Mock for #{type}")
  end

  # NB: default is to sort by 'Database ID' (uuid?). Does this matter?
  unless options[:sortAsc].nil? && options[:sortDesc].nil?
    Fog::Mock.not_implemented("Sorting by field is not yet implemented in get_execute_query Mock for #{type}")
  end

  # NB: default offset is 0
  unless options[:offset].nil?
    Fog::Mock.not_implemented("Offset results are not yet implemented in get_execute_query Mock for #{type}")
  end

  # NB: default page is 1
  if options.key?(:page) && options[:page].to_i != 1
    Fog::Mock.not_implemented("Paginated results are not yet implemented in get_execute_query Mock for #{type}")
  end

  # NB: default pageSize is 25
  unless options[:pageSize].nil?
    Fog::Mock.not_implemented("Paginated results are not yet implemented in get_execute_query Mock for #{type}")
  end

  if type.nil?
    body = all_types
  else 
    body = fetch_items(type, options)
  end

  Excon::Response.new(
    :status  => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body    => body
  )

end

#get_media(id) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/vcloud_director/requests/compute/get_media.rb', line 29

def get_media(id)
  unless data[:medias][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.media:#{id})\"."
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(media_body(id))

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=>#{@api_version}"},
    :body => body
  )
end

#get_media_owner(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_media_owner.rb', line 38

def get_media_owner(id)
  unless data[:medias][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "com.vmware.vcloud.entity.media:%s".' % id
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
    :Link => {
      :href => make_href("media/#{id}"),
      :type => 'application/vnd.vmware.vcloud.media+xml',
      :rel => 'up'
    },
    :User => {
      :href => make_href("admin/user/#{user_uuid}"),
      :name => user_name,
      :type => 'application/vnd.vmware.admin.user+xml',
    }
  }

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{@version}"},
    :body => body
  )
end

#get_network(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_network.rb', line 29

def get_network(id)
  unless network = data[:networks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'This operation is denied.'
    )
  end

  body =
    {:name=>network[:name],
     :href=>make_href("network/#{id}"),
     :type=>"application/vnd.vmware.vcloud.orgNetwork+xml",
     :id=>id,
     :description=>nil,
     :is_inherited=>network[:IsInherited],
     :gateway=>network[:Gateway],
     :netmask=>network[:Netmask],
     :dns1=>network[:Dns1],
     :dns2=>network[:Dns2],
     :dns_suffix=>network[:DnsSuffix]}

  body[:ip_ranges] = network[:IpRanges].map do |ip_range|
    {:start_address=>ip_range[:StartAddress],
     :end_address=>ip_range[:EndAddress]}
  end

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_org_vdc_gateways(vdc_id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_org_vdc_gateways.rb', line 32

def get_org_vdc_gateways(vdc_id)
  unless data[:vdcs][vdc_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
    )
  end

  body =
    {:xmlns => xmlns,
     :xmlns_xsi => xmlns_xsi,
     :total => "1",
     :pageSize => "25",
     :page => "1",
     :name => "edgeGateways",
     :type => "application/vnd.vmware.vcloud.query.records+xml",
     :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=records"),
     :xsi_schemaLocation => xsi_schema_location,
     :Link =>
      [{:rel => "alternate",
        :type => "application/vnd.vmware.vcloud.query.references+xml",
        :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=references")},
       {:rel => "alternate",
        :type => "application/vnd.vmware.vcloud.query.idrecords+xml",
        :href => make_href("admin/vdc/#{vdc_id}edgeGateways?page=1&pageSize=25&format=records")}],
     :EdgeGatewayRecord => []}

  vdc_edge_gateways = data[:edge_gateways].select do |id, edge_gateway|
    edge_gateway[:vdc] == vdc_id
  end

  body[:EdgeGatewayRecord] += vdc_edge_gateways.map do |id, edge_gateway|
    {:vdc => make_href("vdc/#{vdc_id}"),
     :numberOfOrgNetworks => "1",
     :numberOfExtNetworks => "1",
     :name => edge_gateway[:name],
     :isBusy => "false",
     :haStatus => "DISABLED",
     :gatewayStatus => "READY",
     :href => make_href("admin/edgeGateway/#{id}"),
     :isSyslogServerSettingInSync => "true"}
  end

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_organization(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_organization.rb', line 29

def get_organization(id)
  unless id == data[:org][:uuid]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"com.vmware.vcloud.entity.org:#{id}\""
    )
  end
  org = data[:org]

  body =
    {:href=>make_href("org/#{id}"),
     :type=>"application/vnd.vmware.vcloud.org+xml",
     :id=>"urn:vcloud:org:#{id}",
     :name=>org[:name],
     :Link=>
      [{:href=>make_href("tasksList/#{id}"),
        :type=>"application/vnd.vmware.vcloud.tasksList+xml",
        :rel=>"down"},
       {:href=>make_href("admin/org/#{id}/catalogs"),
        :type=>"application/vnd.vmware.admin.catalog+xml",
        :rel=>"add"},
       {:href=>make_href("org/#{id}/metadata"),
        :type=>"application/vnd.vmware.vcloud.metadata+xml",
        :rel=>"down"}],
     :Description=>org[:description]||'',
     :Tasks=>{:Task=>[]},
     :FullName=>org[:full_name]}

  body[:Link] += data[:catalogs].map do |catalog_id, catalog|
    [{:href=>make_href("catalog/#{catalog_id}"),
      :name=>catalog[:name],
      :type=>"application/vnd.vmware.vcloud.catalog+xml",
      :rel=>"down"},
     {:href=>make_href("org/#{id}/catalog/#{catalog_id}/controlAccess/"),
      :type=>"application/vnd.vmware.vcloud.controlAccess+xml",
      :rel=>"down"},
     {:href=>
       make_href("org/#{id}/catalog/#{catalog_id}/action/controlAccess"),
      :type=>"application/vnd.vmware.vcloud.controlAccess+xml",
      :rel=>"controlAccess"}]
  end.flatten

  body[:Link] += data[:networks].map do |network_id, network|
    {:href=>make_href("network/#{network_id}"),
     :name=>network[:name],
     :type=>"application/vnd.vmware.vcloud.orgNetwork+xml",
     :rel=>"down"}
  end

  body[:Link] += data[:vdcs].map do |vdc_id, vdc|
    {:href=>make_href("vdc/#{vdc_id}"),
     :name=>vdc[:name],
     :type=>"application/vnd.vmware.vcloud.vdc+xml",
     :rel=>"down"}
  end

  if api_version.to_f >= 5.1
    body[:Link] <<
      {:href=>make_href('supportedSystemsInfo/'),
       :type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml",
       :rel=>"down"}
  end

  Excon::Response.new(
    :body    => body,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :status  => 200
  )
end

#get_organizationsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/vcloud_director/requests/compute/get_organizations.rb', line 34

def get_organizations
  body =
    {:href=>make_href('org/'),
     :type=>"application/vnd.vmware.vcloud.orgList+xml",
     :Org=>
      [{:href=>make_href("org/#{data[:org][:uuid]}"),
        :name=>data[:org][:name],
        :type=>"application/vnd.vmware.vcloud.org+xml"}]}

  Excon::Response.new(
    :body => body,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :status => 200
  )
end

#get_supported_systems_infoObject



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/fog/vcloud_director/requests/compute/get_supported_systems_info.rb', line 25

def get_supported_systems_info
  body = # this is a subset of the full list
    {:xmlns=>xmlns,
     :xmlns_xsi=>xmlns_xsi,
     :type=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml",
     :href=>make_href('supportedSystemsInfo/'),
     :xsi_schemaLocation=>xsi_schema_location,
     :OperatingSystemFamilyInfo=>
      [{:Name=>"Microsoft Windows",
        :OperatingSystemFamilyId=>"1",
        :OperatingSystem=>
         [{:OperatingSystemId=>"85",
           :DefaultHardDiskAdapterType=>"4",
           :MinimumHardDiskSizeGigabytes=>"40",
           :MinimumMemoryMegabytes=>"512",
           :Name=>"Microsoft Windows Server 2012 (64-bit)",
           :InternalName=>"windows8Server64Guest",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"8",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"true",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"74",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"3",
           :DefaultHardDiskAdapterType=>"4",
           :MinimumHardDiskSizeGigabytes=>"40",
           :MinimumMemoryMegabytes=>"512",
           :Name=>"Microsoft Windows Server 2008 R2 (64-bit)",
           :InternalName=>"windows7Server64Guest",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"true",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"102",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"4",
           :DefaultHardDiskAdapterType=>"4",
           :MinimumHardDiskSizeGigabytes=>"40",
           :MinimumMemoryMegabytes=>"512",
           :Name=>"Microsoft Windows Server 2008 (32-bit)",
           :InternalName=>"winLonghornGuest",
           :Supported=>"true",
           :x64=>"false",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"true",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"73",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"}]},
       {:Name=>"Linux",
        :OperatingSystemFamilyId=>"2",
        :OperatingSystem=>
         [{:OperatingSystemId=>"48",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"64",
           :Name=>"Ubuntu Linux (64-bit)",
           :InternalName=>"ubuntu64Guest",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"94",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"47",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"64",
           :Name=>"Ubuntu Linux (32-bit)",
           :InternalName=>"ubuntuGuest",
           :Supported=>"true",
           :x64=>"false",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"93",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"50",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other 2.6.x Linux (64-bit)",
           :InternalName=>"other26xLinux64Guest",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"7",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"100",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"49",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other 2.6.x Linux (32-bit)",
           :InternalName=>"other26xLinuxGuest",
           :Supported=>"true",
           :x64=>"false",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"7",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"99",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"54",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other Linux (64-bit)",
           :InternalName=>"otherLinux64Guest",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"false",
           :cimOsId=>"101",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"53",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other Linux (32-bit)",
           :InternalName=>"otherLinuxGuest",
           :Supported=>"true",
           :x64=>"false",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"true",
           :PersonalizationAuto=>"true",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"false",
           :cimOsId=>"36",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"}]},
       {:Name=>"Other",
        :OperatingSystemFamilyId=>"3",
        :OperatingSystem=>
         [{:OperatingSystemId=>"68",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other (64-bit)",
           :InternalName=>"otherGuest64",
           :Supported=>"true",
           :x64=>"true",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"false",
           :PersonalizationAuto=>"false",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"102",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"},
          {:OperatingSystemId=>"67",
           :DefaultHardDiskAdapterType=>"3",
           :MinimumHardDiskSizeGigabytes=>"8",
           :MinimumMemoryMegabytes=>"32",
           :Name=>"Other (32-bit)",
           :InternalName=>"otherGuest",
           :Supported=>"true",
           :x64=>"false",
           :MaximumCpuCount=>"64",
           :MinimumHardwareVersion=>"4",
           :PersonalizationEnabled=>"false",
           :PersonalizationAuto=>"false",
           :SysprepPackagingSupported=>"false",
           :SupportsMemHotAdd=>"true",
           :cimOsId=>"1",
           :CimVersion=>"0",
           :SupportedForCreate=>"true"}]}]}

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_supported_versionsObject



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
# File 'lib/fog/vcloud_director/requests/compute/get_supported_versions.rb', line 24

def get_supported_versions
  body =
    {:xmlns=>"http://www.vmware.com/vcloud/versions",
     :xmlns_xsi=>xmlns_xsi,
     :xsi_schemaLocation=>xsi_schema_location,
     :VersionInfo=>
      [{:Version=>"1.5",
        :LoginUrl=>make_href("sessions"),
        :MediaTypeMapping=>
         [{:MediaType=>
            "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
           :ComplexTypeName=>"InstantiateVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwProviderVdcReferences+xml",
           :ComplexTypeName=>"VMWProviderVdcReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.customizationSection+xml",
           :ComplexTypeName=>"CustomizationSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.prepareHostParams+xml",
           :ComplexTypeName=>"PrepareHostParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.relocateVmParams+xml",
           :ComplexTypeName=>"RelocateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.org+xml",
           :ComplexTypeName=>"OrgType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vmwExternalNetworkReferences+xml",
           :ComplexTypeName=>"VMWExternalNetworkReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.networkConnectionSection+xml",
           :ComplexTypeName=>"NetworkConnectionSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.host+xml",
           :ComplexTypeName=>"HostType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.catalogItem+xml",
           :ComplexTypeName=>"CatalogItemType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.owner+xml",
           :ComplexTypeName=>"OwnerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vdc+xml",
           :ComplexTypeName=>"VdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vdc+xml",
           :ComplexTypeName=>"AdminVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.catalog+xml",
           :ComplexTypeName=>"AdminCatalogType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.recomposeVAppParams+xml",
           :ComplexTypeName=>"RecomposeVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml",
           :ComplexTypeName=>"ImportVmIntoExistingVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.taskExtensionRequestUpdateProgressOperationParams+xml",
           :ComplexTypeName=>"TaskExtensionRequestUpdateProgressParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.catalog+xml",
           :ComplexTypeName=>"CatalogType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml",
           :ComplexTypeName=>"CloneVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.providervdc+xml",
           :ComplexTypeName=>"ProviderVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmsObjectRefsList+xml",
           :ComplexTypeName=>"VmObjectRefsListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.undeployVAppParams+xml",
           :ComplexTypeName=>"UndeployVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vdcReferences+xml",
           :ComplexTypeName=>"VdcReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.systemPasswordPolicySettings+xml",
           :ComplexTypeName=>"SystemPasswordPolicySettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vApp+xml",
           :ComplexTypeName=>"VAppType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.taskExtensionRequest+xml",
           :ComplexTypeName=>"TaskExtensionRequestType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vimServerNetworks+xml",
           :ComplexTypeName=>"VimObjectRefListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml",
           :ComplexTypeName=>"VMWProviderVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.orgSettings+xml",
           :ComplexTypeName=>"OrgSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.captureVAppParams+xml",
           :ComplexTypeName=>"CaptureVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.screenTicket+xml",
           :ComplexTypeName=>"ScreenTicketType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.runtimeInfoSection+xml",
           :ComplexTypeName=>"RuntimeInfoSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.tasksList+xml",
           :ComplexTypeName=>"TasksListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.amqpSettingsTest+xml",
           :ComplexTypeName=>"AmqpSettingsTestType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.extensionSettings+xml",
           :ComplexTypeName=>"TaskExtensionSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml",
           :ComplexTypeName=>"ImportVmAsVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationGeneralSettings+xml",
           :ComplexTypeName=>"OrgGeneralSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.registerVimServerParams+xml",
           :ComplexTypeName=>"RegisterVimServerParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.network+xml",
           :ComplexTypeName=>"OrgNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml",
           :ComplexTypeName=>"UploadVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.datastore+xml",
           :ComplexTypeName=>"DatastoreType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.metadata+xml",
           :ComplexTypeName=>"MetadataType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.licensingReportList+xml",
           :ComplexTypeName=>"LicensingReportListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPool+xml",
           :ComplexTypeName=>"VMWNetworkPoolType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.systemSettings+xml",
           :ComplexTypeName=>"SystemSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwHostReferences+xml",
           :ComplexTypeName=>"VMWHostReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.taskExtensionRequestOperationParams+xml",
           :ComplexTypeName=>"TaskExtensionRequestOperationParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.metadata.value+xml",
           :ComplexTypeName=>"MetadataValueType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.taskOperationList+xml",
           :ComplexTypeName=>"TaskOperationListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.media+xml",
           :ComplexTypeName=>"MediaType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.productSections+xml",
           :ComplexTypeName=>"ProductSectionListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.amqpSettings+xml",
           :ComplexTypeName=>"AmqpSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vAppTemplate+xml",
           :ComplexTypeName=>"VAppTemplateType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.deployVAppParams+xml",
           :ComplexTypeName=>"DeployVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.importVmIntoExistingVAppTemplateParams+xml",
           :ComplexTypeName=>"ImportVmIntoExistingVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.resourcePoolList+xml",
           :ComplexTypeName=>"ResourcePoolListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.networkConfigSection+xml",
           :ComplexTypeName=>"NetworkConfigSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml",
           :ComplexTypeName=>"OrganizationResourcePoolSetType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationPasswordPolicySettings+xml",
           :ComplexTypeName=>"OrgPasswordPolicySettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.publishCatalogParams+xml",
           :ComplexTypeName=>"PublishCatalogParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwExtension+xml",
           :ComplexTypeName=>"VMWExtensionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml",
           :ComplexTypeName=>"MediaInsertOrEjectParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vmPendingQuestion+xml",
           :ComplexTypeName=>"VmPendingQuestionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.notificationsSettings+xml",
           :ComplexTypeName=>"NotificationsSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.ldapUserSettings+xml",
           :ComplexTypeName=>"LdapUserAttributesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.right+xml",
           :ComplexTypeName=>"RightType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.ldapSettings+xml",
           :ComplexTypeName=>"LdapSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.organization+xml",
           :ComplexTypeName=>"AdminOrgType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.orgList+xml",
           :ComplexTypeName=>"OrgListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml",
           :ComplexTypeName=>"OrgVAppTemplateLeaseSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwVimServerReferences+xml",
           :ComplexTypeName=>"VMWVimServerReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml",
           :ComplexTypeName=>"VMWExternalNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.entity+xml",
           :ComplexTypeName=>"EntityType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneMediaParams+xml",
           :ComplexTypeName=>"CloneMediaParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.licensingReport+xml",
           :ComplexTypeName=>"LicensingReportType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.importMediaParams+xml",
           :ComplexTypeName=>"ImportMediaParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml",
           :ComplexTypeName=>"UpdateResourcePoolSetParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.taskExtensionRequestList+xml",
           :ComplexTypeName=>"ReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vmPendingAnswer+xml",
           :ComplexTypeName=>"VmQuestionAnswerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
           :ComplexTypeName=>"RasdItemsListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.generalSettings+xml",
           :ComplexTypeName=>"GeneralSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPoolReferences+xml",
           :ComplexTypeName=>"VMWNetworkPoolReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.group+xml",
           :ComplexTypeName=>"GroupType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.controlAccess+xml",
           :ComplexTypeName=>"ControlAccessParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.ldapGroupSettings+xml",
           :ComplexTypeName=>"LdapGroupAttributesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.user+xml",
           :ComplexTypeName=>"UserType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vcloud+xml",
           :ComplexTypeName=>"VCloudType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.uberAdminSettings+xml",
           :ComplexTypeName=>"UberAdminSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwvirtualcenter+xml",
           :ComplexTypeName=>"VimServerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.leaseSettingsSection+xml",
           :ComplexTypeName=>"LeaseSettingsSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.composeVAppParams+xml",
           :ComplexTypeName=>"ComposeVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationEmailSettings+xml",
           :ComplexTypeName=>"OrgEmailSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vm+xml",
           :ComplexTypeName=>"VmType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vmwProviderVdcResourcePoolSet+xml",
           :ComplexTypeName=>"VMWProviderVdcResourcePoolSetType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppParams+xml",
           :ComplexTypeName=>"CloneVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.guestCustomizationSection+xml",
           :ComplexTypeName=>"GuestCustomizationSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.task+xml",
           :ComplexTypeName=>"TaskType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.session+xml",
           :ComplexTypeName=>"SessionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vAppLeaseSettings+xml",
           :ComplexTypeName=>"OrgLeaseSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.importVmAsVAppParams+xml",
           :ComplexTypeName=>"ImportVmAsVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.role+xml",
           :ComplexTypeName=>"RoleType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.rasdItem+xml",
           :ComplexTypeName=>"RASD_Type",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.startupSection+xml",
           :ComplexTypeName=>"StartupSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml",
           :ComplexTypeName=>"VirtualHardwareSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.operatingSystemSection+xml",
           :ComplexTypeName=>"OperatingSystemSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.networkSection+xml",
           :ComplexTypeName=>"NetworkSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vAppNetwork+xml",
           :ComplexTypeName=>"VAppNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.network+xml",
           :ComplexTypeName=>"NetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.orgNetwork+xml",
           :ComplexTypeName=>"OrgNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml",
           :ComplexTypeName=>"VMWExternalNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}]},
       {:Version=>"5.1",
        :LoginUrl=>make_href("sessions"),
        :MediaTypeMapping=>
         [{:MediaType=>
            "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
           :ComplexTypeName=>"InstantiateVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml",
           :ComplexTypeName=>"MergeParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationFederationSettings+xml",
           :ComplexTypeName=>"OrgFederationSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.emailSettings+xml",
           :ComplexTypeName=>"EmailSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.prepareHostParams+xml",
           :ComplexTypeName=>"PrepareHostParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.org+xml",
           :ComplexTypeName=>"OrgType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.aclRule+xml",
           :ComplexTypeName=>"AclRuleType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.organizationLdapSettings+xml",
           :ComplexTypeName=>"OrgLdapSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.networkConnectionSection+xml",
           :ComplexTypeName=>"NetworkConnectionSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.owner+xml",
           :ComplexTypeName=>"OwnerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vdc+xml",
           :ComplexTypeName=>"AdminVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml",
           :ComplexTypeName=>"ImportVmIntoExistingVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.catalog+xml",
           :ComplexTypeName=>"CatalogType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml",
           :ComplexTypeName=>"CloneVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.createVdcParams+xml",
           :ComplexTypeName=>"CreateVdcParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmsObjectRefsList+xml",
           :ComplexTypeName=>"VmObjectRefsListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.undeployVAppParams+xml",
           :ComplexTypeName=>"UndeployVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.createSnapshotParams+xml",
           :ComplexTypeName=>"CreateSnapshotParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.blockingTask+xml",
           :ComplexTypeName=>"BlockingTaskType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwPvdcStorageProfile+xml",
           :ComplexTypeName=>"VMWProviderVdcStorageProfileType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.allocatedNetworkAddress+xml",
           :ComplexTypeName=>"AllocatedIpAddressesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vimServerNetworks+xml",
           :ComplexTypeName=>"VimObjectRefListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.blockingTaskOperationParams+xml",
           :ComplexTypeName=>"BlockingTaskOperationParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.updateProviderVdcStorageProfiles+xml",
           :ComplexTypeName=>"UpdateProviderVdcStorageProfilesParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.bundleUploadSocket+xml",
           :ComplexTypeName=>"BundleUploadSocketType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.gateway+xml",
           :ComplexTypeName=>"GatewayType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.screenTicket+xml",
           :ComplexTypeName=>"ScreenTicketType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.resourceClassAction+xml",
           :ComplexTypeName=>"ResourceClassActionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.event+xml",
           :ComplexTypeName=>"EventType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.tasksList+xml",
           :ComplexTypeName=>"TasksListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.migrateVmParams+xml",
           :ComplexTypeName=>"MigrateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.diskCreateParams+xml",
           :ComplexTypeName=>"DiskCreateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.registerVAppParams+xml",
           :ComplexTypeName=>"RegisterVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationGeneralSettings+xml",
           :ComplexTypeName=>"OrgGeneralSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.registerVimServerParams+xml",
           :ComplexTypeName=>"RegisterVimServerParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.datastore+xml",
           :ComplexTypeName=>"DatastoreType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml",
           :ComplexTypeName=>"DiskAttachOrDetachParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.updateRightsParams+xml",
           :ComplexTypeName=>"UpdateRightsParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.metadata+xml",
           :ComplexTypeName=>"MetadataType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vdcStorageProfile+xml",
           :ComplexTypeName=>"AdminVdcStorageProfileType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.systemSettings+xml",
           :ComplexTypeName=>"SystemSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwHostReferences+xml",
           :ComplexTypeName=>"VMWHostReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.userEntityRights+xml",
           :ComplexTypeName=>"UserEntityRightsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.metadata.value+xml",
           :ComplexTypeName=>"MetadataValueType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.media+xml",
           :ComplexTypeName=>"MediaType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.brandingSettings+xml",
           :ComplexTypeName=>"BrandingSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.updateVdcStorageProfiles+xml",
           :ComplexTypeName=>"UpdateVdcStorageProfilesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.amqpSettings+xml",
           :ComplexTypeName=>"AmqpSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.resourceClass+xml",
           :ComplexTypeName=>"ResourceClassType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.deployVAppParams+xml",
           :ComplexTypeName=>"DeployVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.resourcePoolList+xml",
           :ComplexTypeName=>"ResourcePoolListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vdcStorageProfile+xml",
           :ComplexTypeName=>"VdcStorageProfileType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.networkConfigSection+xml",
           :ComplexTypeName=>"NetworkConfigSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml",
           :ComplexTypeName=>"OrganizationResourcePoolSetType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.createProviderVdcParams+xml",
           :ComplexTypeName=>"VMWProviderVdcParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.publishCatalogParams+xml",
           :ComplexTypeName=>"PublishCatalogParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwExtension+xml",
           :ComplexTypeName=>"VMWExtensionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.notificationsSettings+xml",
           :ComplexTypeName=>"NotificationsSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.right+xml",
           :ComplexTypeName=>"RightType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.supportedSystemsInfo+xml",
           :ComplexTypeName=>"SupportedOperatingSystemsInfoType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vm.complianceResult+xml",
           :ComplexTypeName=>"ComplianceResultType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.orgList+xml",
           :ComplexTypeName=>"OrgListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwVimServerReferences+xml",
           :ComplexTypeName=>"VMWVimServerReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml",
           :ComplexTypeName=>"VMWExternalNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.entity+xml",
           :ComplexTypeName=>"EntityType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneMediaParams+xml",
           :ComplexTypeName=>"CloneMediaParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.licensingReport+xml",
           :ComplexTypeName=>"LicensingReportType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.apiDefinition+xml",
           :ComplexTypeName=>"ApiDefinitionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vshieldmanager+xml",
           :ComplexTypeName=>"ShieldManagerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.blockingTaskList+xml",
           :ComplexTypeName=>"ReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vmPendingAnswer+xml",
           :ComplexTypeName=>"VmQuestionAnswerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.rasdItemsList+xml",
           :ComplexTypeName=>"RasdItemsListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.generalSettings+xml",
           :ComplexTypeName=>"GeneralSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.group+xml",
           :ComplexTypeName=>"GroupType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.controlAccess+xml",
           :ComplexTypeName=>"ControlAccessParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.user+xml",
           :ComplexTypeName=>"UserType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwvirtualcenter+xml",
           :ComplexTypeName=>"VimServerType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.strandedItem+xml",
           :ComplexTypeName=>"StrandedItemType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.leaseSettingsSection+xml",
           :ComplexTypeName=>"LeaseSettingsSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationEmailSettings+xml",
           :ComplexTypeName=>"OrgEmailSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.cloneVAppParams+xml",
           :ComplexTypeName=>"CloneVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.task+xml",
           :ComplexTypeName=>"TaskType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vAppLeaseSettings+xml",
           :ComplexTypeName=>"OrgLeaseSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.role+xml",
           :ComplexTypeName=>"RoleType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwProviderVdcReferences+xml",
           :ComplexTypeName=>"VMWProviderVdcReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.customizationSection+xml",
           :ComplexTypeName=>"CustomizationSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.service+xml",
           :ComplexTypeName=>"ServiceType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.relocateVmParams+xml",
           :ComplexTypeName=>"RelocateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.rights+xml",
           :ComplexTypeName=>"RightRefsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vmwExternalNetworkReferences+xml",
           :ComplexTypeName=>"VMWExternalNetworkReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.disk+xml",
           :ComplexTypeName=>"DiskType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.kerberosSettings+xml",
           :ComplexTypeName=>"KerberosSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.operationLimitsSettings+xml",
           :ComplexTypeName=>"OrgOperationLimitsSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.host+xml",
           :ComplexTypeName=>"HostType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.catalogItem+xml",
           :ComplexTypeName=>"CatalogItemType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.entityReferences+xml",
           :ComplexTypeName=>"EntityReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vdc+xml",
           :ComplexTypeName=>"VdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.catalog+xml",
           :ComplexTypeName=>"AdminCatalogType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.recomposeVAppParams+xml",
           :ComplexTypeName=>"RecomposeVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.orgVdcNetwork+xml",
           :ComplexTypeName=>"OrgVdcNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.providervdc+xml",
           :ComplexTypeName=>"ProviderVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.blockingTaskUpdateProgressOperationParams+xml",
           :ComplexTypeName=>"BlockingTaskUpdateProgressParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vdcReferences+xml",
           :ComplexTypeName=>"VdcReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.systemPasswordPolicySettings+xml",
           :ComplexTypeName=>"SystemPasswordPolicySettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vApp+xml",
           :ComplexTypeName=>"VAppType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwprovidervdc+xml",
           :ComplexTypeName=>"VMWProviderVdcType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vms+xml",
           :ComplexTypeName=>"VmsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.orgSettings+xml",
           :ComplexTypeName=>"OrgSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.apiFilter+xml",
           :ComplexTypeName=>"ApiFilterType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.captureVAppParams+xml",
           :ComplexTypeName=>"CaptureVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vmCapabilitiesSection+xml",
           :ComplexTypeName=>"VmCapabilitiesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.runtimeInfoSection+xml",
           :ComplexTypeName=>"RuntimeInfoSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.amqpSettingsTest+xml",
           :ComplexTypeName=>"AmqpSettingsTestType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml",
           :ComplexTypeName=>"ImportVmAsVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.guestPersonalizationSettings+xml",
           :ComplexTypeName=>"OrgGuestPersonalizationSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.orgNetwork+xml",
           :ComplexTypeName=>"OrgNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.fileDescriptor+xml",
           :ComplexTypeName=>"FileDescriptorType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml",
           :ComplexTypeName=>"UploadVAppTemplateParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.licensingReportList+xml",
           :ComplexTypeName=>"LicensingReportListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPool+xml",
           :ComplexTypeName=>"VMWNetworkPoolType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.taskOperationList+xml",
           :ComplexTypeName=>"TaskOperationListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vSphereWebClientUrl+xml",
           :ComplexTypeName=>"VSphereWebClientUrlType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.productSections+xml",
           :ComplexTypeName=>"ProductSectionListType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.blockingTaskSettings+xml",
           :ComplexTypeName=>"BlockingTaskSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vAppTemplate+xml",
           :ComplexTypeName=>"VAppTemplateType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.organizationPasswordPolicySettings+xml",
           :ComplexTypeName=>"OrgPasswordPolicySettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml",
           :ComplexTypeName=>"MediaInsertOrEjectParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vmPendingQuestion+xml",
           :ComplexTypeName=>"VmPendingQuestionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.organization+xml",
           :ComplexTypeName=>"AdminOrgType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.ldapSettings+xml",
           :ComplexTypeName=>"LdapSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.snapshotSection+xml",
           :ComplexTypeName=>"SnapshotSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml",
           :ComplexTypeName=>"OrgVAppTemplateLeaseSettingsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.importMediaParams+xml",
           :ComplexTypeName=>"ImportMediaParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml",
           :ComplexTypeName=>"UpdateResourcePoolSetParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.licenseSettings+xml",
           :ComplexTypeName=>"LicenseType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.bundleUploadParams+xml",
           :ComplexTypeName=>"BundleUploadParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwNetworkPoolReferences+xml",
           :ComplexTypeName=>"VMWNetworkPoolReferencesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vcloud+xml",
           :ComplexTypeName=>"VCloudType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.serviceResource+xml",
           :ComplexTypeName=>"ServiceResourceType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.composeVAppParams+xml",
           :ComplexTypeName=>"ComposeVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.admin.vmwProviderVdcResourcePool+xml",
           :ComplexTypeName=>"VMWProviderVdcResourcePoolSetType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vm+xml",
           :ComplexTypeName=>"VmType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>
            "application/vnd.vmware.vcloud.guestCustomizationSection+xml",
           :ComplexTypeName=>"GuestCustomizationSectionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.session+xml",
           :ComplexTypeName=>"SessionType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.pvdcStorageProfile+xml",
           :ComplexTypeName=>"ProviderVdcStorageProfileType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwStorageProfiles+xml",
           :ComplexTypeName=>"VMWStorageProfilesType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.importVmAsVAppParams+xml",
           :ComplexTypeName=>"ImportVmAsVAppParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.serviceLink+xml",
           :ComplexTypeName=>"ServiceLinkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.enableDownloadParams+xml",
           :ComplexTypeName=>"EnableDownloadParamsType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.rasdItem+xml",
           :ComplexTypeName=>"RASD_Type",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.startupSection+xml",
           :ComplexTypeName=>"StartupSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.virtualHardwareSection+xml",
           :ComplexTypeName=>"VirtualHardwareSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.operatingSystemSection+xml",
           :ComplexTypeName=>"OperatingSystemSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.networkSection+xml",
           :ComplexTypeName=>"NetworkSection_Type",
           :SchemaLocation=>
            "http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.vAppNetwork+xml",
           :ComplexTypeName=>"VAppNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.network+xml",
           :ComplexTypeName=>"NetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.vcloud.orgNetwork+xml",
           :ComplexTypeName=>"OrgNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/master.xsd"},
          {:MediaType=>"application/vnd.vmware.admin.vmwexternalnet+xml",
           :ComplexTypeName=>"VMWExternalNetworkType",
           :SchemaLocation=>
            "http://#{@host}#{@path}/v1.5/schema/vmwextensions.xsd"}]}]}

  Excon::Response.new(
    :body => body,
    :headers => {'Content-Type' => 'text/xml'},
    :status => 200
  )
end

#get_task(id) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/fog/vcloud_director/requests/compute/get_task.rb', line 98

def get_task(id)
  unless data[:tasks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'This operation is denied.'
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(task_body(id))

  Excon::Response.new(
    :status => 200,
    :headers => {'Type' => "application/#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_task_list(id) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/fog/vcloud_director/requests/compute/get_task_list.rb', line 104

def get_task_list(id)
  unless id == data[:org][:uuid]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"com.vmware.vcloud.entity.org:#{id}\"."
    )
  end

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
    :href => make_href("tasksList/#{id}"),
    :type => "application/vnd.vmware.vcloud.tasksList+xml",
    :name => "Tasks Lists",
    :Task => data[:tasks].keys.map {|task_id| task_body(task_id)}
  }

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_vcloudObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fog/vcloud_director/requests/compute/get_vcloud.rb', line 50

def get_vcloud
  body =
    {:href=>make_href('admin/'),
     :type=>"application/vnd.vmware.admin.vcloud+xml",
     :name=>'VMware vCloud Director',
     :Description=>'5.1.2.1377223 Tue Oct 15 20:56:05 GMT 2013',
     :Tasks=>{:Task=>[]},
     :OrganizationReferences=>
      {:OrganizationReference=>
       [{:type=>"application/vnd.vmware.admin.organization+xml",
         :name=>data[:org][:name],
         :href=>make_href("api/admin/org/#{data[:org][:uuid]}")}]},
     :ProviderVdcReferences=>{:ProviderVdcReference=>[]},
     :RightReferences=>{:RightReference=>[]},
     :RoleReferences=>{:RoleReference=>[]},
     :Networks=>{:Network=>[]}}

  Excon::Response.new(
    :body    => body,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :status  => 200
  )
end

#get_vdc(vdc_id) ⇒ Object



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/fog/vcloud_director/requests/compute/get_vdc.rb', line 31

def get_vdc(vdc_id)
  response = Excon::Response.new

  unless vdc = data[:vdcs][vdc_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"com.vmware.vcloud.entity.vdc:#{vdc_id}\"."
    )
  end

  body =
    {:xmlns=>xmlns,
     :xmlns_xsi=>xmlns_xsi,
     :status=>"1",
     :name=>vdc[:name],
     :id=>"urn:vcloud:vdc:#{vdc_id}",
     :type=>"application/vnd.vmware.vcloud.vdc+xml",
     :href=>make_href("vdc/#{vdc_id}"),
     :xsi_schemaLocation=>xsi_schema_location,
     :Link=>
      [{:rel=>"up",
        :type=>"application/vnd.vmware.vcloud.org+xml",
        :href=>make_href("org/#{data[:org][:uuid]}")},
       {:rel=>"down",
        :type=>"application/vnd.vmware.vcloud.metadata+xml",
        :href=>make_href("vdc/#{vdc_id}/metadata")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml",
        :href=>
         make_href("vdc/#{vdc_id}/action/uploadVAppTemplate")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.media+xml",
        :href=>make_href("vdc/#{vdc_id}/media")},
       {:rel=>"add",
        :type=>
         "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
        :href=>
         make_href("vdc/#{vdc_id}/action/instantiateVAppTemplate")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.cloneVAppParams+xml",
        :href=>make_href("vdc/#{vdc_id}/action/cloneVApp")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml",
        :href=>
         make_href("vdc/#{vdc_id}/action/cloneVAppTemplate")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.cloneMediaParams+xml",
        :href=>make_href("vdc/#{vdc_id}/action/cloneMedia")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.captureVAppParams+xml",
        :href=>make_href("vdc/#{vdc_id}/action/captureVApp")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.composeVAppParams+xml",
        :href=>make_href("vdc/#{vdc_id}/action/composeVApp")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.diskCreateParams+xml",
        :href=>make_href("vdc/#{vdc_id}/disk")},
       {:rel=>"edgeGateways",
        :type=>"application/vnd.vmware.vcloud.query.records+xml",
        :href=>make_href("admin/vdc/#{vdc_id}/edgeGateways")},
       {:rel=>"add",
        :type=>"application/vnd.vmware.vcloud.orgVdcNetwork+xml",
        :href=>make_href("admin/vdc/#{vdc_id}/networks")},
       {:rel=>"orgVdcNetworks",
        :type=>"application/vnd.vmware.vcloud.query.records+xml",
        :href=>make_href("admin/vdc/#{vdc_id}/networks")}],
     :Description=>vdc[:description]||'',
     :AllocationModel=>"AllocationVApp",
     :ComputeCapacity=>
      {:Cpu=>
       {:Units=>"MHz",
        :Allocated=>"0",
        :Limit=>"0",
        :Reserved=>"0",
        :Used=>"0",
        :Overhead=>"0"},
      :Memory=>
       {:Units=>"MB",
        :Allocated=>"0",
        :Limit=>"0",
        :Reserved=>"0",
        :Used=>"0",
        :Overhead=>"0"}},
     :ResourceEntities => {},
     :AvailableNetworks => {},
     :Capabilities=>
      {:SupportedHardwareVersions=>
       {:SupportedHardwareVersion=>"vmx-08"}},
     :NicQuota=>"0",
     :NetworkQuota=>"20",
     :UsedNetworkCount=>"0",
     :VmQuota=>"100",
     :IsEnabled=>"true"}

  body[:ResourceEntities][:ResourceEntity] =
    data[:catalog_items].map do |id, item|
      {:type=>"application/vnd.vmware.vcloud.#{item[:type]}+xml",
       :name=>item[:name],
       :href=>make_href("#{item[:type]}/#{item[:type]}-#{id}")}
    end

  body[:AvailableNetworks][:Network] =
    data[:networks].map do |id, network|
      {:type=>"application/vnd.vmware.vcloud.network+xml",
       :name=>network[:name],
       :href=>make_href("network/#{id}")}
  end

  if api_version.to_f >= 5.1
    body[:VdcStorageProfiles] = {}
    body[:VdcStorageProfiles][:VdcStorageProfile] =
      data[:vdc_storage_classes].select do |id, storage_class|
        storage_class[:vdc] == vdc_id
      end.map do |id, storage_class|
        {:type => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml',
         :name => storage_class[:name],
         :href => make_href("vdcStorageProfile/#{id}")}
      end
  end

  response.status = 200
  response.headers = {'Content-Type' => "#{body[:type]};version=#{api_version}"}
  response.body = body
  response
end

#get_vdc_storage_class(id) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/get_vdc_storage_class.rb', line 47

def get_vdc_storage_class(id)
  unless vdc_storage_class = data[:vdc_storage_classes][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.vdcstorageProfile:#{id})\"."
    )
  end

  body =
    {:xmlns=>xmlns,
     :xmlns_xsi=>xmlns_xsi,
     :name=>vdc_storage_class[:name],
     :id=>"urn:vcloud:vdcstorageProfile:#{id}",
     :type=>"application/vnd.vmware.vcloud.vdcStorageProfile+xml",
     :href=>make_href("api/vdcStorageProfile/#{id}"),
     :xsi_schemaLocation=>xsi_schema_location,
     :Link=>
      [{:rel=>"up",
        :type=>"application/vnd.vmware.vcloud.vdc+xml",
        :href=>make_href("vdc/#{vdc_storage_class[:vdc]}")},
       {:rel=>"down",
        :type=>"application/vnd.vmware.vcloud.metadata+xml",
        :href=>make_href("vdcStorageProfile/#{id}/metadata")}],
     :Enabled=>vdc_storage_class[:enabled].to_s,
     :Units=>vdc_storage_class[:units],
     :Limit=>vdc_storage_class[:limit].to_s,
     :Default=>vdc_storage_class[:default].to_s}

  Excon::Response.new(
    :status => 200,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#get_vms_disk_attached_to(id) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/fog/vcloud_director/requests/compute/get_vms_disk_attached_to.rb', line 27

def get_vms_disk_attached_to(id)
  unless data[:disks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "com.vmware.vcloud.entity.disk:%s".' % id
    )
  end

  Fog::Mock.not_implemented
end

#org_nameObject



678
679
680
681
682
683
684
685
686
687
688
689
# File 'lib/fog/vcloud_director/compute.rb', line 678

def org_name
  @org_name ||=
    begin
      username = @vcloud_director_username.split('@')
      if username.size >= 2 # may be 'email_address@org_name'
        username.last
      else
        Fog::Logger.warning('vcloud_director_username should be in the form user@org_name')
        'vcd_org_name'
      end
    end
end

#post_cancel_task(id) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fog/vcloud_director/requests/compute/post_cancel_task.rb', line 25

def post_cancel_task(id)
  unless task = data[:tasks][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "com.vmware.vcloud.entity.task:%s"' % id
    )
  end

  # @note Tasks don't actually get cancelled (confirmed VCloud Director
  #   bug) so we'll emulate that. Set the flag and we're done!
  task[:cancel_requested] = true

  Excon::Response.new(
    :status => 204
  )
end

#post_clone_media(vdc_id, source_id, options = {}) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/post_clone_media.rb', line 53

def post_clone_media(vdc_id, source_id, options={})
  # TODO: check this happens.
  unless source_media = data[:medias][source_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.media:#{source_id})\"."
    )
  end
  unless data[:vdcs][vdc_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
    )
  end

  media_id = uuid
  media_name = "#{source_media[:name]}-copy-#{uuid}"

  owner = {
    :href => make_href("media/#{media_id}"),
    :type => 'application/vnd.vmware.vcloud.media+xml'
  }
  task_id = enqueue_task(
    "Copy Media File #{media_name}(#{media_id})", 'vdcCopyMedia', owner,
    :on_success => lambda do
      data[:medias][media_id][:status] = 1
    end
  )

  media = source_media.dup.merge(
    :name => media_name,
    :status => 0,
    :tasks => [task_id]
  )
  data[:medias][media_id] = media

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(media_body(media_id))

  Excon::Response.new(
    :status => 201,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#post_configure_edge_gateway_services(id, configuration) ⇒ Object



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
# File 'lib/fog/vcloud_director/requests/compute/post_configure_edge_gateway_services.rb', line 39

def post_configure_edge_gateway_services(id, configuration)
  unless data[:edge_gateways][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
              "No access to entity \"(com.vmware.vcloud.entity.edgegateway:#{id})\"."
          )
  end

  owner = {:href => '', :name => nil, :type => nil} #known-bug: admin-api does not return owner.
  task_id = enqueue_task(
      "Configuring edgegateway(#{id})", 'networkConfigureEdgeGatewayServices', owner,
      :on_success => lambda do
        data[:edge_gateways][id][:Configuration][:EdgeGatewayServiceConfiguration] = configuration
      end
  )

  body = {
      :xmlns => xmlns,
      :xmlns_xsi => xmlns_xsi,
      :xsi_schemaLocation => xsi_schema_location,
  }.merge(task_body(task_id))

  Excon::Response.new(
      :status => 202,
      :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
      :body => body
  )
end

#post_create_org_vdc_network(vdc_id, name, options = {}) ⇒ Object



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/fog/vcloud_director/requests/compute/post_create_org_vdc_network.rb', line 72

def post_create_org_vdc_network(vdc_id, name, options={})
  unless data[:vdcs][vdc_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
    )
  end

  type = 'network'
  id = uuid

  # Description
  # Configuration
  #   IpScopes
  #     IpScope
  #       IsInherited
  #       Gateway
  #       Netmask
  #       Dns1
  #       Dns2
  #       DnsSuffix
  #       IsEnabled
  #       IpRanges
  #         IpRange
  #           StartAddress
  #           EndAddress
  #   FenceMode
  # EdgeGateway
  # IsShared

  network_body = {
    :name           => name,
    :vdc            => vdc_id,
  }

  [:Description, :IsShared].each do |key|
    network_body[key] = options[key] if options.key?(key)
  end

  if options.key?(:EdgeGateway)
    network_body[:EdgeGateway] =
      options[:EdgeGateway][:href].split('/').last
  end

  if configuration = options[:Configuration]
    if ip_scopes = configuration[:IpScopes]
      if ip_scope = ip_scopes[:IpScope]
        [:IsInherited, :Gateway, :Netmask,
          :Dns1, :Dns2, :DnsSuffix, :IsEnabled].each do |key|
            network_body[key] = ip_scope[key] if ip_scope.key?(key)
        end
        if ip_ranges = ip_scope[:IpRanges]
          network_body[:IpRanges] = []
          ip_ranges.each do |ipr|
            network_body[:IpRanges] << {
              :StartAddress => ipr[:IpRange][:StartAddress],
              :EndAddress   => ipr[:IpRange][:EndAddress]
            }
          end
        end
      end
    end
    network_body[:FenceMode] = configuration[:FenceMode] if ip_scope.key?(:FenceMode)
  end

  owner = {
    :href => make_href("#{type}/#{id}"),
    :type => "application/vnd.vmware.vcloud.#{type}+xml"
  }
  task_id = enqueue_task(
    "Adding #{type} #{name} (#{id})", 'CreateOrgVdcNetwork', owner,
    :on_success => lambda do
      data[:networks][id] = network_body
    end
  )

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location,
    :href => make_href("admin/network/#{id}"),
    :name => name,
    :id => "urn:vcloud:network:#{id}",
    :type => "application/vnd.vmware.vcloud.orgVdcNetwork+xml",
    :Link => [
      {:rel=>"up", :type=>"application/vnd.vmware.vcloud.vdc+xml", :href=>make_href("vdc/#{vdc_id}")},
      {:rel=>"down", :type=>"application/vnd.vmware.vcloud.metadata+xml", :href=>make_href("admin/network/#{id}/metadata")},
      {:rel=>"down", :type=>"application/vnd.vmware.vcloud.allocatedNetworkAddress+xml", :href=>make_href("admin/network/#{id}/allocatedAddresses/")},
    ],
  }.merge(options)

  body[:Tasks] = {
    :Task => task_body(task_id)
  }

  Excon::Response.new(
    :status => 201,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )

end

#post_upload_disk(id, name, size, options = {}) ⇒ Object



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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/fog/vcloud_director/requests/compute/post_upload_disk.rb', line 82

def post_upload_disk(id, name, size, options={})
  unless size.to_s =~ /^\d+$/
    raise Fog::Compute::VcloudDirector::BadRequest.new(
      "validation error on field 'diskSpec.sizeBytes': must be greater than or equal to 0"
    )
  end
  unless data[:vdcs][id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      'No access to entity "(com.vmware.vcloud.entity.vdc:%s)".' % id
    )
  end

  disk_id = uuid

  owner = {
    :href => make_href("disk/#{disk_id}"),
    :type => 'application/vnd.vmware.vcloud.disk+xml'
  }
  task_id = enqueue_task(
    "Creating Disk #{name}(#{disk_id})", 'vdcCreateDisk', owner,
    :on_success => lambda do
      data[:disks][disk_id][:status] = 1
    end
  )

  disk = {
    :description => options[:Description],
    :name => name,
    :size => size.to_i,
    :status => 0,
    :tasks => [task_id],
    :vdc_id => id,
    :vdc_storage_class => data[:vdc_storage_classes].detect {|k,v| v[:default]}.first
  }
  data[:disks][disk_id] = disk

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(disk_body(disk_id))

  Excon::Response.new(
    :status => 201,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#post_upload_media(vdc_id, name, image_type, size, options = {}) ⇒ Object



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
112
113
114
115
116
# File 'lib/fog/vcloud_director/requests/compute/post_upload_media.rb', line 56

def post_upload_media(vdc_id, name, image_type, size, options={})
  unless ['iso','floppy'].include?(image_type)
    raise Fog::Compute::VcloudDirector::BadRequest.new(
      'The value of parameter imageType is incorrect.'
    )
  end
  unless size.to_s =~ /^\d+$/
    raise Fog::Compute::VcloudDirector::BadRequest.new(
      'validation error on field \'size\': must be greater than or equal to 0'
    )
  end
  unless data[:vdcs][vdc_id]
    raise Fog::Compute::VcloudDirector::Forbidden.new(
      "No access to entity \"(com.vmware.vcloud.entity.vdc:#{vdc_id})\"."
    )
  end

  media_id = uuid
  file_id = uuid

  owner = {
    :href => make_href("media/#{media_id}"),
    :type => 'application/vnd.vmware.vcloud.media+xml'
  }
  task_id = enqueue_task(
    "Importing Media File #{name}(#{file_id})", 'vdcUploadMedia', owner,
    :on_success => lambda do
      media = data[:medias][media_id]
      media[:file][:bytes_transferred] = media[:size]
      media[:status] = 1
    end
  )

  media = {
    :description => options[:Description],
    :file => {
      :bytes_transferred => 0,
      :uuid => file_id
    },
    :image_type => image_type,
    :name => name,
    :size => size.to_i,
    :status => 0,
    :tasks => [task_id],
    :vdc_id => vdc_id,
    :vdc_storage_class => data[:vdc_storage_classes].detect {|k,v| v[:default]}.first
  }
  data[:medias][media_id] = media

  body = {
    :xmlns => xmlns,
    :xmlns_xsi => xmlns_xsi,
    :xsi_schemaLocation => xsi_schema_location
  }.merge(media_body(media_id))

  Excon::Response.new(
    :status => 201,
    :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
    :body => body
  )
end

#process_task(response_body) ⇒ Boolean

Note:

As far as this method is concerned, the only possible task states are ‘running’ and ‘success’.

Parameters:

  • response_body (Hash)

Returns:

  • (Boolean)


741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/fog/vcloud_director/compute.rb', line 741

def process_task(response_body)
  task_id = response_body[:href].split('/').last
  task = data[:tasks][task_id]

  if task[:status] == 'running'
    task[:end_time] = DateTime.now
    task[:progress] = 100
    task[:status] = 'success'

    if task[:on_success]
      task[:on_success].call
      task.delete(:on_success)
    end
  end

  return true if task[:status] == 'success'
  raise TaskError.new "status: #{task[:status]}, error: #{task[:Error]}"
end

#user_nameObject



691
692
693
# File 'lib/fog/vcloud_director/compute.rb', line 691

def user_name
  @user_name ||= @vcloud_director_username.split('@').first
end

#user_uuidObject



695
696
697
# File 'lib/fog/vcloud_director/compute.rb', line 695

def user_uuid
  @user_uuid ||= uuid
end

#uuidObject



699
700
701
# File 'lib/fog/vcloud_director/compute.rb', line 699

def uuid
  [8,4,4,4,12].map {|i| Fog::Mock.random_hex(i)}.join('-')
end

#vcloud_tokenObject



674
675
676
# File 'lib/fog/vcloud_director/compute.rb', line 674

def vcloud_token
  @vcloud_token || Fog::Mock.random_base64(32)
end