Created
January 2, 2014 23:02
-
-
Save elight/8228844 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
AUTH_URL = "https://identity.api.rackspacecloud.com/v2.0/tokens" | |
compute = Fog::Compute.new( | |
:provider => "OpenStack", | |
# Appears to require Rackspace user password and *not* API key :-( | |
:openstack_api_key => ENV["OS_PASSWORD"], | |
:openstack_username => ENV["OS_USERNAME"], | |
:openstack_auth_url => AUTH_URL, | |
:openstack_region => "IAD" | |
) | |
puts "FLAVORS (name: id)" | |
puts "-------" | |
compute.flavors.each do |f| | |
puts "#{f.name}: #{f.id}" | |
end | |
puts | |
puts "IMAGES (name: id)" | |
puts "------" | |
compute.images.each do |i| | |
puts "#{i.name}: #{i.id}" | |
end | |
# Builds an Ubuntu 12.04 LTS 1GB Performance 1 server. | |
# You can verify that the flavor and image IDssu | |
# server = compute.servers.new( | |
# :name => "test server", | |
# :flavor_ref => "performance1-1", | |
# :image_ref => "80fbcb55-b206-41f9-9bc2-2dd7aac6c061" | |
# ) | |
# server.save | |
puts | |
identity_service = Fog::Identity.new( | |
:provider => 'OpenStack', # OpenStack Fog provider | |
:openstack_username => ENV['OS_USERNAME'], # Your OpenStack username | |
:openstack_api_key => ENV['OS_PASSWORD'], # Your OpenStack api_key/password | |
:openstack_auth_url => AUTH_URL | |
) | |
p identity_service.service_catalog.display_service_regions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment