Class: VCloud::Org
- Inherits:
-
BaseVCloudEntity
- Object
- BaseVCloudEntity
- VCloud::Org
- Defined in:
- lib/vcloud/user/org.rb
Overview
An org contains links to VDCs, Catalogs, and Org Networks
Instance Method Summary collapse
-
#catalog_links ⇒ Array<VCloud::Link>
Returns all links to Catalogs.
-
#get_catalog_from_name(name, session = self.session) ⇒ VCloud::Catalog
Retrieves an Catalog, assuming the user has access to it.
-
#get_catalog_links_by_name ⇒ Hash{String => VCloud::Link}
Returns a hash of of all Catalog links keyed by the Catalog name.
-
#get_vdc_from_name(name, session = self.session) ⇒ VCloud::Vdc
Retrieves a VDC, assuming the user has access to it.
-
#get_vdc_links_by_name ⇒ Hash{String => VCloud::Link}
Returns a hash of of all VDCs links keyed by the Catalog name.
-
#org_network_links ⇒ Array<VCloud::Link>
Returns all links to OrgNetworks.
-
#vdc_links ⇒ Array<VCloud::Link>
Returns all links to VDCs.
Methods inherited from BaseVCloudEntity
attr_accessor, attr_reader, attr_writer, from_reference, inherited, #initialize, type
Methods included from RestApi
#build_generic_http_opts, #create, #delete, #http_request, #parse_response, #post, #refresh, #update
Constructor Details
This class inherits a constructor from VCloud::BaseVCloudEntity
Instance Method Details
#catalog_links ⇒ Array<VCloud::Link>
Returns all links to Catalogs
22 23 24 |
# File 'lib/vcloud/user/org.rb', line 22 def catalog_links @links.select {|l| l.type == VCloud::Constants::ContentType::CATALOG} end |
#get_catalog_from_name(name, session = self.session) ⇒ VCloud::Catalog
Retrieves an Catalog, assuming the user has access to it
45 46 47 48 49 |
# File 'lib/vcloud/user/org.rb', line 45 def get_catalog_from_name(name, session = self.session) catalogs = get_catalog_links_by_name link = catalogs[name] or return nil Catalog.from_reference(link, session) end |
#get_catalog_links_by_name ⇒ Hash{String => VCloud::Link}
Returns a hash of of all Catalog links keyed by the Catalog name
36 37 38 |
# File 'lib/vcloud/user/org.rb', line 36 def get_catalog_links_by_name Hash[catalog_links.collect { |l| [l.name, l] }] end |
#get_vdc_from_name(name, session = self.session) ⇒ VCloud::Vdc
Retrieves a VDC, assuming the user has access to it
63 64 65 66 67 |
# File 'lib/vcloud/user/org.rb', line 63 def get_vdc_from_name(name, session = self.session) links = get_vdc_links_by_name link = links[name] or return nil Vdc.from_reference(link, session) end |
#get_vdc_links_by_name ⇒ Hash{String => VCloud::Link}
Returns a hash of of all VDCs links keyed by the Catalog name
54 55 56 |
# File 'lib/vcloud/user/org.rb', line 54 def get_vdc_links_by_name Hash[vdc_links.collect { |l| [l.name, l] }] end |
#org_network_links ⇒ Array<VCloud::Link>
Returns all links to OrgNetworks
29 30 31 |
# File 'lib/vcloud/user/org.rb', line 29 def org_network_links @links.select {|l| l.type == VCloud::Constants::ContentType::ORG_NETWORK} end |
#vdc_links ⇒ Array<VCloud::Link>
Returns all links to VDCs
15 16 17 |
# File 'lib/vcloud/user/org.rb', line 15 def vdc_links @links.select {|l| l.type == VCloud::Constants::ContentType::VDC} end |