Created
September 11, 2013 10:57
-
-
Save snehaso/6522071 to your computer and use it in GitHub Desktop.
This ruby script tries to describe the all organisations within the current session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
require 'rubygems' | |
require 'vcloud' | |
def print_networks vdc | |
vdc.get_network_references_by_name | |
end | |
# create session and authenticate | |
@session = VCloud::Client.new( 'https://api.vcd.portal.skyscapecloud.com/api/', '1.5', :verify_ssl => false) | |
@session.login('260.3.4edba2@4-3-51-7942a4', ENV['SKYSCAPE_PASSWORD']) | |
#describe organisations in current session | |
org_links = @session.links.select{ |l| l.type == VCloud::Constants::ContentType::ORG } | |
org_links.each do |org_link| | |
p "\nOrganization in current sessions: " | |
org = @session.get_org_from_name(org_link.name) | |
p org | |
p "\n\nprinting vdc and network information" | |
org.vdc_links.each do |link| | |
p "printing vdcs inside org - 4-3-51-7942a4" | |
p vdc = org.get_vdc_from_name(link.name) | |
p print_networks(vdc) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment